diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-15T22·53+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-12-15T22·54+0000 |
commit | f34c82f7654ad2c751524095b389c39343ab828b (patch) | |
tree | 6020b4c133e03f653e6ade6abc6ba9a99f86754e /tools/emacs | |
parent | 9f8542fe75e5d4c166316983093e26e37bdd332d (diff) |
refactor(emacs-pkgs): Extract term-switcher into separate emacs pkg
Diffstat (limited to 'tools/emacs')
-rw-r--r-- | tools/emacs/config/term-setup.el | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/tools/emacs/config/term-setup.el b/tools/emacs/config/term-setup.el deleted file mode 100644 index cd4f9c25ef73..000000000000 --- a/tools/emacs/config/term-setup.el +++ /dev/null @@ -1,36 +0,0 @@ -;; Utilities for X11 terminal buffers. - -(defvar x11-terminal-program "gnome-terminal" - "Which X11 terminal application to use.") - -(defvar x11-terminal-buffer-prefix "Term" - "String prefix for X11 terminal buffer names.") - -(defun open-or-create-terminal-buffer (buffer-name) - "Switch to the buffer with BUFFER-NAME or create a new buffer - running the configured X11 terminal." - (let ((buffer (get-buffer buffer-name))) - (if (not buffer) - (run-external-command x11-terminal-program) - (switch-to-buffer buffer)))) - -(defun is-terminal-buffer (buffer) - "Determine whether BUFFER runs an X11 terminal." - (and (equal 'exwm-mode (buffer-local-value 'major-mode buffer)) - (s-starts-with? x11-terminal-buffer-prefix (buffer-name buffer)))) - -(defun counsel-switch-to-terminal () - "Switch to an X11 terminal buffer, or create a new one." - (interactive) - (let ((terms (-map #'buffer-name - (-filter #'is-terminal-buffer (buffer-list))))) - (if terms - (ivy-read "Switch to terminal buffer: " - (cons "New terminal" terms) - :caller 'counsel-switch-to-terminal - :preselect (s-concat "^" x11-terminal-buffer-prefix) - :require-match t - :action #'open-or-create-terminal-buffer) - (run-external-command x11-terminal-program)))) - -(provide 'term-setup) |