From 518c5b64d537c77050a49d15af25bc919e60f1a2 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Mon, 6 Aug 2018 19:59:25 +0200 Subject: [PATCH] Correct and improve part of previous todo-mode.el fix * lisp/calendar/todo-mode.el (todo-jump-to-category): Improve code by using bound-and-true-p. This leaves a byte-compiler warning unsilenced, but ideally, there shouldn't be a warning here (see https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00131.html). (todo--fifiles-history): New variable. (todo-find-filtered-items-file): Use it to fix the filtered items files history list for completing-read. --- lisp/calendar/todo-mode.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 6ff4d2a0a52..a375313b336 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -933,7 +933,7 @@ Categories mode." (todo-category-number category) (todo-category-select) (goto-char (point-min)) - (if (and (boundp 'hl-line-mode) hl-line-mode) (hl-line-highlight)) + (if (bound-and-true-p hl-line-mode) (hl-line-highlight)) (when add-item (todo-insert-item--basic)))))) (defun todo-next-item (&optional count) @@ -4037,20 +4037,22 @@ regexp items." (interactive "P") (todo-filter-items 'regexp arg t)) +(defvar todo--fifiles-history nil + "List of short file names used by todo-find-filtered-items-file.") + (defun todo-find-filtered-items-file () "Choose a filtered items file and visit it." (interactive) (let ((files (directory-files todo-directory t "\\.tod[rty]$" t)) - falist sfnlist file) + falist file) (dolist (f files) (let ((sf-name (todo-short-file-name f)) (type (cond ((equal (file-name-extension f) "todr") "regexp") ((equal (file-name-extension f) "todt") "top") ((equal (file-name-extension f) "tody") "diary")))) (push (cons (concat sf-name " (" type ")") f) falist))) - (setq sfnlist (mapcar #'car falist)) - (setq file (completing-read "Choose a filtered items file: " - falist nil t nil 'sfnlist (caar falist))) + (setq file (completing-read "Choose a filtered items file: " falist nil t nil + 'todo--fifiles-history (caar falist))) (setq file (cdr (assoc-string file falist))) (find-file file) (unless (derived-mode-p 'todo-filtered-items-mode) -- 2.39.5