emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103521: Default all eshell hooks to


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103521: Default all eshell hooks to nil (bug#5375)
Date: Fri, 04 Mar 2011 20:11:05 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103521
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2011-03-04 20:11:05 -0800
message:
  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)
modified:
  lisp/ChangeLog
  lisp/eshell/em-alias.el
  lisp/eshell/em-banner.el
  lisp/eshell/em-cmpl.el
  lisp/eshell/em-dirs.el
  lisp/eshell/em-glob.el
  lisp/eshell/em-hist.el
  lisp/eshell/em-pred.el
  lisp/eshell/em-prompt.el
  lisp/eshell/em-rebind.el
  lisp/eshell/em-script.el
  lisp/eshell/em-smart.el
  lisp/eshell/em-term.el
  lisp/eshell/em-unix.el
  lisp/eshell/esh-arg.el
  lisp/eshell/esh-cmd.el
  lisp/eshell/esh-ext.el
  lisp/eshell/esh-io.el
  lisp/eshell/esh-mode.el
  lisp/eshell/esh-proc.el
  lisp/eshell/esh-var.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-05 03:59:53 +0000
+++ b/lisp/ChangeLog    2011-03-05 04:11:05 +0000
@@ -1,5 +1,34 @@
 2011-03-05  Glenn Morris  <address@hidden>
 
+       * 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)
+
        * eshell/esh-module.el (eshell-module-unload-hook)
        (eshell-modules-list): Remove leading * from defcustom docs.
 

=== modified file 'lisp/eshell/em-alias.el'
--- a/lisp/eshell/em-alias.el   2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/em-alias.el   2011-03-05 04:11:05 +0000
@@ -117,8 +117,9 @@
   ;; :link '(custom-manual "(eshell)Auto-correction of bad commands")
   :group 'eshell-alias)
 
-(defcustom eshell-alias-load-hook '(eshell-alias-initialize)
+(defcustom eshell-alias-load-hook nil
   "A hook that gets run when `eshell-alias' is loaded."
+  :version "24.1"                      ; removed eshell-alias-initialize
   :type 'hook
   :group 'eshell-alias)
 

=== modified file 'lisp/eshell/em-banner.el'
--- a/lisp/eshell/em-banner.el  2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-banner.el  2011-03-05 04:11:05 +0000
@@ -64,8 +64,9 @@
 
 (put 'eshell-banner-message 'risky-local-variable t)
 
-(defcustom eshell-banner-load-hook '(eshell-banner-initialize)
+(defcustom eshell-banner-load-hook nil
   "A list of functions to run when `eshell-banner' is loaded."
+  :version "24.1"                       ; removed eshell-banner-initialize
   :type 'hook
   :group 'eshell-banner)
 

=== modified file 'lisp/eshell/em-cmpl.el'
--- a/lisp/eshell/em-cmpl.el    2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-cmpl.el    2011-03-05 04:11:05 +0000
@@ -84,8 +84,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-cmpl-load-hook '(eshell-cmpl-initialize)
+(defcustom eshell-cmpl-load-hook nil
   "A list of functions to run when `eshell-cmpl' is loaded."
+  :version "24.1"                      ; removed eshell-cmpl-initialize
   :type 'hook
   :group 'eshell-cmpl)
 

=== modified file 'lisp/eshell/em-dirs.el'
--- a/lisp/eshell/em-dirs.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/em-dirs.el    2011-03-05 04:11:05 +0000
@@ -58,8 +58,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-dirs-load-hook '(eshell-dirs-initialize)
+(defcustom eshell-dirs-load-hook nil
   "A hook that gets run when `eshell-dirs' is loaded."
+  :version "24.1"                      ; removed eshell-dirs-initialize
   :type 'hook
   :group 'eshell-dirs)
 

=== modified file 'lisp/eshell/em-glob.el'
--- a/lisp/eshell/em-glob.el    2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-glob.el    2011-03-05 04:11:05 +0000
@@ -61,8 +61,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-glob-load-hook '(eshell-glob-initialize)
+(defcustom eshell-glob-load-hook nil
   "A list of functions to run when `eshell-glob' is loaded."
+  :version "24.1"                      ; removed eshell-glob-initialize
   :type 'hook
   :group 'eshell-glob)
 

=== modified file 'lisp/eshell/em-hist.el'
--- a/lisp/eshell/em-hist.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/em-hist.el    2011-03-05 04:11:05 +0000
@@ -70,8 +70,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-hist-load-hook '(eshell-hist-initialize)
+(defcustom eshell-hist-load-hook nil
   "A list of functions to call when loading `eshell-hist'."
+  :version "24.1"                      ; removed eshell-hist-initialize
   :type 'hook
   :group 'eshell-hist)
 

=== modified file 'lisp/eshell/em-pred.el'
--- a/lisp/eshell/em-pred.el    2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-pred.el    2011-03-05 04:11:05 +0000
@@ -59,8 +59,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-pred-load-hook '(eshell-pred-initialize)
+(defcustom eshell-pred-load-hook nil
   "A list of functions to run when `eshell-pred' is loaded."
+  :version "24.1"                      ; removed eshell-pred-initialize
   :type 'hook
   :group 'eshell-pred)
 

=== modified file 'lisp/eshell/em-prompt.el'
--- a/lisp/eshell/em-prompt.el  2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-prompt.el  2011-03-05 04:11:05 +0000
@@ -37,8 +37,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-prompt-load-hook '(eshell-prompt-initialize)
+(defcustom eshell-prompt-load-hook nil
   "A list of functions to call when loading `eshell-prompt'."
+  :version "24.1"                      ; removed eshell-prompt-initialize
   :type 'hook
   :group 'eshell-prompt)
 

=== modified file 'lisp/eshell/em-rebind.el'
--- a/lisp/eshell/em-rebind.el  2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-rebind.el  2011-03-05 04:11:05 +0000
@@ -41,8 +41,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-rebind-load-hook '(eshell-rebind-initialize)
+(defcustom eshell-rebind-load-hook nil
   "A list of functions to call when loading `eshell-rebind'."
+  :version "24.1"                      ; removed eshell-rebind-initialize
   :type 'hook
   :group 'eshell-rebind)
 

=== modified file 'lisp/eshell/em-script.el'
--- a/lisp/eshell/em-script.el  2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-script.el  2011-03-05 04:11:05 +0000
@@ -34,8 +34,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-script-load-hook '(eshell-script-initialize)
+(defcustom eshell-script-load-hook nil
   "A list of functions to call when loading `eshell-script'."
+  :version "24.1"                       ; removed eshell-script-initialize
   :type 'hook
   :group 'eshell-script)
 

=== modified file 'lisp/eshell/em-smart.el'
--- a/lisp/eshell/em-smart.el   2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-smart.el   2011-03-05 04:11:05 +0000
@@ -84,8 +84,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-smart-load-hook '(eshell-smart-initialize)
+(defcustom eshell-smart-load-hook nil
   "A list of functions to call when loading `eshell-smart'."
+  :version "24.1"                      ; removed eshell-smart-initialize
   :type 'hook
   :group 'eshell-smart)
 

=== modified file 'lisp/eshell/em-term.el'
--- a/lisp/eshell/em-term.el    2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/em-term.el    2011-03-05 04:11:05 +0000
@@ -46,8 +46,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-term-load-hook '(eshell-term-initialize)
+(defcustom eshell-term-load-hook nil
   "A list of functions to call when loading `eshell-term'."
+  :version "24.1"                      ; removed eshell-term-initialize
   :type 'hook
   :group 'eshell-term)
 

=== modified file 'lisp/eshell/em-unix.el'
--- a/lisp/eshell/em-unix.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/em-unix.el    2011-03-05 04:11:05 +0000
@@ -53,8 +53,9 @@
   :tag "UNIX commands in Lisp"
   :group 'eshell-module)
 
-(defcustom eshell-unix-load-hook '(eshell-unix-initialize)
+(defcustom eshell-unix-load-hook nil
   "A list of functions to run when `eshell-unix' is loaded."
+  :version "24.1"                      ; removed eshell-unix-initialize
   :type 'hook
   :group 'eshell-unix)
 

=== modified file 'lisp/eshell/esh-arg.el'
--- a/lisp/eshell/esh-arg.el    2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/esh-arg.el    2011-03-05 04:11:05 +0000
@@ -117,8 +117,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-arg-load-hook '(eshell-arg-initialize)
+(defcustom eshell-arg-load-hook nil
   "A hook that gets run when `eshell-arg' is loaded."
+  :version "24.1"                     ; removed eshell-arg-initialize
   :type 'hook
   :group 'eshell-arg)
 

=== modified file 'lisp/eshell/esh-cmd.el'
--- a/lisp/eshell/esh-cmd.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/esh-cmd.el    2011-03-05 04:11:05 +0000
@@ -229,8 +229,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-cmd-load-hook '(eshell-cmd-initialize)
+(defcustom eshell-cmd-load-hook nil
   "A hook that gets run when `eshell-cmd' is loaded."
+  :version "24.1"                     ; removed eshell-cmd-initialize
   :type 'hook
   :group 'eshell-cmd)
 

=== modified file 'lisp/eshell/esh-ext.el'
--- a/lisp/eshell/esh-ext.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/esh-ext.el    2011-03-05 04:11:05 +0000
@@ -46,8 +46,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-ext-load-hook '(eshell-ext-initialize)
+(defcustom eshell-ext-load-hook nil
   "A hook that gets run when `eshell-ext' is loaded."
+  :version "24.1"                      ; removed eshell-ext-initialize
   :type 'hook
   :group 'eshell-ext)
 

=== modified file 'lisp/eshell/esh-io.el'
--- a/lisp/eshell/esh-io.el     2011-01-25 04:08:28 +0000
+++ b/lisp/eshell/esh-io.el     2011-03-05 04:11:05 +0000
@@ -71,8 +71,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-io-load-hook '(eshell-io-initialize)
+(defcustom eshell-io-load-hook nil
   "A hook that gets run when `eshell-io' is loaded."
+  :version "24.1"                      ; removed eshell-io-initialize
   :type 'hook
   :group 'eshell-io)
 

=== modified file 'lisp/eshell/esh-mode.el'
--- a/lisp/eshell/esh-mode.el   2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/esh-mode.el   2011-03-05 04:11:05 +0000
@@ -89,9 +89,10 @@
   :type 'hook
   :group 'eshell-mode)
 
-(defcustom eshell-exit-hook '(eshell-query-kill-processes)
+(defcustom eshell-exit-hook nil
   "A hook that is run whenever `eshell' is exited.
 This hook is only run if exiting actually kills the buffer."
+  :version "24.1"                       ; removed eshell-query-kill-processes
   :type 'hook
   :group 'eshell-mode)
 
@@ -287,6 +288,17 @@
 
 ;;; User Functions:
 
+(defun eshell-kill-buffer-function ()
+  "Function added to `kill-buffer-hook' in Eshell buffers.
+This runs the function `eshell-kill-processes-on-exit',
+and the hook `eshell-exit-hook'."
+  ;; It's fine to run this unconditionally since it can be customized
+  ;; via the `eshell-kill-processes-on-exit' variable.
+  (and (fboundp 'eshell-query-kill-processes)
+       (not (memq 'eshell-query-kill-processes eshell-exit-hook))
+       (eshell-query-kill-processes))
+  (run-hooks 'eshell-exit-hook))
+
 ;;;###autoload
 (defun eshell-mode ()
   "Emacs shell interactive mode.
@@ -403,17 +415,15 @@
   (unless (file-exists-p eshell-directory-name)
     (eshell-make-private-directory eshell-directory-name t))
 
-  ;; load core Eshell modules for this session
-  (dolist (module (eshell-subgroups 'eshell))
-    (run-hooks (intern-soft (concat (symbol-name module)
-                                   "-load-hook"))))
-
-  ;; load extension modules for this session
-  (dolist (module eshell-modules-list)
-    (let ((load-hook (intern-soft (concat (symbol-name module)
-                                         "-load-hook"))))
-      (if (and load-hook (boundp load-hook))
-         (run-hooks load-hook))))
+  ;; Load core Eshell modules, then extension modules, for this session.
+  (dolist (module (append (eshell-subgroups 'eshell) eshell-modules-list))
+    (let ((load-hook (intern-soft (format "%s-load-hook" module)))
+          (initfunc (intern-soft (format "%s-initialize" module))))
+      (when (and load-hook (boundp load-hook))
+        (if (memq initfunc (symbol-value load-hook)) (setq initfunc nil))
+        (run-hooks load-hook))
+      ;; So we don't need the -initialize functions on the hooks (b#5375).
+      (and initfunc (fboundp initfunc) (funcall initfunc))))
 
   (if eshell-send-direct-to-subprocesses
       (add-hook 'pre-command-hook 'eshell-intercept-commands t t))
@@ -428,10 +438,7 @@
     (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t)
     (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t))
 
-  (add-hook 'kill-buffer-hook
-           (function
-            (lambda ()
-              (run-hooks 'eshell-exit-hook))) t t)
+  (add-hook 'kill-buffer-hook 'eshell-kill-buffer-function t t)
 
   (if eshell-first-time-p
       (run-hooks 'eshell-first-time-mode-hook))

=== modified file 'lisp/eshell/esh-proc.el'
--- a/lisp/eshell/esh-proc.el   2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/esh-proc.el   2011-03-05 04:11:05 +0000
@@ -38,8 +38,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-proc-load-hook '(eshell-proc-initialize)
+(defcustom eshell-proc-load-hook nil
   "A hook that gets run when `eshell-proc' is loaded."
+  :version "24.1"                      ; removed eshell-proc-initialize
   :type 'hook
   :group 'eshell-proc)
 
@@ -94,13 +95,14 @@
   :type 'hook
   :group 'eshell-proc)
 
-(defcustom eshell-kill-hook '(eshell-reset-after-proc)
+(defcustom eshell-kill-hook nil
   "Called when a process run by `eshell-gather-process-output' has ended.
 It is passed two arguments: the process that was just ended, and the
 termination status (as a string).  Note that the first argument may be
 nil, in which case the user attempted to send a signal, but there was
 no relevant process.  This can be used for displaying help
 information, for example."
+  :version "24.1"                      ; removed eshell-reset-after-proc
   :type 'hook
   :group 'eshell-proc)
 
@@ -113,6 +115,14 @@
 
 ;;; Functions:
 
+(defun eshell-kill-process-function (proc status)
+  "Function run when killing a process.
+Runs `eshell-reset-after-proc' and `eshell-kill-hook', passing arguments
+PROC and STATUS to both."
+  (or (memq 'eshell-reset-after-proc eshell-kill-hook)
+      (eshell-reset-after-proc proc status))
+  (run-hook-with-args eshell-kill-hook proc status))
+
 (defun eshell-proc-initialize ()
   "Initialize the process handling code."
   (make-local-variable 'eshell-process-list)
@@ -346,7 +356,7 @@
        (eshell-update-markers eshell-last-output-end)
        ;; Simulate the effect of eshell-sentinel.
        (eshell-close-handles (if (numberp exit-status) exit-status -1))
-       (run-hook-with-args 'eshell-kill-hook command exit-status)
+       (eshell-kill-process-function command exit-status)
        (or eshell-in-pipeline-p
            (setq eshell-last-sync-output-start nil))
        (if (not (numberp exit-status))
@@ -391,7 +401,7 @@
                      (eshell-close-handles (process-exit-status proc) 'nil
                                            (cadr entry))))
                (eshell-remove-process-entry entry))))
-       (run-hook-with-args 'eshell-kill-hook proc string)))))
+       (eshell-kill-process-function proc string)))))
 
 (defun eshell-process-interact (func &optional all query)
   "Interact with a process, using PROMPT if more than one, via FUNC.
@@ -485,31 +495,29 @@
            (kill-buffer buf)))
       (message nil))))
 
-(custom-add-option 'eshell-exit-hook 'eshell-query-kill-processes)
-
 (defun eshell-interrupt-process ()
   "Interrupt a process."
   (interactive)
   (unless (eshell-process-interact 'interrupt-process)
-    (run-hook-with-args 'eshell-kill-hook nil "interrupt")))
+    (eshell-kill-process-function nil "interrupt")))
 
 (defun eshell-kill-process ()
   "Kill a process."
   (interactive)
   (unless (eshell-process-interact 'kill-process)
-    (run-hook-with-args 'eshell-kill-hook nil "killed")))
+    (eshell-kill-process-function nil "killed")))
 
 (defun eshell-quit-process ()
   "Send quit signal to process."
   (interactive)
   (unless (eshell-process-interact 'quit-process)
-    (run-hook-with-args 'eshell-kill-hook nil "quit")))
+    (eshell-kill-process-function nil "quit")))
 
 ;(defun eshell-stop-process ()
 ;  "Send STOP signal to process."
 ;  (interactive)
 ;  (unless (eshell-process-interact 'stop-process)
-;    (run-hook-with-args 'eshell-kill-hook nil "stopped")))
+;    (eshell-kill-process-function nil "stopped")))
 
 ;(defun eshell-continue-process ()
 ;  "Send CONTINUE signal to process."
@@ -518,7 +526,7 @@
 ;    ;; jww (1999-09-17): this signal is not dealt with yet.  For
 ;    ;; example, `eshell-reset' will be called, and so will
 ;    ;; `eshell-resume-eval'.
-;    (run-hook-with-args 'eshell-kill-hook nil "continue")))
+;    (eshell-kill-process-function nil "continue")))
 
 (defun eshell-send-eof-to-process ()
   "Send EOF to process."

=== modified file 'lisp/eshell/esh-var.el'
--- a/lisp/eshell/esh-var.el    2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/esh-var.el    2011-03-05 04:11:05 +0000
@@ -126,8 +126,9 @@
 
 ;;; User Variables:
 
-(defcustom eshell-var-load-hook '(eshell-var-initialize)
+(defcustom eshell-var-load-hook nil
   "A list of functions to call when loading `eshell-var'."
+  :version "24.1"                      ; removed eshell-var-initialize
   :type 'hook
   :group 'eshell-var)
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]