mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-05 11:45:52 +00:00
Allow to exclude specific tags from inheritance.
So far, the only way to select tags for inheritance was to allow it for all tags, or to do a positive selection using one of the more complex settings for `org-use-tag-inheritance'. It may actually be better to allow inheritance for all but a few tags, which was difficult to achieve with this methodology. This patch introduces a new option, `org-tags-exclude-from-inheritance' which allows to specify an exclusion list for inherited tags.
This commit is contained in:
parent
8ded7aa618
commit
733dfca36b
@ -77,6 +77,18 @@
|
||||
If you prefer the old behavior of only showing the local
|
||||
tags, customize the variable =org-agenda-show-inherited-tags=.
|
||||
|
||||
*** Exclude some tags from inheritance.
|
||||
|
||||
So far, the only way to select tags for inheritance was to
|
||||
allow it for all tags, or to do a positive selection using
|
||||
one of the more complex settings for
|
||||
`org-use-tag-inheritance'. It may actually be better to
|
||||
allow inheritance for all but a few tags, which was difficult
|
||||
to achieve with this methodology.
|
||||
|
||||
A new option, `org-tags-exclude-from-inheritance', allows to
|
||||
specify an exclusion list for inherited tags.
|
||||
|
||||
* Version 6.13
|
||||
|
||||
** Overview
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-11-27 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Tag inheritance): Refine the description of tag
|
||||
inheritance.
|
||||
|
||||
2008-11-25 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.texi (Project alist): Add info about the publishing sequence
|
||||
|
14
doc/org.texi
14
doc/org.texi
@ -3480,14 +3480,16 @@ level zero that surounds the entire file.
|
||||
|
||||
@noindent
|
||||
To limit tag inheritance to specific tags, or to turn it off entirely, use
|
||||
the variable @code{org-use-tag-inheritance}.
|
||||
the variables @code{org-use-tag-inheritance} and
|
||||
@code{org-tags-exclude-from-inheritance}.
|
||||
|
||||
When a headline matches during a tags search while tag inheritance is turned
|
||||
on, all the sublevels in the same tree will match as well@footnote{This is
|
||||
only true if the the search does not involve more complex tests including
|
||||
properties (@pxref{Property searches}).}. The list of matches may then
|
||||
become very long. If you only want to see the first tags match in a subtree,
|
||||
configure the variable @code{org-tags-match-list-sublevels}.
|
||||
on, all the sublevels in the same tree will (for a simple match form) match
|
||||
as well@footnote{This is only true if the the search does not involve more
|
||||
complex tests including properties (@pxref{Property searches}).}. The list
|
||||
of matches may then become very long. If you only want to see the first tags
|
||||
match in a subtree, configure the variable
|
||||
@code{org-tags-match-list-sublevels} (not recommended).
|
||||
|
||||
@node Setting tags, Tag searches, Tag inheritance, Tags
|
||||
@section Setting tags
|
||||
|
@ -1,5 +1,9 @@
|
||||
2008-11-27 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org.el (org-tags-exclude-from-inheritance): New option.
|
||||
(org-tag-inherit-p, org-remove-uniherited-tags): Respect
|
||||
`org-tags-exclude-from-inheritance'.
|
||||
|
||||
* org-agenda.el (org-agenda-show-inherited-tags): New option.
|
||||
(org-format-agenda-item): Add inherited tags to the agenda line
|
||||
string, and make sure that properties are kept when downcasing the
|
||||
|
43
lisp/org.el
43
lisp/org.el
@ -1882,13 +1882,16 @@ the tags are again aligned to `org-tags-column'."
|
||||
(defcustom org-use-tag-inheritance t
|
||||
"Non-nil means, tags in levels apply also for sublevels.
|
||||
When nil, only the tags directly given in a specific line apply there.
|
||||
If this option is t, a match early-on in a tree can lead to a large
|
||||
number of matches in the subtree. If you only want to see the first
|
||||
match in a tree during a search, check out the variable
|
||||
`org-tags-match-list-sublevels'.
|
||||
|
||||
This may also be a list of tags that should be inherited, or a regexp that
|
||||
matches tags that should be inherited."
|
||||
matches tags that should be inherited. Additional control is possible
|
||||
with the variable `org-tags-exclude-from-inheritance' which gives an
|
||||
explicit list of tags to be excluded from inheritance., even if the value of
|
||||
`org-use-tag-inheritance' would select it for inheritance.
|
||||
|
||||
If this option is t, a match early-on in a tree can lead to a large
|
||||
number of matches in the subtree when constructing the agenda or creating
|
||||
a sparse tree. If you only want to see the first match in a tree during
|
||||
a search, check out the variable `org-tags-match-list-sublevels'."
|
||||
:group 'org-tags
|
||||
:type '(choice
|
||||
(const :tag "Not" nil)
|
||||
@ -1896,9 +1899,18 @@ matches tags that should be inherited."
|
||||
(repeat :tag "Specific tags" (string :tag "Tag"))
|
||||
(regexp :tag "Tags matched by regexp")))
|
||||
|
||||
(defcustom org-tags-exclude-from-inheritance nil
|
||||
"List of tags that should never be inherited.
|
||||
This is a way to exclude a few tags from inheritance. For way to do
|
||||
the opposite, to actively allow inheritance for selected tags,
|
||||
see the variable `org-use-tag-inheritance'."
|
||||
:group 'org-tags
|
||||
:type '(repeat (string :tag "Tag")))
|
||||
|
||||
(defun org-tag-inherit-p (tag)
|
||||
"Check if TAG is one that should be inherited."
|
||||
(cond
|
||||
((member tag org-tags-exclude-from-inheritance) nil)
|
||||
((eq org-use-tag-inheritance t) t)
|
||||
((not org-use-tag-inheritance) nil)
|
||||
((stringp org-use-tag-inheritance)
|
||||
@ -1918,7 +1930,11 @@ inheritance off, you very likely want to turn this option on.
|
||||
|
||||
As a special case, if the tag search is restricted to TODO items, the
|
||||
value of this variable is ignored and sublevels are always checked, to
|
||||
make sure all corresponding TODO items find their way into the list."
|
||||
make sure all corresponding TODO items find their way into the list.
|
||||
|
||||
This variable is semi-obsolete and probably should always be true. It
|
||||
is better to limit inheritance to certain tags using the variables
|
||||
`org-use-tag-inheritanc'e and `org-tags-exclude-from-inheritance'."
|
||||
:group 'org-tags
|
||||
:type 'boolean)
|
||||
|
||||
@ -9101,15 +9117,22 @@ only lines with a TODO keyword are included in the output."
|
||||
(defun org-remove-uniherited-tags (tags)
|
||||
"Remove all tags that are not inherited from the list TAGS."
|
||||
(cond
|
||||
((eq org-use-tag-inheritance t) tags)
|
||||
((eq org-use-tag-inheritance t)
|
||||
(if org-tags-exclude-from-inheritance
|
||||
(org-delete-all org-tags-exclude-from-inheritance tags)
|
||||
tags))
|
||||
((not org-use-tag-inheritance) nil)
|
||||
((stringp org-use-tag-inheritance)
|
||||
(delq nil (mapcar
|
||||
(lambda (x) (if (string-match org-use-tag-inheritance x) x nil))
|
||||
(lambda (x)
|
||||
(if (and (string-match org-use-tag-inheritance x)
|
||||
(not (member x org-tags-exclude-from-inheritance)))
|
||||
x nil))
|
||||
tags)))
|
||||
((listp org-use-tag-inheritance)
|
||||
(delq nil (mapcar
|
||||
(lambda (x) (if (member x org-use-tag-inheritance) x nil))
|
||||
(lambda (x)
|
||||
(if (member x org-use-tag-inheritance) x nil))
|
||||
tags)))))
|
||||
|
||||
(defvar todo-only) ;; dynamically scoped
|
||||
|
Loading…
Reference in New Issue
Block a user