Add example of globally setting exclusive tag groups.

The original suggestion and patch was from Bernt Hansen.
This commit is contained in:
Philip Rooke 2008-04-01 08:39:36 +01:00 committed by Carsten Dominik
parent f8dac11bcd
commit aef3cb85d4
1 changed files with 34 additions and 17 deletions

View File

@ -3288,44 +3288,61 @@ in a specific file, add an empty TAGS option line to that file:
#+TAGS: #+TAGS:
@end example @end example
The default support method for entering tags is minibuffer completion. By default Org mode uses the standard minibuffer completion facilities for
However, Org mode also implements a much better method: @emph{fast tag entering tags. However, it also implements another, quicker, tag completion
selection}. This method allows to select and deselect tags with a method called @emph{fast tag selection}. This allows you to select and
single key per tag. To function efficiently, you should assign unique deselect tags with just a single key press. For this to work well you should
keys to most tags. This can be done globally with assign unique letters to most of your commonly used tags. You can do this
globally by configuring the variable @code{org-tag-alist} in your
@file{.emacs} file. For example, you may find the need to tag many items in
different files with @samp{:@@home:}. In this case you can set something
like:
@lisp @lisp
(setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l))) (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
@end lisp @end lisp
@noindent or on a per-file basis with @noindent If the tag is only relevant to the file you are working on then you
can, instead, set the TAGS option line as:
@example @example
#+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p) #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
@end example @end example
@noindent @noindent
You can also group together tags that are mutually exclusive. With You can also group together tags that are mutually exclusive. By using
curly braces@footnote{In @code{org-mode-alist} use braces, as in:
@code{'(:startgroup)} and @code{'(:endgroup)}, respectively. Several
groups are allowed.}
@example @example
#+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p) #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
@end example @end example
@noindent you indicate that at most one of @samp{@@work}, @samp{@@home}, @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
and @samp{@@tennisclub} should be selected. and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
@noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
these lines to activate any changes. these lines to activate any changes.
If at least one tag has a selection key, pressing @kbd{C-c C-c} will @noindent
automatically present you with a special interface, listing inherited To set these mutually exclusive groups in the variable @code{org-mode-alist}
tags, the tags of the current headline, and a list of all valid tags you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
with corresponding keys@footnote{Keys will automatically be assigned to of the braces. The previous example would be set globally by the following
tags which have no configured keys.}. In this interface, you can use configuration:
the following keys:
@lisp
(setq org-tag-alist '((:startgroup . nil)
("@@work" . ?w) ("@@home" . ?h)
("@@tennisclub" . ?t)
(:endgroup . nil)
("laptop" . ?l) ("pc" . ?p)))
@end lisp
If at least one tag has a selection key then pressing @kbd{C-c C-c} will
automatically present you with a special interface, listing inherited tags,
the tags of the current headline, and a list of all valid tags with
corresponding keys@footnote{Keys will automatically be assigned to tags which
have no configured keys.}. In this interface, you can use the following
keys:
@table @kbd @table @kbd
@item a-z... @item a-z...