emacs-pretest-bug
[Top][All Lists]
Advanced

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

clean-buffer-list with indirect buffers


From: martin rudalics
Subject: clean-buffer-list with indirect buffers
Date: Sat, 25 Feb 2006 18:20:46 +0100

When `clean-buffer-list' kills the base-buffer of an indirect buffer
_before_ it is able to kill the indirect buffer, the indirect buffer
gets killed too.  In this case invoking `midnight-buffer-display-time'
when called with the killed indirect buffer as argument will result in a
"clean-buffer-list: Selecting deleted buffer" error.  The trivial patch
below should fix this.

        * midnight.el (clean-buffer-list): Handle case where base-buffer of
        indirect buffer gets killed before indirect buffer.  Use dolist.

================================================================================
*** midnight.el Sat Nov  5 20:44:34 2005
--- midnight.el Sat Feb 25 16:07:34 2006
***************
*** 178,197 ****
  lifetime, i.e., its \"age\" when it will be purged."
    (interactive)
    (let ((tm (float-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
!         (bufs (buffer-list)) buf delay cbld bn)
!     (while (setq buf (pop bufs))
!       (setq bts (midnight-buffer-display-time buf) bn (buffer-name buf)
!             delay (if bts (- tm bts) 0) cbld (clean-buffer-list-delay bn))
!       (message "[%s] `%s' [%s %d]" ts bn (if bts (round delay)) cbld)
!       (unless (or (midnight-find bn clean-buffer-list-kill-never-regexps
!                                  'string-match)
!                   (midnight-find bn clean-buffer-list-kill-never-buffer-names
!                                  'string-equal)
!                   (get-buffer-process buf)
!                   (and (buffer-file-name buf) (buffer-modified-p buf))
!                   (get-buffer-window buf 'visible) (< delay cbld))
!         (message "[%s] killing `%s'" ts bn)
!         (kill-buffer buf)))))

  ;;; midnight hook

--- 178,198 ----
  lifetime, i.e., its \"age\" when it will be purged."
    (interactive)
    (let ((tm (float-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
!         delay cbld bn)
!     (dolist (buf (buffer-list))
!       (when (buffer-live-p buf)
!       (setq bts (midnight-buffer-display-time buf) bn (buffer-name buf)
!             delay (if bts (- tm bts) 0) cbld (clean-buffer-list-delay bn))
!       (message "[%s] `%s' [%s %d]" ts bn (if bts (round delay)) cbld)
!       (unless (or (midnight-find bn clean-buffer-list-kill-never-regexps
!                                  'string-match)
!                   (midnight-find bn clean-buffer-list-kill-never-buffer-names
!                                  'string-equal)
!                   (get-buffer-process buf)
!                   (and (buffer-file-name buf) (buffer-modified-p buf))
!                   (get-buffer-window buf 'visible) (< delay cbld))
!         (message "[%s] killing `%s'" ts bn)
!         (kill-buffer buf))))))

  ;;; midnight hook

================================================================================




reply via email to

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