aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-03-04 20:11:05 -0800
committerGlenn Morris2011-03-04 20:11:05 -0800
commitd783d30393eb554f9a0d780570a7946a165885fb (patch)
treee007f478b68fefc200d59c1f2718569fbeecd129
parent4a0f18a8997ec7b4554cdc33a290654daf4a3080 (diff)
downloademacs-d783d30393eb554f9a0d780570a7946a165885fb.tar.gz
emacs-d783d30393eb554f9a0d780570a7946a165885fb.zip
Default all eshell hooks to nil (bug#5375)
* eshell/esh-mode.el (eshell-kill-buffer-function): New function. (eshell-mode): Use eshell-kill-buffer-function. Run the -initialize functions independently of the -load-hooks. * eshell/esh-proc.el (eshell-kill-process-function): New function. (eshell-gather-process-output, eshell-sentinel) (eshell-interrupt-process, eshell-kill-process, eshell-quit-process): Use eshell-kill-process-function. * eshell/em-alias.el (eshell-alias-load-hook): * eshell/em-banner.el (eshell-banner-load-hook): * eshell/em-cmpl.el (eshell-cmpl-load-hook): * eshell/em-dirs.el (eshell-dirs-load-hook): * eshell/em-glob.el (eshell-glob-load-hook): * eshell/em-hist.el (eshell-hist-load-hook): * eshell/em-pred.el (eshell-pred-load-hook): * eshell/em-prompt.el (eshell-prompt-load-hook): * eshell/em-rebind.el (eshell-rebind-load-hook): * eshell/em-script.el (eshell-script-load-hook): * eshell/em-smart.el (eshell-smart-load-hook): * eshell/em-term.el (eshell-term-load-hook): * eshell/em-unix.el (eshell-unix-load-hook): * eshell/esh-arg.el (eshell-arg-load-hook): * eshell/esh-cmd.el (eshell-cmd-load-hook): * eshell/esh-ext.el (eshell-ext-load-hook): * eshell/esh-io.el (eshell-io-load-hook): * eshell/esh-mode.el (eshell-exit-hook): * eshell/esh-proc.el (eshell-proc-load-hook, eshell-kill-hook): * eshell/esh-var.el (eshell-var-load-hook): Set default hook values to nil. (Bug#5375)
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/eshell/em-alias.el3
-rw-r--r--lisp/eshell/em-banner.el3
-rw-r--r--lisp/eshell/em-cmpl.el3
-rw-r--r--lisp/eshell/em-dirs.el3
-rw-r--r--lisp/eshell/em-glob.el3
-rw-r--r--lisp/eshell/em-hist.el3
-rw-r--r--lisp/eshell/em-pred.el3
-rw-r--r--lisp/eshell/em-prompt.el3
-rw-r--r--lisp/eshell/em-rebind.el3
-rw-r--r--lisp/eshell/em-script.el3
-rw-r--r--lisp/eshell/em-smart.el3
-rw-r--r--lisp/eshell/em-term.el3
-rw-r--r--lisp/eshell/em-unix.el3
-rw-r--r--lisp/eshell/esh-arg.el3
-rw-r--r--lisp/eshell/esh-cmd.el3
-rw-r--r--lisp/eshell/esh-ext.el3
-rw-r--r--lisp/eshell/esh-io.el3
-rw-r--r--lisp/eshell/esh-mode.el39
-rw-r--r--lisp/eshell/esh-proc.el30
-rw-r--r--lisp/eshell/esh-var.el3
21 files changed, 107 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b0f1a280ae1..aeb7c8edff4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,34 @@
12011-03-05 Glenn Morris <rgm@gnu.org> 12011-03-05 Glenn Morris <rgm@gnu.org>
2 2
3 * eshell/esh-mode.el (eshell-kill-buffer-function): New function.
4 (eshell-mode): Use eshell-kill-buffer-function.
5 Run the -initialize functions independently of the -load-hooks.
6 * eshell/esh-proc.el (eshell-kill-process-function): New function.
7 (eshell-gather-process-output, eshell-sentinel)
8 (eshell-interrupt-process, eshell-kill-process, eshell-quit-process):
9 Use eshell-kill-process-function.
10 * eshell/em-alias.el (eshell-alias-load-hook):
11 * eshell/em-banner.el (eshell-banner-load-hook):
12 * eshell/em-cmpl.el (eshell-cmpl-load-hook):
13 * eshell/em-dirs.el (eshell-dirs-load-hook):
14 * eshell/em-glob.el (eshell-glob-load-hook):
15 * eshell/em-hist.el (eshell-hist-load-hook):
16 * eshell/em-pred.el (eshell-pred-load-hook):
17 * eshell/em-prompt.el (eshell-prompt-load-hook):
18 * eshell/em-rebind.el (eshell-rebind-load-hook):
19 * eshell/em-script.el (eshell-script-load-hook):
20 * eshell/em-smart.el (eshell-smart-load-hook):
21 * eshell/em-term.el (eshell-term-load-hook):
22 * eshell/em-unix.el (eshell-unix-load-hook):
23 * eshell/esh-arg.el (eshell-arg-load-hook):
24 * eshell/esh-cmd.el (eshell-cmd-load-hook):
25 * eshell/esh-ext.el (eshell-ext-load-hook):
26 * eshell/esh-io.el (eshell-io-load-hook):
27 * eshell/esh-mode.el (eshell-exit-hook):
28 * eshell/esh-proc.el (eshell-proc-load-hook, eshell-kill-hook):
29 * eshell/esh-var.el (eshell-var-load-hook):
30 Set default hook values to nil. (Bug#5375)
31
3 * eshell/esh-module.el (eshell-module-unload-hook) 32 * eshell/esh-module.el (eshell-module-unload-hook)
4 (eshell-modules-list): Remove leading * from defcustom docs. 33 (eshell-modules-list): Remove leading * from defcustom docs.
5 34
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index 9efa95fc9ab..4e1dbd41045 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -117,8 +117,9 @@ gained by using this module."
117 ;; :link '(custom-manual "(eshell)Auto-correction of bad commands") 117 ;; :link '(custom-manual "(eshell)Auto-correction of bad commands")
118 :group 'eshell-alias) 118 :group 'eshell-alias)
119 119
120(defcustom eshell-alias-load-hook '(eshell-alias-initialize) 120(defcustom eshell-alias-load-hook nil
121 "A hook that gets run when `eshell-alias' is loaded." 121 "A hook that gets run when `eshell-alias' is loaded."
122 :version "24.1" ; removed eshell-alias-initialize
122 :type 'hook 123 :type 'hook
123 :group 'eshell-alias) 124 :group 'eshell-alias)
124 125
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el
index b2ebde98cee..c3e5a8b3d55 100644
--- a/lisp/eshell/em-banner.el
+++ b/lisp/eshell/em-banner.el
@@ -64,8 +64,9 @@ This can be any sexp, and should end with at least two newlines."
64 64
65(put 'eshell-banner-message 'risky-local-variable t) 65(put 'eshell-banner-message 'risky-local-variable t)
66 66
67(defcustom eshell-banner-load-hook '(eshell-banner-initialize) 67(defcustom eshell-banner-load-hook nil
68 "A list of functions to run when `eshell-banner' is loaded." 68 "A list of functions to run when `eshell-banner' is loaded."
69 :version "24.1" ; removed eshell-banner-initialize
69 :type 'hook 70 :type 'hook
70 :group 'eshell-banner) 71 :group 'eshell-banner)
71 72
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index f3f104c1ede..c551684210c 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -84,8 +84,9 @@ variable names, arguments, etc."
84 84
85;;; User Variables: 85;;; User Variables:
86 86
87(defcustom eshell-cmpl-load-hook '(eshell-cmpl-initialize) 87(defcustom eshell-cmpl-load-hook nil
88 "A list of functions to run when `eshell-cmpl' is loaded." 88 "A list of functions to run when `eshell-cmpl' is loaded."
89 :version "24.1" ; removed eshell-cmpl-initialize
89 :type 'hook 90 :type 'hook
90 :group 'eshell-cmpl) 91 :group 'eshell-cmpl)
91 92
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 9165f69d0b1..1aa2c34c395 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -58,8 +58,9 @@ they lack somewhat in feel from the typical shell equivalents."
58 58
59;;; User Variables: 59;;; User Variables:
60 60
61(defcustom eshell-dirs-load-hook '(eshell-dirs-initialize) 61(defcustom eshell-dirs-load-hook nil
62 "A hook that gets run when `eshell-dirs' is loaded." 62 "A hook that gets run when `eshell-dirs' is loaded."
63 :version "24.1" ; removed eshell-dirs-initialize
63 :type 'hook 64 :type 'hook
64 :group 'eshell-dirs) 65 :group 'eshell-dirs)
65 66
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index 2a565c5c827..732c6c05bfe 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -61,8 +61,9 @@ by zsh for filename generation."
61 61
62;;; User Variables: 62;;; User Variables:
63 63
64(defcustom eshell-glob-load-hook '(eshell-glob-initialize) 64(defcustom eshell-glob-load-hook nil
65 "A list of functions to run when `eshell-glob' is loaded." 65 "A list of functions to run when `eshell-glob' is loaded."
66 :version "24.1" ; removed eshell-glob-initialize
66 :type 'hook 67 :type 'hook
67 :group 'eshell-glob) 68 :group 'eshell-glob)
68 69
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index f9ddf3b679f..993e9d63a94 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -70,8 +70,9 @@
70 70
71;;; User Variables: 71;;; User Variables:
72 72
73(defcustom eshell-hist-load-hook '(eshell-hist-initialize) 73(defcustom eshell-hist-load-hook nil
74 "A list of functions to call when loading `eshell-hist'." 74 "A list of functions to call when loading `eshell-hist'."
75 :version "24.1" ; removed eshell-hist-initialize
75 :type 'hook 76 :type 'hook
76 :group 'eshell-hist) 77 :group 'eshell-hist)
77 78
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 33085c067fd..f3027ea9b5e 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -59,8 +59,9 @@ ordinary strings."
59 59
60;;; User Variables: 60;;; User Variables:
61 61
62(defcustom eshell-pred-load-hook '(eshell-pred-initialize) 62(defcustom eshell-pred-load-hook nil
63 "A list of functions to run when `eshell-pred' is loaded." 63 "A list of functions to run when `eshell-pred' is loaded."
64 :version "24.1" ; removed eshell-pred-initialize
64 :type 'hook 65 :type 'hook
65 :group 'eshell-pred) 66 :group 'eshell-pred)
66 67
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 448d2cdf303..3e87acc6d1e 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -37,8 +37,9 @@ as is common with most shells."
37 37
38;;; User Variables: 38;;; User Variables:
39 39
40(defcustom eshell-prompt-load-hook '(eshell-prompt-initialize) 40(defcustom eshell-prompt-load-hook nil
41 "A list of functions to call when loading `eshell-prompt'." 41 "A list of functions to call when loading `eshell-prompt'."
42 :version "24.1" ; removed eshell-prompt-initialize
42 :type 'hook 43 :type 'hook
43 :group 'eshell-prompt) 44 :group 'eshell-prompt)
44 45
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index 6def23e1b71..2c346dfcd3d 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -41,8 +41,9 @@ the behavior of normal shells while the user editing new input text."
41 41
42;;; User Variables: 42;;; User Variables:
43 43
44(defcustom eshell-rebind-load-hook '(eshell-rebind-initialize) 44(defcustom eshell-rebind-load-hook nil
45 "A list of functions to call when loading `eshell-rebind'." 45 "A list of functions to call when loading `eshell-rebind'."
46 :version "24.1" ; removed eshell-rebind-initialize
46 :type 'hook 47 :type 'hook
47 :group 'eshell-rebind) 48 :group 'eshell-rebind)
48 49
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index ed4ad1c0712..d76e19cdd07 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -34,8 +34,9 @@ commands, as a script file."
34 34
35;;; User Variables: 35;;; User Variables:
36 36
37(defcustom eshell-script-load-hook '(eshell-script-initialize) 37(defcustom eshell-script-load-hook nil
38 "A list of functions to call when loading `eshell-script'." 38 "A list of functions to call when loading `eshell-script'."
39 :version "24.1" ; removed eshell-script-initialize
39 :type 'hook 40 :type 'hook
40 :group 'eshell-script) 41 :group 'eshell-script)
41 42
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el
index 2c54930e439..f08fec8f8fa 100644
--- a/lisp/eshell/em-smart.el
+++ b/lisp/eshell/em-smart.el
@@ -84,8 +84,9 @@ it to get a real sense of how it works."
84 84
85;;; User Variables: 85;;; User Variables:
86 86
87(defcustom eshell-smart-load-hook '(eshell-smart-initialize) 87(defcustom eshell-smart-load-hook nil
88 "A list of functions to call when loading `eshell-smart'." 88 "A list of functions to call when loading `eshell-smart'."
89 :version "24.1" ; removed eshell-smart-initialize
89 :type 'hook 90 :type 'hook
90 :group 'eshell-smart) 91 :group 'eshell-smart)
91 92
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index be394ba5b22..7d5fbbeabeb 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -46,8 +46,9 @@ which commands are considered visual in nature."
46 46
47;;; User Variables: 47;;; User Variables:
48 48
49(defcustom eshell-term-load-hook '(eshell-term-initialize) 49(defcustom eshell-term-load-hook nil
50 "A list of functions to call when loading `eshell-term'." 50 "A list of functions to call when loading `eshell-term'."
51 :version "24.1" ; removed eshell-term-initialize
51 :type 'hook 52 :type 'hook
52 :group 'eshell-term) 53 :group 'eshell-term)
53 54
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 3bb623c4c4e..707f2ebc2ce 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -53,8 +53,9 @@ by name)."
53 :tag "UNIX commands in Lisp" 53 :tag "UNIX commands in Lisp"
54 :group 'eshell-module) 54 :group 'eshell-module)
55 55
56(defcustom eshell-unix-load-hook '(eshell-unix-initialize) 56(defcustom eshell-unix-load-hook nil
57 "A list of functions to run when `eshell-unix' is loaded." 57 "A list of functions to run when `eshell-unix' is loaded."
58 :version "24.1" ; removed eshell-unix-initialize
58 :type 'hook 59 :type 'hook
59 :group 'eshell-unix) 60 :group 'eshell-unix)
60 61
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index f42440ae4ec..1fb8b7f4c32 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -117,8 +117,9 @@ treated as a literal character."
117 117
118;;; User Variables: 118;;; User Variables:
119 119
120(defcustom eshell-arg-load-hook '(eshell-arg-initialize) 120(defcustom eshell-arg-load-hook nil
121 "A hook that gets run when `eshell-arg' is loaded." 121 "A hook that gets run when `eshell-arg' is loaded."
122 :version "24.1" ; removed eshell-arg-initialize
122 :type 'hook 123 :type 'hook
123 :group 'eshell-arg) 124 :group 'eshell-arg)
124 125
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 0a00300d19c..62c14f38025 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -229,8 +229,9 @@ return non-nil if the command is complex."
229 229
230;;; User Variables: 230;;; User Variables:
231 231
232(defcustom eshell-cmd-load-hook '(eshell-cmd-initialize) 232(defcustom eshell-cmd-load-hook nil
233 "A hook that gets run when `eshell-cmd' is loaded." 233 "A hook that gets run when `eshell-cmd' is loaded."
234 :version "24.1" ; removed eshell-cmd-initialize
234 :type 'hook 235 :type 'hook
235 :group 'eshell-cmd) 236 :group 'eshell-cmd)
236 237
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index ebd20b90dd6..3acbeac0b89 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -46,8 +46,9 @@ loaded into memory, thus beginning a new process."
46 46
47;;; User Variables: 47;;; User Variables:
48 48
49(defcustom eshell-ext-load-hook '(eshell-ext-initialize) 49(defcustom eshell-ext-load-hook nil
50 "A hook that gets run when `eshell-ext' is loaded." 50 "A hook that gets run when `eshell-ext' is loaded."
51 :version "24.1" ; removed eshell-ext-initialize
51 :type 'hook 52 :type 'hook
52 :group 'eshell-ext) 53 :group 'eshell-ext)
53 54
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index ef8966f1d7d..71fae34b360 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -71,8 +71,9 @@ though they were files."
71 71
72;;; User Variables: 72;;; User Variables:
73 73
74(defcustom eshell-io-load-hook '(eshell-io-initialize) 74(defcustom eshell-io-load-hook nil
75 "A hook that gets run when `eshell-io' is loaded." 75 "A hook that gets run when `eshell-io' is loaded."
76 :version "24.1" ; removed eshell-io-initialize
76 :type 'hook 77 :type 'hook
77 :group 'eshell-io) 78 :group 'eshell-io)
78 79
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 3b566ead0e5..f7c727aa36f 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -89,9 +89,10 @@ That is to say, the first time during an Emacs session."
89 :type 'hook 89 :type 'hook
90 :group 'eshell-mode) 90 :group 'eshell-mode)
91 91
92(defcustom eshell-exit-hook '(eshell-query-kill-processes) 92(defcustom eshell-exit-hook nil
93 "A hook that is run whenever `eshell' is exited. 93 "A hook that is run whenever `eshell' is exited.
94This hook is only run if exiting actually kills the buffer." 94This hook is only run if exiting actually kills the buffer."
95 :version "24.1" ; removed eshell-query-kill-processes
95 :type 'hook 96 :type 'hook
96 :group 'eshell-mode) 97 :group 'eshell-mode)
97 98
@@ -287,6 +288,17 @@ This is used by `eshell-watch-for-password-prompt'."
287 288
288;;; User Functions: 289;;; User Functions:
289 290
291(defun eshell-kill-buffer-function ()
292 "Function added to `kill-buffer-hook' in Eshell buffers.
293This runs the function `eshell-kill-processes-on-exit',
294and the hook `eshell-exit-hook'."
295 ;; It's fine to run this unconditionally since it can be customized
296 ;; via the `eshell-kill-processes-on-exit' variable.
297 (and (fboundp 'eshell-query-kill-processes)
298 (not (memq 'eshell-query-kill-processes eshell-exit-hook))
299 (eshell-query-kill-processes))
300 (run-hooks 'eshell-exit-hook))
301
290;;;###autoload 302;;;###autoload
291(defun eshell-mode () 303(defun eshell-mode ()
292 "Emacs shell interactive mode. 304 "Emacs shell interactive mode.
@@ -403,17 +415,15 @@ This is used by `eshell-watch-for-password-prompt'."
403 (unless (file-exists-p eshell-directory-name) 415 (unless (file-exists-p eshell-directory-name)
404 (eshell-make-private-directory eshell-directory-name t)) 416 (eshell-make-private-directory eshell-directory-name t))
405 417
406 ;; load core Eshell modules for this session 418 ;; Load core Eshell modules, then extension modules, for this session.
407 (dolist (module (eshell-subgroups 'eshell)) 419 (dolist (module (append (eshell-subgroups 'eshell) eshell-modules-list))
408 (run-hooks (intern-soft (concat (symbol-name module) 420 (let ((load-hook (intern-soft (format "%s-load-hook" module)))
409 "-load-hook")))) 421 (initfunc (intern-soft (format "%s-initialize" module))))
410 422 (when (and load-hook (boundp load-hook))
411 ;; load extension modules for this session 423 (if (memq initfunc (symbol-value load-hook)) (setq initfunc nil))
412 (dolist (module eshell-modules-list) 424 (run-hooks load-hook))
413 (let ((load-hook (intern-soft (concat (symbol-name module) 425 ;; So we don't need the -initialize functions on the hooks (b#5375).
414 "-load-hook")))) 426 (and initfunc (fboundp initfunc) (funcall initfunc))))
415 (if (and load-hook (boundp load-hook))
416 (run-hooks load-hook))))
417 427
418 (if eshell-send-direct-to-subprocesses 428 (if eshell-send-direct-to-subprocesses
419 (add-hook 'pre-command-hook 'eshell-intercept-commands t t)) 429 (add-hook 'pre-command-hook 'eshell-intercept-commands t t))
@@ -428,10 +438,7 @@ This is used by `eshell-watch-for-password-prompt'."
428 (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t) 438 (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t)
429 (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t)) 439 (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t))
430 440
431 (add-hook 'kill-buffer-hook 441 (add-hook 'kill-buffer-hook 'eshell-kill-buffer-function t t)
432 (function
433 (lambda ()
434 (run-hooks 'eshell-exit-hook))) t t)
435 442
436 (if eshell-first-time-p 443 (if eshell-first-time-p
437 (run-hooks 'eshell-first-time-mode-hook)) 444 (run-hooks 'eshell-first-time-mode-hook))
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 8757f5d56a0..f3fcc52aac8 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -38,8 +38,9 @@ finish."
38 38
39;;; User Variables: 39;;; User Variables:
40 40
41(defcustom eshell-proc-load-hook '(eshell-proc-initialize) 41(defcustom eshell-proc-load-hook nil
42 "A hook that gets run when `eshell-proc' is loaded." 42 "A hook that gets run when `eshell-proc' is loaded."
43 :version "24.1" ; removed eshell-proc-initialize
43 :type 'hook 44 :type 'hook
44 :group 'eshell-proc) 45 :group 'eshell-proc)
45 46
@@ -94,13 +95,14 @@ is created."
94 :type 'hook 95 :type 'hook
95 :group 'eshell-proc) 96 :group 'eshell-proc)
96 97
97(defcustom eshell-kill-hook '(eshell-reset-after-proc) 98(defcustom eshell-kill-hook nil
98 "Called when a process run by `eshell-gather-process-output' has ended. 99 "Called when a process run by `eshell-gather-process-output' has ended.
99It is passed two arguments: the process that was just ended, and the 100It is passed two arguments: the process that was just ended, and the
100termination status (as a string). Note that the first argument may be 101termination status (as a string). Note that the first argument may be
101nil, in which case the user attempted to send a signal, but there was 102nil, in which case the user attempted to send a signal, but there was
102no relevant process. This can be used for displaying help 103no relevant process. This can be used for displaying help
103information, for example." 104information, for example."
105 :version "24.1" ; removed eshell-reset-after-proc
104 :type 'hook 106 :type 'hook
105 :group 'eshell-proc) 107 :group 'eshell-proc)
106 108
@@ -113,6 +115,14 @@ information, for example."
113 115
114;;; Functions: 116;;; Functions:
115 117
118(defun eshell-kill-process-function (proc status)
119 "Function run when killing a process.
120Runs `eshell-reset-after-proc' and `eshell-kill-hook', passing arguments
121PROC and STATUS to both."
122 (or (memq 'eshell-reset-after-proc eshell-kill-hook)
123 (eshell-reset-after-proc proc status))
124 (run-hook-with-args eshell-kill-hook proc status))
125
116(defun eshell-proc-initialize () 126(defun eshell-proc-initialize ()
117 "Initialize the process handling code." 127 "Initialize the process handling code."
118 (make-local-variable 'eshell-process-list) 128 (make-local-variable 'eshell-process-list)
@@ -346,7 +356,7 @@ See `eshell-needs-pipe'."
346 (eshell-update-markers eshell-last-output-end) 356 (eshell-update-markers eshell-last-output-end)
347 ;; Simulate the effect of eshell-sentinel. 357 ;; Simulate the effect of eshell-sentinel.
348 (eshell-close-handles (if (numberp exit-status) exit-status -1)) 358 (eshell-close-handles (if (numberp exit-status) exit-status -1))
349 (run-hook-with-args 'eshell-kill-hook command exit-status) 359 (eshell-kill-process-function command exit-status)
350 (or eshell-in-pipeline-p 360 (or eshell-in-pipeline-p
351 (setq eshell-last-sync-output-start nil)) 361 (setq eshell-last-sync-output-start nil))
352 (if (not (numberp exit-status)) 362 (if (not (numberp exit-status))
@@ -391,7 +401,7 @@ PROC is the process that's exiting. STRING is the exit message."
391 (eshell-close-handles (process-exit-status proc) 'nil 401 (eshell-close-handles (process-exit-status proc) 'nil
392 (cadr entry)))) 402 (cadr entry))))
393 (eshell-remove-process-entry entry)))) 403 (eshell-remove-process-entry entry))))
394 (run-hook-with-args 'eshell-kill-hook proc string))))) 404 (eshell-kill-process-function proc string)))))
395 405
396(defun eshell-process-interact (func &optional all query) 406(defun eshell-process-interact (func &optional all query)
397 "Interact with a process, using PROMPT if more than one, via FUNC. 407 "Interact with a process, using PROMPT if more than one, via FUNC.
@@ -485,31 +495,29 @@ See the variable `eshell-kill-processes-on-exit'."
485 (kill-buffer buf))) 495 (kill-buffer buf)))
486 (message nil)))) 496 (message nil))))
487 497
488(custom-add-option 'eshell-exit-hook 'eshell-query-kill-processes)
489
490(defun eshell-interrupt-process () 498(defun eshell-interrupt-process ()
491 "Interrupt a process." 499 "Interrupt a process."
492 (interactive) 500 (interactive)
493 (unless (eshell-process-interact 'interrupt-process) 501 (unless (eshell-process-interact 'interrupt-process)
494 (run-hook-with-args 'eshell-kill-hook nil "interrupt"))) 502 (eshell-kill-process-function nil "interrupt")))
495 503
496(defun eshell-kill-process () 504(defun eshell-kill-process ()
497 "Kill a process." 505 "Kill a process."
498 (interactive) 506 (interactive)
499 (unless (eshell-process-interact 'kill-process) 507 (unless (eshell-process-interact 'kill-process)
500 (run-hook-with-args 'eshell-kill-hook nil "killed"))) 508 (eshell-kill-process-function nil "killed")))
501 509
502(defun eshell-quit-process () 510(defun eshell-quit-process ()
503 "Send quit signal to process." 511 "Send quit signal to process."
504 (interactive) 512 (interactive)
505 (unless (eshell-process-interact 'quit-process) 513 (unless (eshell-process-interact 'quit-process)
506 (run-hook-with-args 'eshell-kill-hook nil "quit"))) 514 (eshell-kill-process-function nil "quit")))
507 515
508;(defun eshell-stop-process () 516;(defun eshell-stop-process ()
509; "Send STOP signal to process." 517; "Send STOP signal to process."
510; (interactive) 518; (interactive)
511; (unless (eshell-process-interact 'stop-process) 519; (unless (eshell-process-interact 'stop-process)
512; (run-hook-with-args 'eshell-kill-hook nil "stopped"))) 520; (eshell-kill-process-function nil "stopped")))
513 521
514;(defun eshell-continue-process () 522;(defun eshell-continue-process ()
515; "Send CONTINUE signal to process." 523; "Send CONTINUE signal to process."
@@ -518,7 +526,7 @@ See the variable `eshell-kill-processes-on-exit'."
518; ;; jww (1999-09-17): this signal is not dealt with yet. For 526; ;; jww (1999-09-17): this signal is not dealt with yet. For
519; ;; example, `eshell-reset' will be called, and so will 527; ;; example, `eshell-reset' will be called, and so will
520; ;; `eshell-resume-eval'. 528; ;; `eshell-resume-eval'.
521; (run-hook-with-args 'eshell-kill-hook nil "continue"))) 529; (eshell-kill-process-function nil "continue")))
522 530
523(defun eshell-send-eof-to-process () 531(defun eshell-send-eof-to-process ()
524 "Send EOF to process." 532 "Send EOF to process."
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 8fb08963192..ae87215a767 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -126,8 +126,9 @@ variable value, a subcommand, or even the result of a Lisp form."
126 126
127;;; User Variables: 127;;; User Variables:
128 128
129(defcustom eshell-var-load-hook '(eshell-var-initialize) 129(defcustom eshell-var-load-hook nil
130 "A list of functions to call when loading `eshell-var'." 130 "A list of functions to call when loading `eshell-var'."
131 :version "24.1" ; removed eshell-var-initialize
131 :type 'hook 132 :type 'hook
132 :group 'eshell-var) 133 :group 'eshell-var)
133 134