We want to be able to pass a URL, a document title and a selected region directly from a web browser to a running instance of Emacs.
You select a region on a web page, click a bookmarklet and a link to the web page, page title and selected region is saved in a designated Org file.
We define a remember:// url handler in the browser and use a shell
script to handle the protocol. This script passes the information to
a running Emacs process (using
gnuclient). We use
bookmarklets to create the
remember:// urls dynamicly.
The protocol types currently recognized are:
The urls used internally will have the following form:
remember://<the web page url>::remember::<the title>::remember::<selection>
The title will be url-hex-encoded.
#+begin_src shell-script #!/bin/sh # org-annotation-helper -- pass a remember-url to emacs # # Author: Geert Kloosterman # Date: Sat Nov 19 22:33:18 2005
if [ -z "$1" ]; then echo "$0: Error: no arguments given!" 1>&2 exit 1 fi
# To test uncomment following line #echo $1 >> /tmp/remember.out
emacsclient --eval "(progn (bzg/org-annotation-helper \"$1\" ) nil)" #+end_src
Install this script and require it in your .emacs (or wherever you want to do it).
#+begin_src emacs-lisp (require 'org-annotation-helper) #+end_src
#+begin_src shell-script $ remember 'remember://http%3A//orgmode.org/::remember::Org-Mode%20Homepage::remember::Notes' #+end_src
Try it. You should have now a url that starts with "remember://" and your browser will not know what do to with it.
To add a protocol handler (eg: remember://) in Firefox, take the following steps:
At least under Linux this does not need to be the full path to the executable.
See http://kb.mozillazine.org/Register_protocol for more details.
In Opera add the protocol in the Preferences->Advanced->Programs dialog.
I personally use the following template for this mode (all as one line):
#+begin_example ("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" ) #+end_example
By default the new remember notes are placed in the bookmarks.org file under the "Web links" section, but it can be easily overriden with C-u C-c C-c