From: Leo Liu Date: Sun, 24 Mar 2013 06:42:25 +0000 (+0800) Subject: * lisp/files.el (kill-buffer-hook): Doc fix. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~526^2~102 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7b0e2f853fcd88c58715fd159923d50dfdeb9cba;p=emacs.git * lisp/files.el (kill-buffer-hook): Doc fix. * 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c1124f51a8e..68a9575bcbe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2013-03-24 Leo Liu + + * 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 * emacs-lisp/lisp-mode.el (emacs-lisp-docstring-fill-column): Make diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 52e12013fd3..5a6fd4a0a22 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -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 () diff --git a/lisp/files.el b/lisp/files.el index 9da9ac6fd53..06958622d14 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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. diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index de18c581421..e1140980813 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -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))