* calendar/todos.el (todos-priorities-rules): Fix customization

type to prevent mismatch error.
(todos-set-top-priorities): Fix rule construction; fix input check;
improve prompt.
This commit is contained in:
Stephen Berman 2012-12-14 18:21:39 +01:00
parent d9f80d442f
commit 86ea3fbd34
2 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,10 @@
2012-12-14 Stephen Berman <stephen.berman@gmx.net>
* calendar/todos.el (todos-priorities-rules): Fix customization
type to prevent mismatch error.
(todos-set-top-priorities): Fix rule construction; fix input check;
improve prompt.
2012-12-14 Stephen Berman <stephen.berman@gmx.net>
* calendar/todos.el (todos-insert-item): If user exits Calendar

View file

@ -493,7 +493,7 @@ number of top priority items for each category in that file, and
ALIST, when non-nil, consists of conses of a category name in
FILE and a number specifying the default number of top priority
items in that category, which overrides NUM."
:type 'list
:type 'sexp
:group 'todos-filtered)
(defcustom todos-show-priorities 1
@ -1992,21 +1992,23 @@ set the user customizable option `todos-priorities-rules'."
(rules todos-priorities-rules)
(frule (assoc-string file rules))
(crule (assoc-string cat (nth 2 frule)))
(crules (nth 2 frule))
(cur (or (if arg (cdr crule) (nth 1 frule))
todos-show-priorities))
(prompt (concat "Current number of top priorities in this "
(if arg "category" "file") ": %d; "
"enter new number: "))
(new "-1")
(prompt (if arg (concat "Number of top priorities in this category"
" (currently %d): ")
(concat "Default number of top priorities per category"
" in this file (currently %d): ")))
(new -1)
nrule)
(while (< (string-to-number new) 0)
(while (< new 0)
(let ((cur0 cur))
(setq new (read-number (format prompt cur0) cur0)
(setq new (read-number (format prompt cur0))
prompt "Enter a non-negative number: "
cur0 nil)))
(setq nrule (if arg
(append (nth 2 (delete crule frule)) (list (cons cat new)))
(append (list file new) (list (nth 2 frule)))))
(append (delete crule crules) (list (cons cat new)))
(append (list file new) (list crules))))
(setq rules (cons (if arg
(list file cur nrule)
nrule)