]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (kill-buffer-hook): Doc fix.
authorLeo Liu <sdl.web@gmail.com>
Sun, 24 Mar 2013 06:42:25 +0000 (14:42 +0800)
committerLeo Liu <sdl.web@gmail.com>
Sun, 24 Mar 2013 06:42:25 +0000 (14:42 +0800)
* lisp/emacs-lisp/edebug.el (edebug-mode): Make sure edebug-kill-buffer
is the last entry in kill-buffer-hook.

* lisp/nxml/rng-valid.el (rng-validate-while-idle)
(rng-validate-quick-while-idle): Guard against deleted buffer.

Fixes: debbugs:13999
lisp/ChangeLog
lisp/emacs-lisp/edebug.el
lisp/files.el
lisp/nxml/rng-valid.el

index c1124f51a8e1c5d5333f336f41e20af4cb19bf4a..68a9575bcbe8c07d3901c22d2e368e16aa5575ff 100644 (file)
@@ -1,3 +1,14 @@
+2013-03-24  Leo Liu  <sdl.web@gmail.com>
+
+       * nxml/rng-valid.el (rng-validate-while-idle)
+       (rng-validate-quick-while-idle): Guard against deleted buffer.
+       (Bug#13999)
+
+       * emacs-lisp/edebug.el (edebug-mode): Make sure edebug-kill-buffer
+       is the last entry in kill-buffer-hook.
+
+       * files.el (kill-buffer-hook): Doc fix.
+
 2013-03-23  Dmitry Gutov  <dgutov@yandex.ru>
 
        * emacs-lisp/lisp-mode.el (emacs-lisp-docstring-fill-column): Make
index 52e12013fd38556a8f68001fd96d2e06b370f737..5a6fd4a0a22233df2a652f33411a70b6cf8cf0a5 100644 (file)
@@ -3810,7 +3810,10 @@ Options:
   ;; If the user kills the buffer in which edebug is currently active,
   ;; exit to top level, because the edebug command loop can't usefully
   ;; continue running in such a case.
-  (add-hook 'kill-buffer-hook 'edebug-kill-buffer nil t)
+  ;;
+  ;; Append `edebug-kill-buffer' to the hook to avoid interfering with
+  ;; other entries that are ungarded against deleted buffer.
+  (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t)
   (use-local-map edebug-mode-map))
 
 (defun edebug-kill-buffer ()
index 9da9ac6fd5398a57f57ae29a97b46c26a9d08c81..06958622d14da8628b0e63381dd00463834570de 100644 (file)
@@ -1516,7 +1516,10 @@ expand wildcards (if any) and replace the file with multiple files."
 (defvar kill-buffer-hook nil
   "Hook run when a buffer is killed.
 The buffer being killed is current while the hook is running.
-See `kill-buffer'.")
+See `kill-buffer'.
+
+Note: Be careful with let-binding this hook considering it is
+frequently used for cleanup.")
 
 (defun find-alternate-file (filename &optional wildcards)
   "Find file FILENAME, select its buffer, kill previous buffer.
index de18c58142152d99cb21858a6889bada1916d886..e1140980813fd60a93220e819a1ee4b777a026ca 100644 (file)
@@ -433,24 +433,26 @@ The schema is set like `rng-auto-set-schema'."
 ;; validation process down.
 
 (defun rng-validate-while-idle (buffer)
-  (with-current-buffer buffer
-    (if rng-validate-mode
-       (if (let ((rng-validate-display-point (point))
-                 (rng-validate-display-modified-p (buffer-modified-p)))
-             (rng-do-some-validation 'rng-validate-while-idle-continue-p))
-           (force-mode-line-update)
-         (rng-validate-done))
-      ;; must have done kill-all-local-variables
-      (rng-kill-timers))))
+  (when (buffer-live-p buffer)         ; bug#13999
+    (with-current-buffer buffer
+      (if rng-validate-mode
+         (if (let ((rng-validate-display-point (point))
+                   (rng-validate-display-modified-p (buffer-modified-p)))
+               (rng-do-some-validation 'rng-validate-while-idle-continue-p))
+             (force-mode-line-update)
+           (rng-validate-done))
+       ;; must have done kill-all-local-variables
+       (rng-kill-timers)))))
 
 (defun rng-validate-quick-while-idle (buffer)
-  (with-current-buffer buffer
-    (if rng-validate-mode
-       (if (rng-do-some-validation)
-           (force-mode-line-update)
-         (rng-validate-done))
-      ;; must have done kill-all-local-variables
-      (rng-kill-timers))))
+  (when (buffer-live-p buffer)         ; bug#13999
+    (with-current-buffer buffer
+      (if rng-validate-mode
+         (if (rng-do-some-validation)
+             (force-mode-line-update)
+           (rng-validate-done))
+       ;; must have done kill-all-local-variables
+       (rng-kill-timers)))))
 
 (defun rng-validate-done ()
   (when (or (not (current-message))