about summary refs log tree commit diff
path: root/init/functions.el
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-10-31T09·29+0100
committerVincent Ambo <github@tazj.in>2019-02-10T20·43+0100
commit5b5f051b13633cec58e7daa0399085ffcdb1e430 (patch)
tree88c6ae48a8aeae1cd844caf4eea909cee7850d5a /init/functions.el
parent2c5946163c03dfa9b12f9bc83697c593965d08cd (diff)
refactor: Reutilise multi-term commands for Alacritty buffers
In practice I never use multi-term, but it's nice to have the same
buffer selection functionality for Alacritty buffers.
Diffstat (limited to 'init/functions.el')
-rw-r--r--init/functions.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/init/functions.el b/init/functions.el
index 640957f109..8b96a0e737 100644
--- a/init/functions.el
+++ b/init/functions.el
@@ -158,6 +158,16 @@ Including indent-buffer, which should not be called automatically on save."
    append lsdir into completions
    finally return (sort completions 'string-lessp)))
 
+(defun run-external-command (cmd)
+    "Execute the specified command and notify the user when it
+  finishes."
+    (message "Starting %s..." cmd)
+    (set-process-sentinel
+     (start-process-shell-command cmd nil cmd)
+     (lambda (process event)
+       (when (string= event "finished\n")
+         (message "%s process finished." process)))))
+
 (defun ivy-run-external-command ()
   "Prompts the user with a list of all installed applications and
   lets them select one to launch."
@@ -167,13 +177,7 @@ Including indent-buffer, which should not be called automatically on save."
     (ivy-read "Command:" external-commands-list
               :require-match t
               :history 'external-commands-history
-              :action (lambda (cmd)
-                        (message "Starting %s..." cmd)
-                        (set-process-sentinel
-                         (start-process-shell-command cmd nil cmd)
-                         (lambda (process event)
-                           (when (string= event "finished\n")
-                             (message "%s process finished." process))))))))
+              :action #'run-external-command)))
 
 (defun ivy-password-store (&optional password-store-dir)
   "Custom version of password-store integration with ivy that