1 #+TITLE: org-annotation-helper.el: using org-mode as a bookmark manager, a knowledge base, a research tool and more!
2 #+OPTIONS: ^:{} author:nil
5 # This file is released by its authors and contributors under the GNU
6 # Free Documentation license v1.3 or later, code examples are released
7 # under the GNU General Public License v3 or later.
9 We want to be able to pass a URL, a document title and a selected
10 region directly from a web browser to a running instance of Emacs.
14 You select a region on a web page, click a bookmarklet and a link to
15 the web page, page title and selected region is saved in a designated
22 We define a remember:// url handler in the browser and use a shell
23 script to handle the protocol. This script passes the information to
24 a running Emacs process (using =emacsclient= or =gnuclient=). We use
25 bookmarklets to create the =remember://= urls dynamicly.
27 The protocol types currently recognized are:
29 - remember:// :: start `remember' with the url and title filled in
30 - annotation:// :: similar to `planner-annotation-as-kill' (org?)
32 The urls used internally will have the following form:
34 =remember://<the web page url>::remember::<the title>::remember::<selection>=
36 The title will be url-hex-encoded.
40 #+begin_src javascript
41 javascript:location.href='remember://' + location.href + '::remember::' + escape(document.title) + '::remember::' + escape(window.getSelection())
44 #+begin_src javascript
45 javascript:location.href='annotation://' + location.href + '::remember::' + escape(document.title) ;;
50 #+begin_src shell-script
52 # org-annotation-helper -- pass a remember-url to emacs
54 # Author: Geert Kloosterman <g.j.kloosterman@gmail.com>
55 # Date: Sat Nov 19 22:33:18 2005
58 echo "$0: Error: no arguments given!" 1>&2
62 # To test uncomment following line
63 #echo $1 >> /tmp/remember.out
65 emacsclient --eval "(progn (bzg/org-annotation-helper \"$1\" ) nil)"
70 *** Install org-annotation-helper.el
72 Install this script and require it in your .emacs (or wherever you
75 #+begin_src emacs-lisp
76 (require 'org-annotation-helper)
79 *** Install the remember script
81 ***** Save the handler as a script, and make sure it is executable, i.e. remember
85 1. Make sure emacs is running and you have started its server
86 mode using (server-start) in .emacs or M-x server-start.
88 2. Run this command from the command line:
90 #+begin_src shell-script
91 $ remember 'remember://http%3A//orgmode.org/::remember::Org-Mode%20Homepage::remember::Notes'
94 3. Emacs should now show a remember window with a URL to remember.org
96 *** Add two bookmarklets
100 1. Right click on the bookmarks area of Firefox.
101 2. Select new bookmark.
102 3. In location fill the javascript code above (the bookmarklet)
103 4. Make sure "Load this bookmark in the sidebar is deselected
105 Try it. You should have now a url that starts with "remember://" and
106 your browser will not know what do to with it.
108 *** Add the handler for the "remember://" URI
112 To add a protocol handler (eg: remember://) in Firefox, take the
115 1. type in "about:config" in the location bar
116 2. right click, select New --> String
117 - the name should be "network.protocol-handler.app.remember"
118 - the value should be the executable, eg. "org-annotation-helper".
120 At least under Linux this does not need to be the full path to
123 See http://kb.mozillazine.org/Register_protocol for more details.
127 In Opera add the protocol in the Preferences->Advanced->Programs
130 *** Configure a template
132 I personally use the following template for this mode (all as one
136 ("Weblink" ?w "* %c\n :PROPERTIES:\n :CREATED: %U\n :END:\n - link: %:link\n - Quote:\n\n %?%:region\n\n - End Quote\n\n" "bookmarks.org" "WebLinks" )
139 - =%c= :: will be replaced with the hyperlink to the page, displaying the title of the page
140 - =%:link= :: will be replaced with the address of the page
141 - =%i= :: will be replaced with the selected text from the browser
142 - =%:region= :: will be replaced by the selected text from the web
143 page (special characters will be in hex-code.)
144 - =%U= :: will be replaced by the current date
145 - =%?= :: the cursor will be placed here (you may also replace this
146 escape with =%&= to make it completely non-interactive.)
148 By default the new remember notes are placed in the bookmarks.org
149 file under the "Web links" section, but it can be easily overriden