+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
;; 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 ()
(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.
;; 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))