emacs-wiki-discuss
[Top][All Lists]
Advanced

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

[emacs-wiki-discuss] puzzled by planner-save-buffers


From: Win Treese
Subject: [emacs-wiki-discuss] puzzled by planner-save-buffers
Date: Sun, 03 Jul 2005 14:34:19 -0400

I'm puzzled by the behavior of planner-save-buffers. It seems to me that
it should only close planner buffers, if it closes any at all. Since the
calls to kill-buffer are outside the (when) clause that checks for
planner buffers, it will kill all emacs buffers unless:

1. It is called with a buffer-list of nil, or
2. It is called with a buffer-list that includes all non-planner
   buffers.

I'd like to close all my open planner buffers with something like:

(defun my-close-planner-buffers ()
  "Close all planner buffers"
  (interactive)
  (planner-save-buffers '(dummy-argument-to-make-list-non-nil))
  (let ((buf (and planner-cyclic-diary-file
                  (find-buffer-visiting planner-cyclic-diary-file))))
    (if buf
        (kill-buffer buf))))

without closing everything else.

Here's the obvious patch that just moves the kill-buffer loop into then
big when:

--- orig/planner.el
+++ mod/planner.el
@@ -2016,10 +2016,10 @@
                (planner-tasks-save-behavior nil)
                (planner-id-update-automatically (not suppress-fixing)))
            (when (buffer-modified-p)
-             (save-buffer))))
-       (when (and buffer-list
-                  (not (memq buffer buffer-list)))
-         (kill-buffer nil))))
+             (save-buffer)))
+        (when (and buffer-list
+                   (not (memq buffer buffer-list)))
+          (kill-buffer nil)))))
    (buffer-list)))
 
 ;;;_   + Extraction

--
Win Treese
address@hidden




reply via email to

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