1 #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck lognotestate
3 #+TITLE: org-favtable.el --- Lookup table of favorite references and links
4 #+AUTHOR: Marc-Oliver Ihm
5 #+EMAIL: org-favtable@ferntreffer.de
7 #+CATEGORY: worg-tutorial
9 * Introduction and Overview
11 org-favtable helps you to create and update a table of favorite locations
12 in org, keeping the most frequently visited lines right at the top. This
13 table is called "favtable".
15 Or, citing from its documentation:
19 Mark and find your favorite things and locations in org easily: Create
20 and update a lookup table of references and links. Often used entries
21 bubble to the top and entering some keywords narrows down to matching
22 entries only, so that the right one can be spotted easily.
24 References are essentially small numbers (e.g. "R237" or "-455-"),
25 which are created by this package; they are well suited to be used
26 outside of org. Links are just normal org-mode links.
30 org-favtable helps to find a selected set of locations in org and other
31 things very quickly; you may see it as your private, adaptive index or
32 search engine; inside and outside of org.
34 * Three scenarios of typical usage
36 See also [[id:7ab63909-1f2a-4131-ae5c-f30a53f840c9][A working example]] for complete examples, that you can readily try out.
38 ** Taking notes in a meeting
40 Lets say, you have a meeting for a project for which you already have a
41 node in org-mode. Now as the meeting starts, you want to go to that
42 node, open it an start taking notes. However, the process of going to
43 that node takes to long for your taste and you want to accelerate it.
45 For this, use org-favtable and create a line for this meeting in your
46 table of favorites. This line contains a link to the node, where you want
47 to take your meeting-notes and additionally some keywords that you
48 associate with this meeting (e.g. its name).
50 Next time, that you want to find this node, simply:
52 - Invoke org-favtable with a keystroke (typically "C-+") and choose the
53 command "occur" (see [[id:940a8103-55a1-4d72-9d56-6ee6851c46ec][The commands of org-favtable]] for a list of
54 commands and their description).
55 - Type one or more keyword, specific for the project.
56 - From the list of results, choose the entry you are looking for.
57 - Remark: Your entry will probably appear at the top of the list,
58 because this list is sorted by frequency of usage.
59 - Type RET to go to this entry and start taking notes.
61 This procedure is always the same, regardless of where in org-mode you
62 have stored your notes.
64 ** Finding the right folder for incoming mail
66 This assumes that, in your mail program, you have created folders for
67 your favorite projects. An example would be an email folder for a
68 project "R624 Moving to a new internet provider". "R624" in this example
69 is a reference; see [[id:da8b6a60-5b02-4fa6-81de-8a3d9dee0267][References]] for an explanation.
71 Now, when a new mail arrives for this project, you may follow these
72 steps to find the correct folder:
74 - Invoke org-favtable with a keystroke (typically "C-+") and choose the
76 - Type a keyword (e.g. "internet").
77 - From the list of results, it is easy to spot the right reference
78 ("R624"); more frequent used entries appear at the top.
79 - With this reference it is easy to find the associated folder within
82 This works, because references, like "R624", can easily be used within
83 the names of email-folders.
85 ** Marking printed documents with references
87 By paper mail or in a meeting you receive a printed document, that you
88 want to keep, associate with a certain project and keep around for
89 later. You could proceed like this:
91 - Invoke org-favtable with a keystroke (typically "C-+") and choose the
92 command "ref", which gives you a new reference (e.g. "R237"). Type
93 some keywords into this new line within your table of favorites.
94 - If you want, you may also record the location, where you keep the document.
95 - Take a pen and write down this reference onto the printed document.
97 Some day later, you might want to read the document again and wonder,
98 where you have kept it:
100 - Invoke org-favtable and choose the command "occur".
101 - Enter some keywords for this document; they should overlap with
102 those, that you enterd when creating the line within the favtable.
103 - You see the matching lines from your favtable, pick the right one and
104 read the location information, that you recorded initially.
106 Later again, you might find this document in one of your desk drawers
107 and ask yourself, which project it is be associated with. For an answer,
108 you just need the handwritten reference from the document (e.g. "R237"):
110 - Invoke org-favtable and choose the command "goto".
111 - Enter the reference number "237".
112 - This brings you to the matching line within your favtable, where you
113 can read, what you have entered previously.
114 - Typing RET brings you to the org-mode node linked to the document or
117 This shows, how org-favtable might help to bridge the gap between
118 org-mode and the paper-world.
120 * Some concepts of org-favtable
123 :ID: da8b6a60-5b02-4fa6-81de-8a3d9dee0267
126 References (as used within org-favtable) are small numbers with
127 decorations; examples are "R237", "-455-" or "<<323>>". You are free, to
128 choose the text before or after the number; org-favtable inspects the
129 already existing references and creates new references along the same
130 lines. So the next reference after "R237" would be "R238".
132 References are meant to be easy to type, to write down and remember; you
133 can use them everywhere (not only within org !), where you want to refer
134 to a line within your table of favorites. In the favtable more
135 information can be stored, including links to org-mode nodes.
137 ** The table of favorites
139 The table of favorites (or "favtable" for short) keeps all your
140 references and links. It counts, how often they have been
141 used. Additionally it also records the date of creation and last
142 access. Moreover it is highly useful to keep some description or a set
143 of keywords within your table of favorites, which can then be searched
144 with the command "occur".
146 See the comand "help" for more information on how the table can be
147 constructed or see the example below: [[id:62e632e9-38ff-4210-acd5-133d7b13db07][A working example]].
149 Here is the actual table from this example:
153 | | Type | description | Keywords | | | | |
154 | Ref | | ;c | | count;s | link | created | last-accessed |
155 | | | | | | <4> | | |
156 |-----+---------+----------------+----------------+---------+------+-----------------+-----------------------|
157 | R2 | project | bar | support, legal | 8 | | [2012-12-07 Fr] | [2013-03-16 Sa 10:24] |
158 | R3 | paper | printed report | | 3 | | [2012-12-04 Di] | [2013-03-15 Fr 22:07] |
159 | R5 | project | baz | financial | 5 | | [2012-12-05 Mi] | [2012-12-08 Sa 23:03] |
160 | R6 | project | qux | sport | 3 | | [2012-12-08 Sa] | [2012-12-08 Sa 23:01] |
161 | R1 | project | foo | support | 3 | | [2012-12-03 Mo] | [2013-03-15 Fr 19:26] |
162 | R4 | folder | directory | | 2 | | [2012-12-08 Sa] | [2012-12-08 Sa 23:04] |
168 org-favtable also supports links, which are just normal org-mode links as
169 described in the documentation of org-mode.
171 * Installation and setup
173 :ID: 8ac78731-6c7d-432e-901f-741a804236b6
176 Please note, that the working example below brings its own, non-permanent
177 setup instructions: [[id:579ca3fc-1b42-4f0b-adde-e52f8d495fe0][Setting up things for this example]]
179 But, if you want to install org-favtable permanently, please read on.
181 Instructions on how to install org-favtable and how to setup things are
182 also in org-favtable.el itself. They can either be accessed through the
183 documentation of the variable org-favtable-id or through the command
184 "help" of org-favtable.
188 org-favtable can be found on worg:
190 http://orgmode.org/worg/code/elisp/org-favtable.el
192 You should put it into one of your directories of your load-path.
194 ** Modifying your .emacs
196 Citing from org-favtables own documentation:
200 Here are the lines, you need to add to your .emacs:
202 (require 'org-favtable)
204 ;; Good enough to start, but later you should probably
205 ;; change this id, as will be explained below !
206 (setq org-favtable-id "00e26bef-1929-4110-b8b4-7eb9c9ab1fd4")
209 ;; Optionally assign a key. Pick your own favorite.
210 (global-set-key (kbd "C-+") 'org-favtable)
212 Do not forget to restart emacs to make these lines effective.
216 As described in the elisp-comments above, you should set org-favtable-id
217 to a value, that links to the node with your table of
218 favorites. However, if you just copy the table from this documentation
219 without changing anything, things will just work fine; its more or less
220 a question of personal taste.
222 ** Creating your own table of favorites
224 The cited documentation below is quite detailed; for a starting however,
225 you do not need to read it in full extend. Simply copying the node with
226 the table is probably enough.
230 As a second step you need to create the org-mode node, where your
231 reference numbers and links will be stored. It may look like
236 :ID: 00e26bef-1929-4110-b8b4-7eb9c9ab1fd4
240 | | | Comment, description, details | | | |
241 | ref | link | ;c | count;s | created | last-accessed |
242 | | <4> | <30> | | | |
243 |-----+------+-------------------------------+---------+---------+---------------|
244 | R1 | | My first reference | | | |
247 You may just copy this node into one of your org-files. Many
248 things however can or should be adjusted:
250 - The node needs not be a top level node.
252 - Its name is completely at you choice. The node is found
255 - There are three lines of headings above the first hline. The
256 first one is ignored by org-favtable, and you can use them to
257 give meaningful names to columns; the second line contains
258 configuration information for org-favtable; please read
259 further below for its format. The third line is optional and
260 may contain width-informations (e.g. <30>) only.
262 - The sequence of columns does not matter. You may reorder them
263 any way you like; e.g. make the comment-column the last
264 columns within the table. Columns ar found by their name,
265 which appears in the second heading-line.
267 - You can add further columns or even remove the
268 "Comment"-column. All other columns from the
269 example (e.g. "ref", "link", "count", "created" and
270 "last-accessed") are required.
272 - Your references need not start at "R1"; However, having an
273 initial row is required (it serves as a template for subsequent
276 - Your reference need not have the form "R1"; you may just as
277 well choose any text, that contains a single number,
278 e.g. "reference-{1}" or "#7" or "++17++" or "-344-". The
279 function `org-favtable' will inspect your first reference and
280 create all subsequent references in the same way.
282 - You may want to change the ID-Property of the node above and
283 create a new one, which is unique (and not just a copy of
284 mine). You need to change it in the lines copied to your .emacs
285 too. However, this is not strictly required to make things
286 work, so you may do this later, after trying out this package.
289 Optionally you may tweak the second header line to adjust
290 `org-favtable' a bit. In the example above it looks like this
291 (with spaces collapsed):
294 | ref | link | ;c | count;s | created | last-accessed |
297 The different fields have different meanings:
299 - ref : This denotes the column which contains you references
301 - link : Column for org-mode links, which can be used to access
302 locations within your files.
304 - ;c : The flag "c" ("c" for "copy") denotes this column
305 as the one beeing copied on command "leave". In the example
306 above, it is also the comment-column.
308 - count;s : this is the column which counts, how many time this
309 line has been accessed (which is the key-feature of this
310 package). The flag "s" stands for "sort", so the table is
311 sorted after this column. You may also sort after columns
312 "ref" or "last-accessed".
314 - created : Date when this line was created.
316 - last-accessed : Date and time, when this line was last accessed.
319 After this two-step setup process you may invoke `org-favtable'
320 to create a new favorite. Read the help option "usage" for
321 instructions on normal usage, read the help option "commands"
322 for help on single commands.
328 :ID: 7ab63909-1f2a-4131-ae5c-f30a53f840c9
331 This node contains a simple setup, which can be used to explore
332 org-favtable. Further below there is also [[id:848c6d2a-6e8b-4c93-8481-19e6db7e6ca8][A sample table of favorites]].
334 These examples revolve around the few most common usecases and only
335 employ a very limited set of commands (mainly "occur" and "ref"). Below
336 at [[id:940a8103-55a1-4d72-9d56-6ee6851c46ec][The commands of org-favtable]] you will find much more commands
337 (e.g. "sort" or "highlight") that become quite helpful, once you have
338 mastered the basic functionality.
340 ** Setting up things for this example
342 :ID: 579ca3fc-1b42-4f0b-adde-e52f8d495fe0
345 To really try out the things described here, you need to go through some
346 minimal preperations: Open two files in your browser, copy-and-paste
347 them into emacs and execute two lines of elisp-code.
349 These instructions are non-permanent; after your next emacs restart you
350 wont be able to use org-favtable. To install it persistently follow
351 these slightly different instructions: [[id:8ac78731-6c7d-432e-901f-741a804236b6][Installation and setup]]
353 *** Get org-favtable.org
355 Read this text within org-mode in emacs; reading in a browser is still
356 instructive but does not give you the full hands-on experience. So, if
357 you are reading the browser-version of org-favtable.org, open:
359 http://orgmode.org/worg/org-contrib/org-favtable.org
361 in your browser. Mark the whole page and copy-and-paste it into your
362 emacs: Create a new buffer "org-favtable.org", do "M-x org-mode" and
363 paste. Continue reading within this new emacs-buffer.
365 *** Get org-favtable-el
369 http://orgmode.org/worg/code/elisp/org-favtable.el
371 in your browser. Mark the whole page and copy-and-paste it into your
372 emacs: Create a new buffer "org-favtable.el", do "M-x emacs-lisp-mode"
375 To make emacs read and evaluate the the elisp-code you need to "M-x
376 eval-buffer" within the new buffer.
380 Finally, you have to execute two lines of elisp: place your cursor at
381 the end of each line and type "C-x C-e" (which runs "eval-last-sexp").
385 (setq org-favtable-id "848c6d2a-6e8b-4c93-8481-19e6db7e6ca8")
386 (global-set-key (kbd "C-+") 'org-favtable)
390 ** First example: Finding a node by its name
392 Say, your are in a meeting about project "bar" and want to take
393 notes. For this you need to visit the node for project "bar".
395 Type "C-+" to invoke org-favtable and then type "bar" and RET.
396 This is what you will see:
400 | R2 | project | bar | support, legal | 8 | | [2012-12-07 Fr] | [2012-12-08 Sa 23:37] |
404 Just place your cursor at this line in the occur/buffer and type RET to
407 Remark: even though the initial prompt of org-favtable offers only a
408 fixed set of choices, you may just as well type something else
409 (e.g. "bar") to implicitly accept the first choice (here: "occur").
411 ** Secound example: Finding a node by keyword
413 Later you want to take some notes for project "bar" but do not recall
414 its name. However, you know that the project is related with "support".
416 So you type "C-+" to invoke org-favtable. Then type "support" and RET.
418 After this you will see these two lines (R2 and R1) from your favtable,
419 which contain the keyword "support":
423 | R2 | project | bar | support, legal | 8 | | [2012-12-07 Fr] | [2012-12-08 Sa 23:37] |
424 | R1 | project | foo | support | 3 | | [2012-12-03 Mo] | |
428 The first line "R2" is the one with the highest access count (8),
429 because the table is kept sorted for this. And this is already your
430 project "bar". Now just need to hit RET, to visit this node.
432 ** Third example: Find the right folder for an incoming mail
434 This example assumes, that within your email-client you have organised
435 messages in folders, the names of which start with a reference, e.g. "R2
438 Compared to the straightforward approach of naming the folder just
439 "bar", the overhead related with including the reference within the name
440 allows you to use org-favtable as your search-engine for email-folders.
442 This is especially helpful, if you have dozens or even hundreds of
443 folders, too many to spot the right one easily.
445 Now you get an email related to project "bar" and want to put it into
448 So you type "C-+" to invoke org-favtable and then "bar" and RET.
450 Just as in the first example, this is what you get:
454 | R2 | project | bar | support, legal | 8 | | [2012-12-07 Fr] | [2012-12-08 Sa 23:37] |
458 From this line you can easily spot the reference "R2" and can find the
459 right folder in your email-client.
461 ** Fourth example: Create a new reference for a new piece of paper
463 In a meeting, you get handed over a printout; a discussion starts and
464 you want to keep track of it. And within your org-mode notes you want to
465 refer to the printout, that is the focus of the discussion.
467 For this you can create a new reference: Type "C-+" to invoke
468 org-favtable and then "ref" and RET.
470 This will create a new row within your table of favorites with a new
471 reference already filled in (if you try it out yourself, it will
472 probably be "R7"). Now, you can fill out the other columns, especially
473 description and keyboard.
475 The new reference (e.g. "R7") can be written onto the printout, so that
476 later on (see the next example) you will be able to look it up.
478 Once you are done, leave the favtable by typing "C-+" and "leave" RET.
480 Remark: The closely related example below assumes reference "R3"; it is
481 just as good as "R7".
483 ** Fifth example: Looking up a reference you find on a piece of paper
485 Lets assume, that in one of your drawers you find a lengthy printout. On
486 its cover page you spot the handwritten reference "R3".
488 Remark: If you worked throught the example above, you have created a new
489 reference "R7"; it is just as good as "R3".
491 First you would like to know the date, when you received this
492 document. For this, simply type "C-+", then "3" and RET.
494 As a result you will see something similar to the lines below:
498 4 matches total for "\bRiii\b":
499 4 matches in buffer: org-favtable.org
500 330: page you one of your handwritten references: "Riii".
501 345: Which is a multi-occur for reference Riii.
502 352: - [ ] Read paper Riii
503 377: | Riii | paper | printed report | | 8 | | [2012-12-04 Di] | [2013-03-15 Fr 22:07] |
507 Which is a multi-occur for reference "R3".
509 Please note, that in the cited example output above, the reference "R3"
510 has been replaced with "Riii". This avoids, that this citation itself
511 appears in your output again, if you try yourself.
513 The output tells you, where in all your org-mode files, you have used
514 reference "R3"; that way it should be easy, to find your org-mode notes
515 about this paper. The list also includes the matching line from your
516 favtable, which tells you, when this reference has once been created.
520 The subnodes below are made up to be used within the examples
521 above. Their contents is therefore fictous.
523 *** TODO R1 Project foo
527 *** TODO R2 Project bar
531 *** DONE R5 Project baz
532 CLOSED: [2012-12-08 Sa 23:01]
534 - [X] Clean up directory R4
536 *** TODO R6 Project qux
538 - [ ] Clean running shoes
540 ** A sample table of favorites
542 :ID: 848c6d2a-6e8b-4c93-8481-19e6db7e6ca8
547 | | Type | description | Keywords | | | | |
548 | Ref | | ;c | | count;s | link | created | last-accessed |
549 | | | | | | <4> | | |
550 |-----+---------+----------------+----------------+---------+------+-----------------+-----------------------|
551 | R2 | project | bar | support, legal | 8 | | [2012-12-07 Fr] | [2013-03-16 Sa 10:24] |
552 | R5 | project | baz | financial | 5 | | [2012-12-05 Mi] | [2012-12-08 Sa 23:03] |
553 | R6 | project | qux | sport | 3 | | [2012-12-08 Sa] | [2012-12-08 Sa 23:01] |
554 | R3 | paper | printed report | | 3 | | [2012-12-04 Di] | [2013-03-15 Fr 22:07] |
555 | R1 | project | foo | support | 3 | | [2012-12-03 Mo] | [2013-03-15 Fr 19:26] |
556 | R4 | folder | directory | | 2 | | [2012-12-08 Sa] | [2012-12-08 Sa 23:04] |
560 * The commands of org-favtable
562 :ID: 940a8103-55a1-4d72-9d56-6ee6851c46ec
565 When you invoke org-favtable, it prompts you to choose one from a fixed
570 occur: If you supply a keyword (text): Apply emacs standard
571 occur operation on the table of favorites; ask for a
572 string (keyword) to select lines. Occur will only show you
573 lines which contain the given keyword, so you can easily find
574 the right one. You may supply a list of words seperated by
575 comma (\",\"), to select lines that contain any or all of the
578 If you supply a reference number: Apply emacs standard
579 multi-occur operation all org-mode buffers to search for a
582 You may also read the note at the end of this help on saving
583 the keystroke RET to accept this frequent default command.
585 head: If invoked outside the table of favorites, ask for a
586 reference number and search for a heading containing it. If
587 invoked within favtable dont ask; rather use the reference or
588 link from the current line.
590 ref: Create a new reference, copy any previously selected text.
591 If already within reftable, fill in ref-column.
593 link: Create a new line in reftable with a link to the current node.
594 Do not populate the ref column; this can later be populated by
595 calling the \"fill\" command from within the reftable.
597 leave: Leave the table of favorites. If the last command has
598 been \"ref\", the new reference is copied and ready to yank.
599 This \"org-mark-ring-goto\" and can be called several times
602 enter: Just enter the node with the table of favorites.
604 goto: Search for a specific reference within the table of
607 help: Show this list of commands.
609 +: Show all commands including the less frequently used ones
610 given below. If \"+\" is followd by enough letters of such a
611 command (e.g. \"+fi\"), then this command is invoked
614 reorder: Temporarily reorder the table of favorites, e.g. by
615 count, reference or last access.
617 fill: If either ref or link is missing, fill it.
619 sort: Sort a set of lines (either the active region or the
620 whole buffer) by the references found in each line.
622 update: For the given reference, update the line in the
625 highlight: Highlight references in region or buffer.
627 unhighlight: Remove highlights.
629 missing : Search for missing reference numbers (which do not
630 appear in the reference table). If requested, add additional
631 lines for them, so that the command \"new\" is able to reuse
634 statistics : Show some statistics (e.g. minimum and maximum
635 reference) about favtable.
639 Please note, that you are not required to explicitly choose one. Simply
640 typing something else (e.g. "237") accepts the default-command and
641 supplies your input as an argument.
643 * Further Reading, Version, Contact
645 org-favtable.el itself contains embedded documentation, which can be
646 easily accessed through the command "help". Most, but not all of it has
647 already been cited within this document.
650 As of [2013-03-17 So] this document describes version 2.2 of org-favtable.
653 Remaining questions can be directed to:
655 org-favtable@ferntreffer.de
657 I would be glad to help.