diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2008-12-08 08:22:24 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2008-12-08 13:53:19 +0100 |
commit | 0b9b7d7b58a928240d3f4d4ca427d5361020c892 (patch) | |
tree | c970d7246f115a385642ecb0b7ee4eecd792d9a3 | |
parent | 0216c9a27ce1d60b1cae8b651b503d2a3d51d49c (diff) | |
download | org-mode-0b9b7d7b58a928240d3f4d4ca427d5361020c892.tar.gz |
New file org-browser-url.el.
-rw-r--r-- | contrib/ChangeLog | 8 | ||||
-rw-r--r-- | contrib/README | 1 | ||||
-rw-r--r-- | contrib/lisp/org-browser-url.el | 89 |
3 files changed, 98 insertions, 0 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 261004c..3c8fb8e 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,11 @@ +2008-12-08 Carsten Dominik <carsten.dominik@gmail.com> + + * lisp/org-browser-url.el: New file. + + * lisp/org-registry.el (org-registry-before-first-heading-p): + Function renamed to `org-before-first-heading-p', and moved to + org.el. + 2008-09-20 James TD Smith <ahktenzero@mohorovi.cc> * lisp/org-checklist.el: New file. diff --git a/contrib/README b/contrib/README index d783864..27d0f2c 100644 --- a/contrib/README +++ b/contrib/README @@ -13,6 +13,7 @@ LISP (emacs-lisp code) org-annotate-file.el --- Annotate a file with org syntax org-annotation-helper.el --- Call remember directly from Firefox/Opera org-bookmark.el --- Links to bookmarks +org-browser-url.el --- Store links to webpages directly from Firefox/Opera org-depend.el --- TODO dependencies for Org-mode org-elisp-symbol.el --- Org links to emacs-lisp symbols org-eval.el --- The <lisp> tag, adapted from Muse diff --git a/contrib/lisp/org-browser-url.el b/contrib/lisp/org-browser-url.el new file mode 100644 index 0000000..478f373 --- /dev/null +++ b/contrib/lisp/org-browser-url.el @@ -0,0 +1,89 @@ +;;; org-browser-url.el --- Bookmark from a browser into org links
+
+;; Author: Ross Patterson <me@rpatterson.net>
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; Once a bookmarklet and a app handler are setup in your browser,
+;; the functions here support using the bookmarklet to add links to
+;; the org links ring.
+;;
+;; Much of this is taken from or modeled after
+;; org-annotation-helper.el
+;;
+;; Installation and Activation
+;; ---------------------------
+;;
+;; Step 1: Install this library on your path and enable it in your
+;; $HOME/.emacs:
+;;
+;; (require 'org-browser-url)
+;;
+;; Step 2: Install the handler script
+;;
+;; * Save the following script to an appropriate place and make sure
+;; it is executable:
+;;
+;; #!/bin/sh
+;; # org-browser-url-store - Store URLs in the org links ring
+;; emacsclient --eval "(let ((org-browser-url-args \"$*\"))\
+;; (call-interactively 'org-store-link))"
+;;
+;; * Make sure emacs is running with server mode started:
+;;
+;; (server-start)
+;;
+;; * Test the script from the command line
+;;
+;; $ org-browser-url-store \
+;; 'org-browser-url-store:///Link%20Description/http://foo.com'
+;;
+;; * Insert the link in an org-mode buffer with C-c C-l
+;;
+;; Step 3: Add the handler to your browser
+;;
+;; * For Firefox:
+;; - type in "about:config" in the location bar
+;; - right click, select "New", then "String"
+;; - enter the name:
+;; "network.protocol-handler.app.org-browser-url-store"
+;; - leave the value blank
+;;
+;; See http://kb.mozillazine.org/Register_protocol for more details.
+;;
+;; * For Opera add the protocol in the
+;; Preferences->Advanced->Programs dialog.
+;;
+;; Step 4: Add bookmarklet
+;;
+;; * Create a new bookmark with the following location:
+;;
+;; javascript:location.href='org-browser-url-store:///'+\
+;; escape(document.title)+'/'+location.href
+;;
+;; When you first use the bookmarklet, Firefox will prompt you for
+;; the script. Point it to the full path of the script.
+
+;;; Code:
+
+(require 'org)
+(require 'url)
+
+(defun org-browser-url-store-link ()
+ "Store a browser URL as an org link from the bookmarklet"
+ (if (boundp 'org-browser-url-args)
+ (let* ((stored (url-generic-parse-url org-browser-url-args))
+ (path (split-string (aref stored 6) "/"))
+ (parsed (url-generic-parse-url
+ (mapconcat 'identity (cddr path) "/")))
+ (type (aref parsed 1))
+ (link (aset parsed 7 (aref stored 7)))
+ (link (url-recreate-url parsed))
+ (description (url-unhex-string (nth 1 path))))
+ (org-store-link-props
+ :type type :link link :description description))))
+
+(add-hook 'org-store-link-functions 'org-browser-url-store-link)
+
+(provide 'org-browser-url)
\ No newline at end of file |