summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-01-11 17:19:52 +0100
committerBastien Guerry <bzg@altern.org>2013-01-11 17:19:52 +0100
commit71f2befb6126162af2e6efb7bad4cf41af099d9d (patch)
tree3b4c9ae503551370cd60a2db8444cae03c20e830
parent9265513c5e8d0a28a575f1135e890a1ba8f8d554 (diff)
parent3c4df588e85da0deb64f516fac089a0368fae960 (diff)
downloadorg-mode-71f2befb6126162af2e6efb7bad4cf41af099d9d.tar.gz
Merge branch 'maint'
Conflicts: lisp/org-agenda.el
-rw-r--r--lisp/org-agenda.el138
-rw-r--r--lisp/org.el5
2 files changed, 115 insertions, 28 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e8e1b0e..fb4fa28 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1673,26 +1673,53 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
(const :tag "No default duration")))
(defcustom org-agenda-show-inherited-tags t
- "Non-nil means show inherited tags in each agenda line."
+ "Non-nil means show inherited tags in each agenda line.
+
+When this option is set to 'always, it take precedences over
+`org-agenda-use-tag-inheritance' and inherited tags are shown
+in every agenda.
+
+When this option is set to t (the default), inherited tags are
+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.
+
+When set to nil, never show inherited tags in agenda lines."
:group 'org-agenda-line-format
- :type 'boolean)
+ :group 'org-agenda
+ :version "24.3"
+ :type '(choice
+ (const :tag "Show inherited tags when available" t)
+ (const :tag "Always show inherited tags" 'always)
+ (repeat :tag "Show inherited tags only in selected agenda types"
+ (symbol :tag "Agenda type"))))
(defcustom org-agenda-use-tag-inheritance '(todo search timeline agenda)
"List of agenda view types where to use tag inheritance.
In tags/tags-todo/tags-tree agenda views, tag inheritance is
controlled by `org-use-tag-inheritance'. In other agenda types,
-`org-use-tag-inheritance' is not used when selecting the agenda
-entries, but you may want the agenda to use the inherited tags
-anyway, e.g. for later tag filtering.
+`org-use-tag-inheritance' is not used for the selection of the
+agenda entries. Still, you may want the agenda to be aware of
+the inherited tags anyway, e.g. for later tag filtering.
-The default value reset tags in every agenda type. Setting this
-option to nil will speed up non-tags agenda view a lot.
+Allowed value are 'todo, 'search, 'timeline and 'agenda.
-Allowed value are 'todo, 'search, 'timeline and 'agenda."
- :version "24.3"
+This variable has no effect if `org-agenda-show-inherited-tags'
+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
+option to nil will speed up non-tags agenda view a lot."
:group 'org-agenda
- :type '(repeat (symbol :tag "Agenda type")))
+ :version "24.3"
+ :type '(choice
+ (const :tag "Use tag inheritance in all agenda types" t)
+ (repeat :tag "Use tag inheritance in selected agenda types"
+ (symbol :tag "Agenda type"))))
(defcustom org-agenda-hide-tags-regexp nil
"Regular expression used to filter away specific tags in agenda views.
@@ -3594,8 +3621,14 @@ generating a new one."
(save-excursion (next-single-property-change (point-min) 'org-habit-p)))
(org-habit-insert-consistency-graphs))
(setq org-agenda-type (org-get-at-bol 'org-agenda-type))
- (when (delq nil (mapcar (lambda (tp) (org-agenda-check-type nil tp))
- org-agenda-use-tag-inheritance))
+ (unless (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq org-agenda-type org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (and (listp org-agenda-use-tag-inheritance)
+ (not (memq org-agenda-type
+ org-agenda-use-tag-inheritance))))))
(let (mrk)
(save-excursion
(goto-char (point-min))
@@ -4315,7 +4348,7 @@ in `org-agenda-text-search-extra-files'."
'help-echo (format "mouse-2 or RET jump to location")))
(full-words org-agenda-search-view-force-full-words)
(org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
- regexp rtn rtnall files file pos
+ regexp rtn rtnall files file pos inherited-tags
marker category category-pos level tags c neg re boolean
ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
(unless (and (not edit-at)
@@ -4483,7 +4516,13 @@ in `org-agenda-text-search-extra-files'."
category (org-get-category)
level (make-string (org-reduced-level (org-outline-level)) ? )
category-pos (get-text-property (point) 'org-category-position)
- tags (org-get-tags-at nil t)
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (memq 'todo org-agenda-show-inherited-tags)
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'todo org-agenda-use-tag-inheritance))))
+ tags (org-get-tags-at nil (not inherited-tags))
txt (org-agenda-format-item
""
(buffer-substring-no-properties
@@ -5301,7 +5340,7 @@ the documentation of `org-diary'."
"\\|") "\\)"))
(t org-not-done-regexp))))
marker priority category category-pos level tags todo-state
- ee txt beg end)
+ ee txt beg end inherited-tags)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -5319,7 +5358,14 @@ the documentation of `org-diary'."
category-pos (get-text-property (point) 'org-category-position)
txt (org-trim
(buffer-substring (match-beginning 2) (match-end 0)))
- tags (org-get-tags-at nil t)
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'todo org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'todo org-agenda-use-tag-inheritance))))
+ tags (org-get-tags-at nil (not inherited-tags))
level (make-string (org-reduced-level (org-outline-level)) ? )
txt (org-agenda-format-item "" txt level category tags t)
priority (1+ (org-get-priority txt))
@@ -5455,7 +5501,8 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
marker hdmarker deadlinep scheduledp clockp closedp inactivep
donep tmp priority category category-pos level ee txt timestr tags
- b0 b3 e3 head todo-state end-of-match show-all warntime habitp)
+ b0 b3 e3 head todo-state end-of-match show-all warntime habitp
+ inherited-tags)
(goto-char (point-min))
(while (setq end-of-match (re-search-forward regexp nil t))
(setq b0 (match-beginning 0)
@@ -5507,7 +5554,14 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
(assoc (point) deadline-position-alist))
(throw :skip nil))
(setq hdmarker (org-agenda-new-marker)
- tags (org-get-tags-at nil t)
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'agenda org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'agenda org-agenda-use-tag-inheritance))))
+ tags (org-get-tags-at nil (not inherited-tags))
level (make-string (org-reduced-level (org-outline-level)) ? ))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq head (or (match-string 1) ""))
@@ -5540,7 +5594,7 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
(abbreviate-file-name buffer-file-name))))
(regexp "^&?%%(")
marker category extra category-pos level ee txt tags entry
- result beg b sexp sexp-entry todo-state warntime)
+ result beg b sexp sexp-entry todo-state warntime inherited-tags)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -5559,7 +5613,14 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
level (make-string (org-reduced-level (org-outline-level)) ? )
category (org-get-category beg)
category-pos (get-text-property beg 'org-category-position)
- tags (save-excursion (org-back-to-heading t) (org-get-tags-at nil t))
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'agenda org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'agenda org-agenda-use-tag-inheritance))))
+ tags (org-get-tags-at nil (not inherited-tags))
todo-state (org-get-todo-state)
warntime (get-text-property (point) 'org-appt-warntime)
extra nil)
@@ -5690,7 +5751,7 @@ please use `org-class' instead."
1 11))))
(org-agenda-search-headline-for-time nil)
marker hdmarker priority category category-pos level tags closedp
- statep clockp state ee txt extra timestr rest clocked)
+ statep clockp state ee txt extra timestr rest clocked inherited-tags)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -5728,7 +5789,14 @@ please use `org-class' instead."
(setq txt org-agenda-no-heading-message)
(goto-char (match-beginning 0))
(setq hdmarker (org-agenda-new-marker)
- tags (org-get-tags-at nil t)
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'todo org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'todo org-agenda-use-tag-inheritance))))
+ tags (org-get-tags-at nil (not inherited-tags))
level (make-string (org-reduced-level (org-outline-level)) ? ))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq txt (match-string 1))
@@ -6023,7 +6091,7 @@ FRACTION is what fraction of the head-warning time has passed."
deadline-results))
d2 diff pos pos1 category category-pos level tags donep
ee txt head pastschedp todo-state face timestr s habitp show-all
- did-habit-check-p warntime)
+ did-habit-check-p warntime inherited-tags)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -6085,7 +6153,15 @@ FRACTION is what fraction of the head-warning time has passed."
pastschedp))
(setq mm (assoc pos1 deadline-position-alist)))
(throw :skip nil)))
- (setq tags (org-get-tags-at nil t))
+ (setq inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'agenda org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'agenda org-agenda-use-tag-inheritance))))
+
+ tags (org-get-tags-at nil (not inherited-tags)))
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
(setq head (buffer-substring-no-properties
(point)
@@ -6142,7 +6218,7 @@ FRACTION is what fraction of the head-warning time has passed."
(regexp org-tr-regexp)
(d0 (calendar-absolute-from-gregorian date))
marker hdmarker ee txt d1 d2 s1 s2 category category-pos
- level todo-state tags pos head donep)
+ level todo-state tags pos head donep inherited-tags)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -6168,8 +6244,16 @@ FRACTION is what fraction of the head-warning time has passed."
(if (not (re-search-backward org-outline-regexp-bol nil t))
(setq txt org-agenda-no-heading-message)
(goto-char (match-beginning 0))
- (setq hdmarker (org-agenda-new-marker (point)))
- (setq tags (org-get-tags-at nil t))
+ (setq hdmarker (org-agenda-new-marker (point))
+ inherited-tags
+ (or (eq org-agenda-show-inherited-tags 'always)
+ (and (listp org-agenda-show-inherited-tags)
+ (memq 'agenda org-agenda-show-inherited-tags))
+ (and (eq org-agenda-show-inherited-tags t)
+ (or (eq org-agenda-use-tag-inheritance t)
+ (memq 'agenda org-agenda-use-tag-inheritance))))
+
+ tags (org-get-tags-at nil (not inherited-tags)))
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq head (match-string 1))
diff --git a/lisp/org.el b/lisp/org.el
index effb231..1c2ee9a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13778,7 +13778,10 @@ ignore inherited ones."
(error nil)))))
(if local
tags
- (append (org-remove-uninherited-tags org-file-tags) tags))))))
+ (reverse (delete-dups
+ (reverse (append
+ (org-remove-uninherited-tags
+ org-file-tags) tags)))))))))
(defun org-add-prop-inherited (s)
(add-text-properties 0 (length s) '(inherited t) s)