diff options
| author | Oleg Pykhalov <go.wigust@gmail.com> | 2018-02-14 23:15:24 +0300 |
|---|---|---|
| committer | Oleg Pykhalov <go.wigust@gmail.com> | 2018-02-15 18:35:31 +0300 |
| commit | 7946bba0f487ffccafff07874df34894bdd38639 (patch) | |
| tree | 261de7eaaffdd6d928e3db9b998c871276b99bcf | |
| parent | Add remote directory support (diff) | |
| download | emacs-terminal-here-7946bba0f487ffccafff07874df34894bdd38639.tar.gz | |
Find executable for a terminal
* terminal-here.el (terminal-here-default-terminal-command): Find
executable for terminal.
| -rw-r--r-- | terminal-here.el | 16 | ||||
| -rw-r--r-- | test/terminal-here-test.el | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/terminal-here.el b/terminal-here.el index fc48529..5c9640d 100644 --- a/terminal-here.el +++ b/terminal-here.el @@ -30,6 +30,19 @@ :group 'external :prefix "terminal-here-") +(defcustom terminal-here-terminal-emulators + '("x-terminal-emulator" "sl" "urxvt" "gnome-terminal" + "xfce4-terminal" "konsole" "xterm") + "List of terminal emulators." + :group 'terminal-here + :type 'list) + +(defun terminal-here-find-terminal () + (file-name-nondirectory + (cl-some (lambda (executable) + (executable-find executable)) + terminal-here-terminal-emulators))) + (defun terminal-here-default-terminal-command (_dir) "Pick a good default command to use for DIR." (cond @@ -41,8 +54,7 @@ (list "cmd.exe" "/C" "start" "cmd.exe")) ;; Probably X11! - (t '("x-terminal-emulator")))) - + (t (list (terminal-here-find-terminal))))) (defcustom terminal-here-terminal-command #'terminal-here-default-terminal-command diff --git a/test/terminal-here-test.el b/test/terminal-here-test.el index 849f18d..02c2864 100644 --- a/test/terminal-here-test.el +++ b/test/terminal-here-test.el @@ -16,7 +16,8 @@ (ert-deftest linux-default-command () (with-terminal-here-mocks - (mock (start-process "x-terminal-emulator" * "x-terminal-emulator")) + (mock (start-process (terminal-here-find-terminal) * + (terminal-here-find-terminal))) (let ((system-type 'gnu/linux)) (custom-reevaluate-setting 'terminal-here-terminal-command) (terminal-here-launch-in-directory "adir")))) @@ -106,6 +107,6 @@ (setq launch-command command)))) (validate-setq terminal-here-command-flag "-k") (terminal-here-launch-in-directory "/ssh:david@pi:/home/pi/") - (should (equal (car launch-command) "x-terminal-emulator")) + (should (equal (car launch-command) (terminal-here-find-terminal))) (should (equal (cadr launch-command) "-k")) (should (equal (caddr launch-command) "ssh")))) |
