1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-02-07 21:35:02 +00:00

lisp/org-agenda.el (org-todo-list): Rename variables and format

* lisp/org/org-agenda.el
(org-todo-list): Use `org-today' directly for `calendar-gregorian-from-absolute'.
(org-todo-list): Replace `date' with `today' (`date' is no longer used).
(org-todo-list): Replace `kwds' with `todo-keywords'.
(org-todo-list): Replace `rtn' with `todo-entries'.
(org-todo-list): Replace `rtnall' with `all-todo-entries'.
(org-todo-list): Replace some `and' with `when' and `cond'.
(org-todo-list): Some whitespace changes.

TINYCHANGE
This commit is contained in:
Nafiz Islam 2023-12-26 12:34:20 -05:00 committed by Ihor Radchenko
parent 6d1c1721e3
commit a27a1b87b5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -4958,48 +4958,48 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
(interactive "P")
(when org-agenda-overriding-arguments
(setq arg org-agenda-overriding-arguments))
(when (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
(let* ((today (org-today))
(date (calendar-gregorian-from-absolute today))
(when (and (stringp arg) (not (string-match "\\S-" arg)))
(setq arg nil))
(let* ((today (calendar-gregorian-from-absolute (org-today)))
(completion-ignore-case t)
kwds org-select-this-todo-keyword rtn rtnall files file pos)
todo-keywords org-select-this-todo-keyword todo-entries all-todo-entries files file pos)
(catch 'exit
(setq org-agenda-buffer-name
(org-agenda--get-buffer-name
(and org-agenda-sticky
(when org-agenda-sticky
(if (stringp org-select-this-todo-keyword)
(format "*Org Agenda(%s:%s)*" (or org-keys "t")
org-select-this-todo-keyword)
(format "*Org Agenda(%s)*" (or org-keys "t"))))))
(org-agenda-prepare "TODO")
(setq kwds org-todo-keywords-for-agenda
org-select-this-todo-keyword (if (stringp arg) arg
(and (integerp arg)
(> arg 0)
(nth (1- arg) kwds))))
(setq todo-keywords org-todo-keywords-for-agenda
org-select-this-todo-keyword (cond ((stringp arg) arg)
((and (integerp arg) (> arg 0))
(nth (1- arg) todo-keywords))))
(when (equal arg '(4))
(setq org-select-this-todo-keyword
(mapconcat #'identity
(let ((crm-separator "|"))
(completing-read-multiple
"Keyword (or KWD1|KWD2|...): "
(mapcar #'list kwds) nil nil))
(mapcar #'list todo-keywords) nil nil))
"|")))
(and (equal 0 arg) (setq org-select-this-todo-keyword nil))
(when (equal arg 0)
(setq org-select-this-todo-keyword nil))
(org-compile-prefix-format 'todo)
(org-set-sorting-strategy 'todo)
(setq org-agenda-redo-command
`(org-todo-list (or (and (numberp current-prefix-arg)
current-prefix-arg)
`(org-todo-list (or (and (numberp current-prefix-arg) current-prefix-arg)
,org-select-this-todo-keyword
current-prefix-arg ,arg)))
current-prefix-arg
,arg)))
(setq files (org-agenda-files nil 'ifmode)
rtnall nil)
all-todo-entries nil)
(while (setq file (pop files))
(catch 'nextfile
(org-check-agenda-file file)
(setq rtn (org-agenda-get-day-entries file date :todo))
(setq rtnall (append rtnall rtn))))
(setq todo-entries (org-agenda-get-day-entries file today :todo))
(setq all-todo-entries (append all-todo-entries todo-entries))))
(org-agenda--insert-overriding-header
(with-temp-buffer
(insert "Global list of TODO items of type: ")
@ -5017,7 +5017,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
\\<org-agenda-mode-map>`N \\[org-agenda-redo]' (e.g. `0 \\[org-agenda-redo]') \
to search again: (0)[ALL]"))
(let ((n 0))
(dolist (k kwds)
(dolist (k todo-keywords)
(let ((s (format "(%d)%s" (cl-incf n) k)))
(when (> (+ (current-column) (string-width s) 1) (window-max-chars-per-line))
(insert "\n "))
@ -5026,8 +5026,8 @@ to search again: (0)[ALL]"))
(add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure-secondary))
(buffer-string)))
(org-agenda-mark-header-line (point-min))
(when rtnall
(insert (org-agenda-finalize-entries rtnall 'todo) "\n"))
(when all-todo-entries
(insert (org-agenda-finalize-entries all-todo-entries 'todo) "\n"))
(goto-char (point-min))
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
(add-text-properties (point-min) (point-max)