diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-12-03 20:19:38 +0100 |
|---|---|---|
| committer | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-12-03 20:19:38 +0100 |
| commit | d4e326a01ad1fd764ca5587f2e42b959034f35af (patch) | |
| tree | b546ca2ecb125206ffb8309ec9c7ba5343b09020 | |
| parent | c90f5b255c77190f6c3f2ee0ab7fbea062d7aae4 (diff) | |
| parent | 071e2cc74409ae2f0a71c1a77c1237ce538e68b3 (diff) | |
Merge branch 'run-vterm-exit-hook-with-1-args'
| -rw-r--r-- | vterm.el | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -54,7 +54,7 @@ to the terminal anymore." :type '(repeat string) :group 'vterm) -(defcustom vterm-exit-hook nil +(defcustom vterm-exit-functions nil "Shell exit hook. This hook applies only to new vterms, created after setting this @@ -65,16 +65,16 @@ Note that this hook will not work if another package like :type 'hook :group 'vterm) -(defcustom vterm-set-title-hook nil +(defcustom vterm-set-title-functions nil "Shell set title hook. those functions are called one by one, with 1 arguments. -`vterm-set-title-hook' should be a symbol, a hook variable. +`vterm-set-title-functions' should be a symbol, a hook variable. The value of HOOK may be nil, a function, or a list of functions. for example (defun vterm--rename-buffer-as-title (title) (rename-buffer (format \"vterm %s\" title))) -(add-hook 'vterm-set-title-hook 'vterm--rename-buffer-as-title) +(add-hook 'vterm-set-title-functions 'vterm--rename-buffer-as-title) see http://tldp.org/HOWTO/Xterm-Title-4.html about how to set terminal title for different shell. " @@ -159,7 +159,7 @@ for different shell. " :coding 'no-conversion :connection-type 'pty :filter #'vterm--filter - :sentinel (when vterm-exit-hook #'vterm--sentinel))))) + :sentinel (when vterm-exit-functions #'vterm--sentinel))))) ;; Keybindings (define-key vterm-mode-map [tab] #'vterm--self-insert) @@ -260,9 +260,9 @@ Then triggers a redraw from the module." (defun vterm--sentinel (process event) "Sentinel of vterm PROCESS." - (when (not (process-live-p process)) - (with-current-buffer (process-buffer process) - (run-hooks 'vterm-exit-hook)))) + (let ((buf (process-buffer process))) + (run-hook-with-args 'vterm-exit-functions + (if (buffer-live-p buf) buf nil)))) (defun vterm--window-size-change (frame) "Callback triggered by a size change of the FRAME. @@ -309,7 +309,7 @@ Feeds the size change to the virtual terminal." (defun vterm--set-title (title) "Run the `vterm--set-title-hook' with TITLE as argument." - (run-hook-with-args 'vterm-set-title-hook title)) + (run-hook-with-args 'vterm-set-title-functions title)) (provide 'vterm) |
