Skip to content

Commit 8390810

Browse files
committed
fix gentoo drawio binary name
1 parent f813f0b commit 8390810

File tree

2 files changed

+76
-76
lines changed

2 files changed

+76
-76
lines changed

chatu-common.el

Lines changed: 73 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,73 @@
1-
;;; chatu-common.el --- Common functions for chatu-mode -*- lexical-binding: t -*-
2-
3-
;; Copyright (c) 2024 Kimi Ma <[email protected]>
4-
5-
;; Author: Kimi Ma <[email protected]>
6-
;; URL: https://github.com/kimim/chatu
7-
;; Keywords: multimedia convenience
8-
9-
;; This file is NOT part of GNU Emacs.
10-
11-
;;; License:
12-
13-
;; This program is free software: you can redistribute it and/or modify
14-
;; it under the terms of the GNU General Public License as published by
15-
;; the Free Software Foundation, either version 3 of the License, or
16-
;; (at your option) any later version.
17-
18-
;; This program is distributed in the hope that it will be useful,
19-
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20-
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21-
;; GNU General Public License for more details.
22-
23-
;; You should have received a copy of the GNU General Public License
24-
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
25-
26-
;;; Commentary:
27-
28-
;; `chatu-common-with-extension' to add file extension.
29-
;; `chatu-common-open-external' to open input file in system.
30-
31-
;;; Code:
32-
33-
(defun chatu-common-with-extension (path file-ext)
34-
"Add FILE-EXT to PATH if PATH has no extension."
35-
(if (file-name-extension path)
36-
path
37-
(file-name-with-extension path file-ext)))
38-
39-
(defun chatu-common-open-other-window (path empty)
40-
"Open chatu PATH in other window.
41-
Fill PATH with EMPTY string if nonexist."
42-
(let ((parent (file-name-parent-directory path)))
43-
(when (not (file-exists-p parent))
44-
(make-directory parent t))
45-
(when (not (file-exists-p path))
46-
(write-region empty nil path))
47-
(find-file-other-window path)))
48-
49-
(defun chatu-common-open-external (executable path empty)
50-
"Open chatu PATH with EXECUTABLE program.
51-
Fill PATH with EMPTY string, if nonexist."
52-
(let ((parent (file-name-parent-directory path)))
53-
(when (not (file-exists-p parent))
54-
(make-directory parent t))
55-
(when (not (file-exists-p path))
56-
(write-region empty nil path))
57-
(cond
58-
;; ensure that draw.io.exe is in execute PATH
59-
((string-equal system-type "windows-nt")
60-
(if (fboundp 'w32-shell-execute)
61-
(w32-shell-execute "open" path)))
62-
;; TODO: need some test for other systems
63-
((string-equal system-type "darwin")
64-
(start-process "" nil "open" "-a" executable
65-
path))
66-
((string-equal system-type "gnu/linux")
67-
(start-process "" nil "xdg-open"
68-
executable path))
69-
((string-equal system-type "cygwin")
70-
(start-process "" nil "xdg-open"
71-
executable path)))))
72-
73-
(provide 'chatu-common)
74-
75-
;;; chatu-common.el ends here
1+
;;; chatu-common.el --- Common functions for chatu-mode -*- lexical-binding: t -*-
2+
3+
;; Copyright (c) 2024 Kimi Ma <[email protected]>
4+
5+
;; Author: Kimi Ma <[email protected]>
6+
;; URL: https://github.com/kimim/chatu
7+
;; Keywords: multimedia convenience
8+
9+
;; This file is NOT part of GNU Emacs.
10+
11+
;;; License:
12+
13+
;; This program is free software: you can redistribute it and/or modify
14+
;; it under the terms of the GNU General Public License as published by
15+
;; the Free Software Foundation, either version 3 of the License, or
16+
;; (at your option) any later version.
17+
18+
;; This program is distributed in the hope that it will be useful,
19+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
;; GNU General Public License for more details.
22+
23+
;; You should have received a copy of the GNU General Public License
24+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
26+
;;; Commentary:
27+
28+
;; `chatu-common-with-extension' to add file extension.
29+
;; `chatu-common-open-external' to open input file in system.
30+
31+
;;; Code:
32+
33+
(defun chatu-common-with-extension (path file-ext)
34+
"Add FILE-EXT to PATH if PATH has no extension."
35+
(if (file-name-extension path)
36+
path
37+
(file-name-with-extension path file-ext)))
38+
39+
(defun chatu-common-open-other-window (path empty)
40+
"Open chatu PATH in other window.
41+
Fill PATH with EMPTY string if nonexist."
42+
(let ((parent (file-name-parent-directory path)))
43+
(when (not (file-exists-p parent))
44+
(make-directory parent t))
45+
(when (not (file-exists-p path))
46+
(write-region empty nil path))
47+
(find-file-other-window path)))
48+
49+
(defun chatu-common-open-external (executable path empty)
50+
"Open chatu PATH with EXECUTABLE program.
51+
Fill PATH with EMPTY string, if nonexist."
52+
(let ((parent (file-name-parent-directory path)))
53+
(when (not (file-exists-p parent))
54+
(make-directory parent t))
55+
(when (not (file-exists-p path))
56+
(write-region empty nil path))
57+
(cond
58+
;; ensure that draw.io.exe is in execute PATH
59+
((string-equal system-type "windows-nt")
60+
(if (fboundp 'w32-shell-execute)
61+
(w32-shell-execute "open" path)))
62+
;; TODO: need some test for other systems
63+
((string-equal system-type "darwin")
64+
(start-process "" nil "open" "-a" executable path))
65+
((string-equal system-type "gnu/linux")
66+
(start-process "" nil executable path))
67+
((string-equal system-type "cygwin")
68+
(start-process "" nil "xdg-open"
69+
executable path)))))
70+
71+
(provide 'chatu-common)
72+
73+
;;; chatu-common.el ends here

chatu-drawio.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
(defun chatu-drawio--find-executable ()
4040
"Find the drawio executable on PATH, or else return an error."
4141
(condition-case nil
42-
(file-truename (executable-find "draw.io"))
42+
(file-truename (or (executable-find "draw.io")
43+
;; drawio on gentoo
44+
(executable-find "drawio")))
4345
(wrong-type-argument
4446
(message "Cannot find the draw.io executable on the PATH."))))
4547

0 commit comments

Comments
 (0)