Subject: [PATCH] calendar/todo-mode.el: todo-expert-mode, New variable

From: Jari Aalto <[email-masked]>
Date: Thu, 11 Dec 2008 20:37:34 +0200

Severity: wishlist

[ resent from
  http://lists.gnu.org/archive/html/emacs-devel/2008-12/msg00455.html ]

Here is patch to suppress questions when todo-expert-mode is set to
non-nil

Jari

2008-12-11  Jari Aalto  <[email-masked]>

        * calendar/todo-mode.el (todo-expert-mode): New variable.
        (todo-delete-item): Check `todo-expert-mode'.
        (todo-more-important-p): Check `todo-expert-mode'.

 calendar/todo-mode.el |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/calendar/todo-mode.el b/calendar/todo-mode.el
index 8f17a45..7d59cc6 100644
--- a/calendar/todo-mode.el
+++ b/calendar/todo-mode.el
@@ -57,6 +57,8 @@
 ;;          (autoload 'todo-insert-item "todo-mode"
 ;;                    "Add TODO item." t)
 ;;
+;;          (setq todo-expert-mode t)  ;; To suppress questions
+;;
 ;;      You may now enter new items by typing "M-x todo-insert-item",
 ;;      or enter your TODO list file by typing "M-x todo-show".
 ;;
@@ -348,6 +350,11 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
   :type 'boolean
   :group 'todo)
 
+(defcustom todo-expert-mode nil
+  "If Non-nil, suppress questions."
+  :type 'boolean
+  :group 'todo)
+
 ;; Thanks for the ISO time stamp format go to Karl Eichwalder <[email-masked]>
 ;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p".
 ;;
@@ -629,7 +636,9 @@ category."
     (forward-line (1- todo-previous-line))
     (let ((item (todo-item-string-start)))
       (setq todo-previous-answer
-            (y-or-n-p (concat "More important than '" item "'? ")))))
+	    (if todo-expert-mode
+		nil ;; No questions
+	      (y-or-n-p (concat "More important than '" item "'? "))))))
   todo-previous-answer)
 (defalias 'todo-ask-p 'todo-more-important-p)
 
@@ -638,8 +647,9 @@ category."
   (interactive)
   (if (> (count-lines (point-min) (point-max)) 0)
       (let* ((todo-entry (todo-item-string-start))
-             (todo-answer (y-or-n-p (concat "Permanently remove '"
-                                            todo-entry "'? "))))
+             (todo-answer (or todo-expert-mode
+			      (y-or-n-p (concat "Permanently remove '"
+						todo-entry "'? ")))))
         (when todo-answer
           (todo-remove-item)
           (todo-backward-item))