By Conrad Barski, M.D. LISPERATI.COM _______________________________________________ |
Do you think _everything_ can be organized by tagging? Now you can harness the power of del.icio.us-style tagging to organize your notes/programs/whatever directly from EMACS using my nifty new EMACS mode! |
_______________________________________________ If you're not familiar with the new tagging craze, your missing out on one of the most fundamental new inventions in the last couple of years! The idea is simple: Often, it can be difficult to decide how to store a certain snippet of data that one has collected. In most computer systems for organizing data, the user is forced to organize all data into some kind of directory tree or store it based on an appropriate category for every chunk of data. A tagging system uses a far simpler, more intuitive and, surprisingly, a far more powerful method for organizing your data: After you have entered the data, just free-associate a bunch of categories that remind you of the data- You can use as many categories as you like. (Note- This implementation of tagging requires all data reside in a single data file- An implementation that works with data in multiple files would be difficult to develop- I'd love to hear from you if you know of a simple way of handling such a design in EMACS...) Because of the way the human mind works, it is uncannily easy for humans to remember a majority of the tags that were chosen for the data, even after months or years. In a tagging system, you can slice and dice your data based on tags and can organize your data in a way that accomplishes the impossible: Once your data goes into the system, it almost _never_ gets lost. Well, that's the basic theory behind tags, and it really works out in practice for many of us tag junkies! (These instructions assume some basic proficiency in EMACS- If you are new to this funky text editor, try reading a tutorial first!) First, download the file tagging.el to your computer and place it somewhere where EMACS can "see" it. Next, add the following line to your .emacs file: Restart EMACS and... Congratulations! You now have Tagging-Mode installed into your EMACS editor! To use tagging mode, Create a new buffer in EMACS and type M-x tagging-mode [ENTER]. (FYI- EMACSers like to say "M" for the [ALT] key and "C" for the [Control] key...) This will place the current buffer into Tagging Major Mode. (If you create a file with the extension ".tagged", the file will automatically start in Tagging Mode.) Create a few notes with tags on top of them: *todo groceries milk, soup, coffee *todo chores laundry wash car vacuuming *todo groceries pets dog food, vitamins *chores pets this_week grooming on friday 343 N 2nd Street Store Note that every tagged chunk of data has a line on top of it that begins with an asterisk (*) that has a list of space-delimited tags in it. Tags are allowed to contain lower/uppercase letters, numbers and the underline (_) character. No other characters are permitted. Now... suppose you want to see a list of all entries involving "pets"- Simply type: C-c, C-t pets This hide all notes that aren't tagged with "pets": *todo groceries pets dog food, vitamins *chores pets this_week grooming on friday 343 N 2nd Street Store If, instead, you want to see a list of all your "todos", simply type: C-c, C-t todo This hide all notes that aren't tagged with "todo": *todo groceries milk, soup, coffee *todo chores laundry wash car vacuuming *todo groceries pets dog food, vitamins To filter the data even more, move your buffer point somewhere over the word "groceries". Next, type the following: C-c, C-s [Enter] This command is the command for adding the word at the buffer point as an additional filter (you can also simply type in an additional filter before hitting the [Enter] key, instead). You should now see only the notes that are tagged with both "todo" AND with "groceries": *todo groceries milk, soup, coffee *todo groceries pets dog food, vitamins Similarly, you can remove a tag from the filter by moving the buffer point over a word and typing: C-c, C-d [Enter] If you wish to stop the filtering and see ALL notes again, simply type: C-c, C-a [Enter] You have now learned how to use Tagging-Mode! ORGANIZING PROGRAMMING LIBRARIES WITH TAGS Often, programmers have large libraries of functions that they commonly need to re-use throughout several projects. It can sometimes become difficult to know if a library routine already exists to perform a certain task. Because of this, I have also created a Minor Mode for tagging that you can use to organize your source code in most programming languages- Heres How: First you'll want to override the indicator for a tagging line in your language. If you use JAVA, C++, or C#, add the following line to the bottom of your .emacs file: (setq tagging-tagline-indicator "^//\\*") Next, type M-x tagging-minor-mode. This will allow you to write tag lines that begin with "//*", so you can write things like: //*math trigonometry class fast_sine_calculator{ ...} //*string caps_changing class caps_changer{ ...} Then, if you want to see all you "math" routines, "string" routines, etc. you can easily hunt them down in your library by using the filtering feature! For lisp-like language (EMACS Lisp, Common Lisp, Scheme, etc.) use the following tagline indicator: (setq tagging-tagline-indicator "^;;\\*") Now you can use a remark beginning with ";;*" to do the same in Lisp. Anyway, I hope you all enjoy this very simple but useful new emacs mode- Any feedback is welcomed! |