From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ross Patterson Subject: Re: org-browse-url.el: Bookmark from a browser into org links Date: Sat, 22 Nov 2008 23:26:48 -0800 Message-ID: <878wrax5qf.fsf@transitory.lefae.org> References: <87d4gmx6je.fsf@transitory.lefae.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L49Mw-0002NT-Hz for emacs-orgmode@gnu.org; Sun, 23 Nov 2008 02:26:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L49Mu-0002Kj-Fv for emacs-orgmode@gnu.org; Sun, 23 Nov 2008 02:26:57 -0500 Received: from [199.232.76.173] (port=35086 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L49Mu-0002Ke-B2 for emacs-orgmode@gnu.org; Sun, 23 Nov 2008 02:26:56 -0500 Received: from main.gmane.org ([80.91.229.2]:54078 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L49Mt-0001d1-LQ for emacs-orgmode@gnu.org; Sun, 23 Nov 2008 02:26:56 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1L49Mr-0002Uw-UK for emacs-orgmode@gnu.org; Sun, 23 Nov 2008 07:26:54 +0000 Received: from rpatterson.net ([69.12.174.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Nov 2008 07:26:53 +0000 Received: from me by rpatterson.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Nov 2008 07:26:53 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Ross Patterson writes: > For some time now I've been wanting to put pages from FF into the org > stored links where the page title is used as the description. I ran > across org-annotation-helper.el but I don't use remember and didn't like > it's approach of automatically inserting the link somewhere or popping > up a buffer. > > I prefer the way org-mode handles links which allows me to collect links > while I'm there and then file them into my org buffers when I get back > to them. So I wrote the attached library to accomodate exactly this. > To use it, follow the instructions in the commentary. > > Enjoy! > Ross Always with forgetting the attachment. All this technology, and I still don't know how to use it. :) Ross --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-browse-url.el Content-Transfer-Encoding: quoted-printable ;;; org-browse-url.el --- Bookmark from a browser into org links ;; Author: Ross Patterson ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; ;; ;;; 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-browse-url) ;; ;; Step 2: Install the handler script ;; ;; * Save the following script to an appropriate place and make sure ;; it is executable: ;; ;; #!/bin/sh ;; # org-browse-url-store - Store URLs in the org links ring ;; emacsclient --eval "(let ((org-browse-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-browse-url-store \ ;; 'org-browse-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-browse-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=3D'org-browse-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-browse-url-store-link () "Store a browser URL as an org link from the bookmarklet" (if (boundp 'org-browse-url-args) (let* ((stored (url-generic-parse-url org-browse-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-browse-url-store-link) (provide 'org-browse-url) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--