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

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

[emacs-wiki-discuss] Re: New behavior when marking tasks complete?


From: Sacha Chua
Subject: [emacs-wiki-discuss] Re: New behavior when marking tasks complete?
Date: Thu, 30 Jun 2005 13:25:16 +0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

johnsu01 <address@hidden> writes:

> I guess I can just track down what changed and change it back, but I
> really don't think it's a good idea to move point by default. I
> still keep accidentally marking the wrong tasks complete, because
> I'm trying to mark 3 tasks in a row, even after a couple of days of
> getting used to the new behavior.

Hmm. Let's see. Excellent point. How should we get around this? I
guess we should revert to the old way of sorting only when we save
files. My planner-tasks-file-behavior is nil, which is why I haven't
been having problems with this. If it's set to non-nil, however,
planner-save-buffers kicks in and saves the current file as well. I
suppose we can suppress saving the current file when we update a task.
Could you please try this patch?

--- orig/planner.el
+++ mod/planner.el
@@ -1713,7 +1715,7 @@
                  (const :tag "Do nothing" nil)))
 
 (defcustom planner-tasks-never-suppress-fixing-flag t
-  "Non-nil means always fix tasks whenever files are saved."
+  "Non-nil means always sort, renumber and align tasks whenever files are 
saved."
   :group 'planner-tasks
   :type 'boolean)
 
@@ -2078,41 +2080,43 @@
        (string= (or (planner-task-date task-a) "")
                 (or (planner-task-date task-b) ""))))
 
-(defun planner-save-buffers (&optional buffer-list suppress-fixing)
+(defun planner-save-buffers (&optional buffer-list suppress-fixing skip-buffer)
   "Save all planner buffers.
 If BUFFER-LIST is a list of buffers, close all buffers not found
 in that list. If SUPPRESS-FIXING is non-nil, do not perform any
-planner-related modifications such as task sorting."
+planner-related modifications such as task sorting. If
+SKIP-BUFFER is non-nil, do not save that buffer."
   (interactive)
   (setq suppress-fixing (and (not planner-tasks-never-suppress-fixing-flag)
                              suppress-fixing))
   (mapcar
    (lambda (buffer)
-     (with-current-buffer buffer
-       ;; Save all planner buffers
-       (when (and (planner-derived-mode-p 'planner-mode)
-                  (planner-page-name))
-         ;; SUPPRESS-FIXING is negated in the following forms because
-         ;; it makes more sense to let planner-save-buffers do the
-         ;; usual actions when the parameter is omitted.
-         (let ((planner-sort-tasks-automatically
-                (and planner-sort-tasks-automatically
-                     (not suppress-fixing)))
-               (planner-renumber-tasks-automatically
-                (and planner-renumber-tasks-automatically
-                     (not suppress-fixing)))
-               (planner-align-tasks-automatically
-                (and planner-align-tasks-automatically
-                     (not suppress-fixing)))
-               (planner-renumber-notes-automatically
-                (and planner-renumber-notes-automatically
-                     (not suppress-fixing)))
-               (planner-tasks-save-behavior nil))
-           (when (buffer-modified-p)
-             (save-buffer))))
-       (when (and buffer-list
-                  (not (memq buffer buffer-list)))
-         (kill-buffer nil))))
+     (unless (eq buffer skip-buffer)
+       (with-current-buffer buffer
+         ;; Save all planner buffers
+         (when (and (planner-derived-mode-p 'planner-mode)
+                    (planner-page-name))
+           ;; SUPPRESS-FIXING is negated in the following forms because
+           ;; it makes more sense to let planner-save-buffers do the
+           ;; usual actions when the parameter is omitted.
+           (let ((planner-sort-tasks-automatically
+                  (and planner-sort-tasks-automatically
+                       (not suppress-fixing)))
+                 (planner-renumber-tasks-automatically
+                  (and planner-renumber-tasks-automatically
+                       (not suppress-fixing)))
+                 (planner-align-tasks-automatically
+                  (and planner-align-tasks-automatically
+                       (not suppress-fixing)))
+                 (planner-renumber-notes-automatically
+                 (and planner-renumber-notes-automatically
+                      (not suppress-fixing)))
+                 (planner-tasks-save-behavior nil))
+             (when (buffer-modified-p)
+               (save-buffer))))
+         (when (and buffer-list
+                    (not (memq buffer buffer-list)))
+           (kill-buffer nil)))))
    (buffer-list)))
 
 ;;;_   + Extraction
@@ -3619,12 +3623,13 @@
        (save-restriction
          (let ((,live-buffers (and (eq planner-tasks-file-behavior
                                        'close)
-                                   (buffer-list))))
+                                   (buffer-list)))
+               (current-buffer (current-buffer)))
           (prog1
                (let ((planner-tasks-file-behavior nil))
                  ,@body)
             (when planner-tasks-file-behavior
-              (planner-save-buffers ,live-buffers t))))))))
+              (planner-save-buffers ,live-buffers t current-buffer))))))))
 
 ;; Manually expanded def-edebug-spec so that we don't have to pull
 ;; edebug in

-- 
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
sachac on irc.freenode.net#emacs . YM: sachachua83




reply via email to

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