aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjixiufeng <jixiufeng@luojilab.com>2018-11-25 23:48:35 +0800
committerjixiufeng <jixiufeng@luojilab.com>2018-11-25 23:56:02 +0800
commitf3dff9ded98fa9d078699ce52b2b0c119eedfcb9 (patch)
tree9757918f14f53d70c6c6c90064ecfcb00f8c730d
parent954ab9ffafbe7e7b7cb9f30ca55e9314f20268e2 (diff)
run hook vterm-exit-hook with term buffer as argument
-rw-r--r--vterm.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/vterm.el b/vterm.el
index 3a0a354..6623839 100644
--- a/vterm.el
+++ b/vterm.el
@@ -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
@@ -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,8 +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.