The best way to correlate cross-information is to label it. The org mode of Emacs is very powerful in supporting tags.
Each title can contain a list of tags at the end. Labels consist of letters, numbers, ' _ ' and ' @ '. There must be a colon before and after the label, such as ': work: ' . You can also declare multiple tags like ': work:urgent: ' . The label is bold by default and has the same color as the title. You can specify a different style for a specific label by Org-tag-face .
Tag inheritance
tags use the same inheritance structure as headings. If a title has a label, all sub-headings of the title have this tag. As shown in the following list:
* Meeting and the French group:work: * * Summary by Frank : boss:notes: * * * TODO Prepare slides for him:action:
Although the final title does not declare any tags, but through inheritance, still own these tags ': work: ', ': Boss: ', ': Notes: ', ': Action: '. You can also set a common parent tag for all headings with a label that surrounds the entire file with the highest level. As shown below:
#+filetags::P Eter:Boss:Secret:
In addition, you can set the label by Org-tags-exclude-from-inheritance if it cannot be inherited from a specific label. To completely turn off tag inheritance, use org-use-tag-inheritance
If you turn on tag inheritance, when you do a label search, if you match a heading, all the headings under the heading tree will match. The list you are searching for can be very long. If you just want to see the first title that matches, you need to configure Org-tags-match-list-sublevels.
Tag inheritance makes sense when you search for an agenda through tags, whether in tags or on the Tags-todo agenda. In other types of agendas, org-use-tag-inheritance does not work. However, you may want tag inheritance to be set correctly on the agenda so that it can be filtered by tags. Setting org-agenda-use-tag-inheritance can control this feature: The default value includes all agenda types, but setting this variable to nil can speed up the creation of the agenda to a great extent.
Set label
The
can enter a label directly at the end of the title. After you enter a colon, the m-tag provides automatic completion and selection of the label. There is also a specific shortcut key to insert the tag:
c-c c-q Org-set-tags-command
Enter a new label for the current caption. The ORG mode provides automatic completion or a specific single-key interface to set the label, depending on the instructions below. After you enter RET , the label is inserted for the current caption and is aligned to Org-tags-column . When you enter a c-u prefix, all the labels in the current buffer are aligned to this column, and the status of the TODO is changed (see [[Todo%20basics ][todo basis]]).
c-c c-c Org-set-tags-command
When the cursor is on the caption, the function and c-c c-q same
Org Supports inserting tags based on a list of tags. By default, this list is created dynamically, containing all the tags in the current buffer. You can also create a global label list by using the variable org-tag-alist . Finally, you can set the default label for a file in the following form:
#+tags: @work @home @tennisclus #+tags:laptop car pc sailboat
If you have defined your favorite global tags with org-tag-alist , but want to use dynamic tags in a specific file, you can do this by adding an empty tags option to this file:
#+tags
If you want to add a predefined global tag to each of the tags options for a file, you can define a list of tags with org-tag-persistent-alist . This option can be turned off by the STARTUP option in the file:
#+startup:noptag
By default, the Org mode uses standard Minibuffer to enter tags. However, Emacs also provides a quick Tag selection method called Fast tag selection . In this way, you can use only one key to complete the selection and inverse of the label. To use this method, you first assign a unique character to the label you use most often. This character can be in the '. Emacs' is set by configuring the org-tag-alist . For example, you need to add ': Home:' tags in many files for many items. In this case, you can set this:
(Setq org-tag-alist ' ("@work", "W") ("@home".? h) ("@laptop".? l)))
If the tag is only relevant to the file you are currently using, you can add the tags option to the file as follows:
#+tags: @work (w) @home (h) @tennisclub (t) laptop (L) PC (p)
The label interface displays the available tags in a splash windows. If you want to break a line after a particular label, you need to insert a '\ n' in the label list.
#+tags: @work (w) @home (h) @tennisclub (t) \ n Laptop (l) PC (p)
or write them in two lines.
#+tags: @work (w) @home (h) @tennisclub (t) #+tags:laptop (L) PC (p)
You can also manually group labels with large (curly) brackets as follows
#+tags: {@work (W) @home (h) @tennisclub (t)} laptop (l) PC (p)
In this case, @work (w) @home (h) @tennisclub (t) three tags select at most one
ORG allows multiple groupings.
When the cursor is on these lines, don't forget to press c-c c-c To activate the other changes.
If you want to set up an exclusive label group in Org-tags-alist , you will need to use : Startgroup and : endgroup tag pairs, not curly braces. Similarly, you can use : newline to declare a new row. The above example can also be set in the following way:
(Setq org-tag-alist ' ((: Startgroup. Nil) (" @work".? w) ("@home".? h) ( "@tennisclub".? t) (: Endgroup. Nil) ("Laptop".? l) ("PC".? p))
If you define a shortcut key for at least one label, a special interface is displayed when you press c-c c-c , which lists the tags that the current title has inherited, and an optional list of tags. This interface provides the following shortcut keys:
- a-z... The corresponding label is added to the current title list or removed from the current title list when you press these keys. When you select a specific, exclusive label group, other labels for the label group are removed.
- Tab Enter a label in the mini-buffer, even if the label is not in a predefined label list. Automatic completion is provided for the label within the buffer. Of course, you can add more than one label at a time, just by separating them with a colon ': '.
- spc Clears all labels for this row.
- ret confirm Modify
- c-g Cancel Modify
- q If/q/is not a shortcut to a label, the effect and *c-g* are the same.
- ! turns off the exclusive nature of the group. This allows you to assign multiple labels for a group.
- c-c after the next modification (see detailed instructions below), switch *auto-exit*. If it is in expert mode, the first *c-c* will provide a window.
In this way, only a few keys are needed to set the label on the caption. According to the above settings, clear out the current label and set the ' @home ', ' laptop ' and ' PC ' and several other tags, only need the following keys: c-c c-c SPC h L P RET . Switching from ' @home ' to ' @work ' requires only c-c c-c w RET or c-c c-c c-c w . To add a non-predefined label ' Sarah ', the key sequence is c-c c-c tab S A R a h RET ret .
If you find that most of the time you just need a key to modify the label list, you can set the org-fast-tag-select-single-key parameter. This way, you don't have to press ENTER to exit the Quick tag selection-it quits immediately at the first modification. If more than one key is required in an individual case, press c-c to select Close auto-exit for the current tab (actually c-c c-c c-c to start the selection instead of c-c c-c). If the value of this variable is set to expert then, in addition to pressing a c-c , the selection window does not appear at all when a single button is entered in the label.
Label Group
Within an exclusive label, the first label can be defined as a group label . When you search for a group label, all items that match any one of the tags in the group are returned. In the agenda view, when filtered through group labels, a title that contains at least one label within a group is displayed. This provides a lot of flexibility for label search and filtering.
Within a label group, you can set the group label by adding a colon between the group label and other labels-note that all the spaces cannot be saved so that the *org* can parse correctly. Like what:
#+tags: {@read: @read_book @read_ebook}
In this example, the @read is the group label for the tag collection @read @read_book @read_ebook.
You can also set the org-tag-alist directly by : grouptags keyword to set the group label, such as:
(Setq org-tag-alist ' ((: Startgroup. Nil) ( "@read". Nil) ( : Grouptags. Nil) (" @read_book". Nil) ("@ Read_ebook ". Nil) (: Endgroup. Nil))
Group labels cannot be nested and cannot be labels for other label groups.
If you want to temporarily ignore the group label, toggle variable org-toggle-tags-groups, the corresponding shortcut key c-c c-x Q . If you want to disable the label group completely, set org-group-tags to empty.
Label Search
Once the labeling system is set up, it is possible to collect information about the labels in a special list.
c-c/m or c-c \ \ Org-match-sparse-tree
Create a brief title tree that contains the labels for the search. YesC-uprefix, ignoring is notTODO's title bar.
c-c a MOrg-tags-view
Create a title list of the labels that match the search in all the agenda files. See also [[Matching tags and properties]
c-c a M Org-tags-view
Create a title list of the labels that match the search in all the agenda files, but only checkTODOItem and Force check sub-headings (seeOrg-tags-match-list-sublevels)。
These commands will prompt for a search string and allow common logical operations such as '+boss+urgent-project1' Will find contains 'bossandUrgent' But does not contain 'Project1' Title, another example 'kathy| Sally' Will find contains 'KathyOrSally' The title. The search string supports very many formats and allows you toTODOKeywords, title levels, attributes, and so on. [[Matching tags and properties]] There are a lot of examples and instructions.
The tags in emacs org mode are all reference