summaryrefslogtreecommitdiff
path: root/lisp/org-agenda.el
diff options
context:
space:
mode:
authorSébastien Delafond <sdelafond@gmail.com>2015-11-27 17:40:16 +0100
committerSébastien Delafond <sdelafond@gmail.com>2015-11-27 17:40:16 +0100
commit09600666ecbbebe86830a937658465d046e13d06 (patch)
treef8140dfdec0fdfc11323d6c491f7680673bcc0de /lisp/org-agenda.el
parent1be13d57dc8357576a8285c6dadc03db9e3ed7b0 (diff)
Imported Upstream version 8.3.2
Diffstat (limited to 'lisp/org-agenda.el')
-rw-r--r--lisp/org-agenda.el165
1 files changed, 91 insertions, 74 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c5cd21d..0725d9e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -153,7 +153,7 @@ before assigned to the variables. So make sure to quote values you do
*not* want evaluated, for example
(setq org-agenda-exporter-settings
- '((ps-print-color-p 'black-white)))"
+ \\='((ps-print-color-p \\='black-white)))"
:group 'org-agenda-export
:type '(repeat
(list
@@ -440,7 +440,7 @@ This will be spliced into the custom type of
(defcustom org-agenda-custom-commands
- '(("n" "Agenda and all TODO's" ((agenda "") (alltodo ""))))
+ '(("n" "Agenda and all TODOs" ((agenda "") (alltodo ""))))
"Custom commands for the agenda.
These commands will be offered on the splash screen displayed by the
agenda dispatcher \\[org-agenda]. Each entry is a list like this:
@@ -504,7 +504,7 @@ are prefix commands. For the dispatcher to display useful information, you
should provide a description for the prefix, like
(setq org-agenda-custom-commands
- '((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
+ \\='((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
(\"hl\" tags \"+HOME+Lisa\")
(\"hp\" tags \"+HOME+Peter\")
(\"hk\" tags \"+HOME+Kim\")))"
@@ -1211,7 +1211,7 @@ For example, 9:30am would become 09:30 rather than 9:30."
:type 'boolean)
(defun org-agenda-time-of-day-to-ampm (time)
- "Convert TIME of a string like '13:45' to an AM/PM style time string."
+ "Convert TIME of a string like \"13:45\" to an AM/PM style time string."
(let* ((hour-number (string-to-number (substring time 0 -3)))
(minute (substring time -2))
(ampm "am"))
@@ -1292,12 +1292,14 @@ given here."
(defcustom org-agenda-log-mode-items '(closed clock)
"List of items that should be shown in agenda log mode.
+\\<org-agenda-mode-map>\
This list may contain the following symbols:
closed Show entries that have been closed on that day.
clock Show entries that have received clocked time on that day.
state Show all logged state changes.
-Note that instead of changing this variable, you can also press `C-u l' in
+Note that instead of changing this variable, you can also press \
+`\\[universal-argument] \\[org-agenda-log-mode]' in
the agenda to display all available LOG items temporarily."
:group 'org-agenda-daily/weekly
:type '(set :greedy t (const closed) (const clock) (const state)))
@@ -1792,7 +1794,7 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
(defcustom org-agenda-show-inherited-tags t
"Non-nil means show inherited tags in each agenda line.
-When this option is set to 'always, it take precedences over
+When this option is set to `always', it take precedences over
`org-agenda-use-tag-inheritance' and inherited tags are shown
in every agenda.
@@ -1801,8 +1803,8 @@ shown when they are available, i.e. when the value of
`org-agenda-use-tag-inheritance' has been taken into account.
This can be set to a list of agenda types in which the agenda
-must display the inherited tags. Available types are 'todo,
-'agenda, 'search and 'timeline.
+must display the inherited tags. Available types are `todo',
+`agenda', `search' and `timeline'.
When set to nil, never show inherited tags in agenda lines."
:group 'org-agenda-line-format
@@ -1823,10 +1825,10 @@ controlled by `org-use-tag-inheritance'. In other agenda types,
agenda entries. Still, you may want the agenda to be aware of
the inherited tags anyway, e.g. for later tag filtering.
-Allowed value are 'todo, 'search, 'timeline and 'agenda.
+Allowed value are `todo', `search', `timeline' and `agenda'.
This variable has no effect if `org-agenda-show-inherited-tags'
-is set to 'always. In that case, the agenda is aware of those
+is set to `always'. In that case, the agenda is aware of those
tags.
The default value sets tags in every agenda type. Setting this
@@ -1932,7 +1934,7 @@ list as second element:
For example, to display a 16px horizontal space for Emacs
category, you can use:
- (\"Emacs\" '(space . (:width (16))))"
+ (\"Emacs\" \\='(space . (:width (16))))"
:group 'org-agenda-line-format
:version "24.1"
:type '(alist :key-type (string :tag "Regexp matching category")
@@ -1975,7 +1977,8 @@ estimate."
:type 'boolean)
(defcustom org-agenda-auto-exclude-function nil
- "A function called with a tag to decide if it is filtered on '/ RET'.
+ "A function called with a tag to decide if it is filtered on \
+\\<org-agenda-mode-map>`\\[org-agenda-filter-by-tag] RET'.
The sole argument to the function, which is called once for each
possible tag, is a string giving the name of the tag. The
function should return either nil if the tag should be included
@@ -1990,7 +1993,7 @@ the lower-case version of all tags."
"Alist of characters and custom functions for bulk actions.
For example, this value makes those two functions available:
- '((?R set-category)
+ \\='((?R set-category)
(?C bulk-cut))
With selected entries in an agenda buffer, `B R' will call
@@ -2006,7 +2009,7 @@ If STRING is non-nil, the text property will be fetched from position 0
in that string. If STRING is nil, it will be fetched from the beginning
of the current line."
(org-with-gensyms (marker)
- `(let ((,marker (get-text-property (if string 0 (point-at-bol))
+ `(let ((,marker (get-text-property (if ,string 0 (point-at-bol))
'org-hd-marker ,string)))
(with-current-buffer (marker-buffer ,marker)
(save-excursion
@@ -2547,7 +2550,7 @@ For example, if you have a custom agenda command \"p\" and you
want this command to be accessible only from plain text files,
use this:
- '((\"p\" ((in-file . \"\\\\.txt\\\\'\"))))
+ \\='((\"p\" ((in-file . \"\\\\.txt\\\\'\"))))
Here are the available contexts definitions:
@@ -2565,7 +2568,7 @@ accessible if there is at least one valid check.
You can also bind a key to another agenda custom command
depending on contextual rules.
- '((\"p\" \"q\" ((in-file . \"\\\\.txt\\\\'\"))))
+ \\='((\"p\" \"q\" ((in-file . \"\\\\.txt\\\\'\"))))
Here it means: in .txt files, use \"p\" as the key for the
agenda command otherwise associated with \"q\". (The command
@@ -3851,41 +3854,42 @@ FILTER-ALIST is an alist of filters we need to apply when
(defvar org-depend-tag-blocked)
(defun org-agenda-dim-blocked-tasks (&optional invisible)
- "Dim currently blocked TODO's in the agenda display.
+ "Dim currently blocked TODOs in the agenda display.
When INVISIBLE is non-nil, hide currently blocked TODO instead of
dimming them."
(interactive "P")
(when (org-called-interactively-p 'interactive)
(message "Dim or hide blocked tasks..."))
- (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo)
- (delete-overlay o)))
- (overlays-in (point-min) (point-max)))
+ (dolist (o (overlays-in (point-min) (point-max)))
+ (when (eq (overlay-get o 'org-type) 'org-blocked-todo)
+ (delete-overlay o)))
(save-excursion
(let ((inhibit-read-only t)
(org-depend-tag-blocked nil)
- (invis (or (not (null invisible))
- (eq org-agenda-dim-blocked-tasks 'invisible)))
- org-blocked-by-checkboxes
- invis1 b e p ov h l)
+ org-blocked-by-checkboxes)
(goto-char (point-min))
- (while (let ((pos (next-single-property-change (point) 'todo-state)))
- (and pos (goto-char (1+ pos))))
- (setq org-blocked-by-checkboxes nil invis1 invis)
+ (while (let ((pos (text-property-not-all
+ (point) (point-max) 'todo-state nil)))
+ (when pos (goto-char pos)))
+ (setq org-blocked-by-checkboxes nil)
(let ((marker (org-get-at-bol 'org-hd-marker)))
- (when (and marker
+ (when (and (markerp marker)
(with-current-buffer (marker-buffer marker)
(save-excursion (goto-char marker)
(org-entry-blocked-p))))
- (if org-blocked-by-checkboxes (setq invis1 nil))
- (setq b (if invis1
- (max (point-min) (1- (point-at-bol)))
- (point-at-bol))
- e (point-at-eol)
- ov (make-overlay b e))
- (if invis1
- (overlay-put ov 'invisible t)
- (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
- (overlay-put ov 'org-type 'org-blocked-todo))))))
+ ;; Entries blocked by checkboxes cannot be made invisible.
+ ;; See `org-agenda-dim-blocked-tasks' for details.
+ (let* ((really-invisible
+ (and (not org-blocked-by-checkboxes)
+ (or invisible (eq org-agenda-dim-blocked-tasks
+ 'invisible))))
+ (ov (make-overlay (if really-invisible (line-end-position 0)
+ (line-beginning-position))
+ (line-end-position))))
+ (if really-invisible (overlay-put ov 'invisible t)
+ (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
+ (overlay-put ov 'org-type 'org-blocked-todo))))
+ (forward-line))))
(when (org-called-interactively-p 'interactive)
(message "Dim or hide blocked tasks...done")))
@@ -4638,7 +4642,8 @@ in `org-agenda-text-search-extra-files'."
(goto-char (1- end))
(throw :skip t)))
(if todo-only
- (cons (concat "^\*+[ \t]+" org-not-done-regexp)
+ (cons (concat "^\\*+[ \t]+"
+ org-not-done-regexp)
regexps+)
regexps+))
(goto-char beg)
@@ -4680,7 +4685,12 @@ in `org-agenda-text-search-extra-files'."
(add-text-properties pos (1- (point)) (list 'face 'org-warning))
(setq pos (point))
(unless org-agenda-multi
- (insert "Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, `C-u r' to edit\n")
+ (insert (substitute-command-keys "\
+Press `\\[org-agenda-manipulate-query-add]', \
+`\\[org-agenda-manipulate-query-subtract]' to add/sub word, \
+`\\[org-agenda-manipulate-query-add-re]', \
+`\\[org-agenda-manipulate-query-subtract-re]' to add/sub regexp, \
+`\\[universal-argument] \\[org-agenda-redo]' to edit\n"))
(add-text-properties pos (1- (point))
(list 'face 'org-agenda-structure))))
(org-agenda-mark-header-line (point-min))
@@ -4774,7 +4784,8 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
org-select-this-todo-keyword))
(setq pos (point))
(unless org-agenda-multi
- (insert "Available with `N r': (0)[ALL]")
+ (insert (substitute-command-keys "Available with \
+`N \\[org-agenda-redo]': (0)[ALL]"))
(let ((n 0) s)
(mapc (lambda (x)
(setq s (format "(%d)%s" (setq n (1+ n)) x))
@@ -4869,7 +4880,9 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
(add-text-properties pos (1- (point)) (list 'face 'org-warning))
(setq pos (point))
(unless org-agenda-multi
- (insert "Press `C-u r' to search again with new search string\n"))
+ (insert (substitute-command-keys
+ "Press `\\[universal-argument] \\[org-agenda-redo]' \
+to search again with new search string\n")))
(add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
(org-agenda-mark-header-line (point-min))
(when rtnall
@@ -4968,13 +4981,13 @@ the `regexp' or `notregexp' element.
`todo' and `nottodo' accept as an argument a list of todo
keywords, which may include \"*\" to match any todo keyword.
- (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
+ (org-agenda-skip-entry-if \\='todo \\='(\"TODO\" \"WAITING\"))
would skip all entries with \"TODO\" or \"WAITING\" keywords.
Instead of a list, a keyword class may be given. For example:
- (org-agenda-skip-entry-if 'nottodo 'done)
+ (org-agenda-skip-entry-if \\='nottodo \\='done)
would skip entries that haven't been marked with any of \"DONE\"
keywords. Possible classes are: `todo', `done', `any'.
@@ -7115,7 +7128,7 @@ their type."
(defun org-agenda-set-restriction-lock (&optional type)
"Set restriction lock for agenda, to current subtree or file.
Restriction will be the file if TYPE is `file', or if type is the
-universal prefix '(4), or if the cursor is before the first headline
+universal prefix \\='(4), or if the cursor is before the first headline
in the file. Otherwise, restriction will be to the current subtree."
(interactive "P")
(org-agenda-remove-restriction-lock 'noupdate)
@@ -7168,7 +7181,9 @@ in the file. Otherwise, restriction will be to the current subtree."
(defun org-agenda-maybe-redo ()
"If there is any window showing the agenda view, update it."
- (let ((w (get-buffer-window org-agenda-buffer-name t))
+ (let ((w (get-buffer-window (or org-agenda-this-buffer-name
+ org-agenda-buffer-name)
+ t))
(w0 (selected-window)))
(when w
(select-window w)
@@ -7184,7 +7199,7 @@ in the file. Otherwise, restriction will be to the current subtree."
(defun org-agenda-check-type (error &rest types)
"Check if agenda buffer is of allowed type.
If ERROR is non-nil, throw an error, otherwise just return nil.
-Allowed types are 'agenda 'timeline 'todo 'tags 'search."
+Allowed types are `agenda' `timeline' `todo' `tags' `search'."
(if (not org-agenda-type)
(error "No Org agenda currently displayed")
(if (memq org-agenda-type types)
@@ -7259,8 +7274,7 @@ touched. Also, exit the agenda even if it is in column view."
(defun org-agenda-kill-all-agenda-buffers ()
"Kill all buffers in `org-agenda-mode'.
-This is used when toggling sticky agendas.
-You can also explicitly invoke it with `C-c a C-k'."
+This is used when toggling sticky agendas."
(interactive)
(let (blist)
(dolist (buf (buffer-list))
@@ -7349,8 +7363,11 @@ in the agenda."
(defvar org-agenda-filtered-by-category nil)
(defun org-agenda-filter-by-category (strip)
- "Keep only those lines in the agenda buffer that have a specific category.
-The category is that of the current line."
+ "Filter lines in the agenda buffer that have a specific category.
+The category is that of the current line.
+Without prefix argument, keep only the lines of that category.
+With a prefix argument, exclude the lines of that category.
+"
(interactive "P")
(if (and org-agenda-filtered-by-category
org-agenda-category-filter)
@@ -7360,7 +7377,7 @@ The category is that of the current line."
((and cat strip)
(org-agenda-filter-apply
(push (concat "-" cat) org-agenda-category-filter) 'category))
- ((and cat)
+ (cat
(org-agenda-filter-apply
(setq org-agenda-category-filter
(list (concat "+" cat))) 'category))
@@ -8164,7 +8181,8 @@ so that the date SD will be in that range."
"Toggle log mode in an agenda buffer.
With argument SPECIAL, show all possible log items, not only the ones
configured in `org-agenda-log-mode-items'.
-With a double `C-u' prefix arg, show *only* log items, nothing else."
+With a double \\[universal-argument] prefix arg, show *only* \
+log items, nothing else."
(interactive "P")
(org-agenda-check-type t 'agenda 'timeline)
(setq org-agenda-show-log
@@ -8388,13 +8406,13 @@ When called with a prefix argument, include all archive files as well."
(org-show-context 'agenda)
(save-excursion
(and (outline-next-heading)
- (org-flag-heading nil)))) ; show the next heading
- (when (outline-invisible-p)
- (show-entry)) ; display invisible text
- (recenter (/ (window-height) 2))
- (org-back-to-heading t)
- (if (re-search-forward org-complex-heading-regexp nil t)
- (goto-char (match-beginning 4)))
+ (org-flag-heading nil))) ; show the next heading
+ (when (outline-invisible-p)
+ (show-entry)) ; display invisible text
+ (recenter (/ (window-height) 2))
+ (org-back-to-heading t)
+ (if (re-search-forward org-complex-heading-regexp nil t)
+ (goto-char (match-beginning 4))))
(run-hooks 'org-agenda-after-show-hook)
(and highlight (org-highlight (point-at-bol) (point-at-eol)))))
@@ -8511,8 +8529,10 @@ If this information is not given, the function uses the tree at point."
(defun org-agenda-refile (&optional goto rfloc no-update)
"Refile the item at point.
-When GOTO is 0 or '(64) or \\[universal-argument] \\[universal-argument] \\[universal-argument], clear the refile cache.
-When GOTO is '(16) or \\[universal-argument] \\[universal-argument], go to the location of the last refiled item.
+When GOTO is 0 or \\='(64) or a triple \\[universal-argument] prefix argument,
+clear the refile cache.
+When GOTO is \\='(16) or a double \\[universal-argument] prefix argument,
+go to the location of the last refiled item.
RFLOC can be a refile location obtained in a different way.
When NO-UPDATE is non-nil, don't redo the agenda buffer."
(interactive "P")
@@ -8593,7 +8613,9 @@ It also looks at the text of the entry itself."
(symbol-value var))))))
(defun org-agenda-switch-to (&optional delete-other-windows)
- "Go to the Org-mode file which contains the item at point."
+ "Go to the Org mode file which contains the item at point.
+When optional argument DELETE-OTHER-WINDOWS is non-nil, the
+displayed Org file fills the frame."
(interactive)
(if (and org-return-follows-link
(not (org-get-at-bol 'org-marker))
@@ -8605,17 +8627,11 @@ It also looks at the text of the entry itself."
(pos (marker-position marker)))
(unless buffer (user-error "Trying to switch to non-existent buffer"))
(org-pop-to-buffer-same-window buffer)
- (and delete-other-windows (delete-other-windows))
+ (when delete-other-windows (delete-other-windows))
(widen)
(goto-char pos)
- (org-back-to-heading t)
(when (derived-mode-p 'org-mode)
(org-show-context 'agenda)
- (save-excursion
- (and (outline-next-heading)
- (org-flag-heading nil))) ; show the next heading
- (when (outline-invisible-p)
- (show-entry)) ; display invisible text
(run-hooks 'org-agenda-after-show-hook)))))
(defun org-agenda-goto-mouse (ev)
@@ -9682,7 +9698,7 @@ This is a command that has to be installed in `calendar-mode-map'."
"Hebrew: " (calendar-hebrew-date-string date) " (until sunset)\n"
"Islamic: " (calendar-islamic-date-string date) " (until sunset)\n"
"French: " (calendar-french-date-string date) "\n"
- "Baha'i: " (calendar-bahai-date-string date) " (until sunset)\n"
+ "Bahá’í: " (calendar-bahai-date-string date) " (until sunset)\n"
"Mayan: " (calendar-mayan-date-string date) "\n"
"Coptic: " (calendar-coptic-date-string date) "\n"
"Ethiopic: " (calendar-ethiopic-date-string date) "\n"
@@ -10061,7 +10077,8 @@ tag and (if present) the flagging note."
(replace-match "\n" t t))
(goto-char (point-min))
(select-window win)
- (message "Flagging note pushed to kill ring. Press [?] again to remove tag and note"))))
+ (message (substitute-command-keys "Flagging note pushed to kill ring. \
+Press \\[org-agenda-show-the-flagging-note] again to remove tag and note")))))
(defun org-agenda-remove-flag (marker)
"Remove the FLAGGED tag and any flagging note in the entry."
@@ -10098,9 +10115,9 @@ calling the function returns nil. This function takes one
argument: an entry from `org-agenda-get-day-entries'.
FILTER can also be an alist with the car of each cell being
-either 'headline or 'category. For example:
+either `headline' or `category'. For example:
- '((headline \"IMPORTANT\")
+ \\='((headline \"IMPORTANT\")
(category \"Work\"))
will only add headlines containing IMPORTANT or headlines