emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* firefox urls
@ 2008-05-12 15:22 Richard G Riley
  2008-05-12 15:33 ` John Rakestraw
  0 siblings, 1 reply; 25+ messages in thread
From: Richard G Riley @ 2008-05-12 15:22 UTC (permalink / raw)
  To: org-mode


Are there any add-ons anything to yank urls from firefox/iceweasel
directly into a certain org-mode category?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-12 15:22 firefox urls Richard G Riley
@ 2008-05-12 15:33 ` John Rakestraw
  2008-05-14  4:12   ` Daniel M German
  0 siblings, 1 reply; 25+ messages in thread
From: John Rakestraw @ 2008-05-12 15:33 UTC (permalink / raw)
  To: emacs-orgmode

Richard G Riley <rileyrgdev@googlemail.com> wrote:

> Are there any add-ons anything to yank urls from firefox/iceweasel
> directly into a certain org-mode category?

ouch. Your query reminds me that I promised long ago to write up my use
of some code that Bastien adapted from a planner-mode extension. I'm in
the midst of end-of-the-semester woes here (though I finally finished
grading my finals late last night!), but here's a quick cut-and-paste
of that code. It works very well for me.

First, here's the template I use (apologies for formatting weirdness).
You could add a function to semi-automate the category assignment -- 

	   ("web-clip" ?w "* %c \n  :PROPERTIES: \n  :Entered: %U
\n  :END: \n  - ---->Quote from web page starts here\n    - %:region\n
- ---->Quote from web page ends here\n\n  %?\n" "~/plans/webclips.org"
"Unfiled Clips") 

Second, here's the code -- 

;;; org-annotation-helper.el --- start remember from a web browser
;;
;; Author: bzg AT altern DOT org
;; Keywords: org remember
;;
;;; Commentary:
;;
;; [bzg:] This is an adapted version of the planner-mode extension the
;; was first posted by Geert Kloosterman <g.j.kloosterman@gmail.com> on
;; the Planner mailing list.  All comments below are his.
;;
;; We want to be able to pass a URL and document title directly from a
;; web browser to Emacs.
;;
;; 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 emacsclient/gnuclient).  We use 
;; bookmarklets to create the remember:// urls dynamicly.
;;
;; The protocol types currently recognized are:
;; 
;; remember://     start `remember' with the url and title filled in
;; annotation://   similar to `planner-annotation-as-kill' (org?)
;;
;; The urls used internally will have the following form:
;;
;;   remember://<the web page url>%1C<the title>
;;
;; The title will be url-hex-encoded.  "%1C" is the (url-encoded) low
;; ascii value for the field separator.
;;
;;
;; The bookmarklets:
;;
;; javascript:location.href='remember://' + location.href + \ 
;;   '%1C' + escape(document.title) + '%1C' +
escape(window.getSelection()) ;;
javascript:location.href='annotation://' + location.href + '%1C' +
escape(document.title) ;; ;; The helper script:
;;
;; #!/bin/sh
;; # org-annotation-helper -- pass a remember-url to emacs
;; #
;; # Author: Geert Kloosterman <g.j.kloosterman@gmail.com>
;; # Date: Sat Nov 19 22:33:18 2005
;; 
;; if [ -z "$1" ]; then
;;     echo "$0: Error: no arguments given!" 1>&2
;;     exit 1
;; fi
;; 
;; # For years I've been using Martin Schwenke's dtemacs script to start
;; # Emacs.  The script uses gnuclient to connect to Emacs and starts a
;; # new Emacs process when necessary.
;; # See http://www.meltin.net/hacks/emacs/
;; #
;; # dtemacs -batch -eval "(progn (bzg/org-annotation-helper \"$1\" )
\"\")" ;; 
;; # As of Emacs 22 emacsclient will work too
;; emacsclient --eval "(progn (bzg/org-annotation-helper \"$1\" ) nil)"
;; 
;; # EOF

;; Adding a protocol handler
;; -------------------------
;;
;; Firefox
;;
;; To add a protocol handler (eg: remember://) in Firefox, take the
;; following steps:
;;
;; - type in "about:config" in the location bar
;; - right click, select New --> String
;; - the name should be "network.protocol-handler.app.remember" 
;; - the value should be the executable, eg. "org-annotation-helper".
;;   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.
;;
;; Opera
;;
;; In Opera add the protocol in the Preferences->Advanced->Programs
;; dialog.


;; Code:

(require 'url)

(autoload 'url-unhex-string "url")

(defun bzg/org-annotation-helper (info)
(interactive)
  "Process an externally passed remember:// style url.

URLSTRING consists of a protocol part and a url and title,
separated by %1C.

The protocol types currently recognized are:

remember://     start `remember' with the url and title
annotation://   similar to `org-annotation-as-kill'."
  (let ((remember-annotation-functions nil))
    ;; The `parse-url' functions break on the embedded url,
    ;; since our format is fixed we'll split the url ourselves.
    (if (string-match  "^\\([^:]*\\):\\(/*\\)\\(.*\\)" info)
      (let* ((proto (match-string 1 info))
	     (url_title_region (match-string 3 info))
	     (splitparts (split-string url_title_region "%1C"))
	     (url (car splitparts))
	     (type (if (string-match "^\\([a-z]+\\):" url) 
		       (match-string 1 url)))
	     (title (cadr splitparts))
	     (region (url-unhex-string (caddr splitparts)))
	     orglink)
        (setq title (if (> (length title) 0) (url-unhex-string title)))
        (setq orglink (org-make-link-string url title))
	(org-store-link-props :type type
			      :link url
			      :region region
			      :description title)
	(setq org-stored-links
	      (cons (list url title) org-stored-links))
	;; FIXME can't access %a in the template -- how to set
annotation? (raise-frame)
        (cond ((equal proto "remember")
	       (kill-new orglink)
               (org-remember ?w))
;;	       (yank)) I don't think I need this yank
              ((equal proto "annotation")
               (message "Copied '%s' to the kill-ring." orglink)
               (kill-new orglink))
              (t (error "unrecognized org-helper protocol"))))
      (error "could not parse argument"))))
)


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-12 15:33 ` John Rakestraw
@ 2008-05-14  4:12   ` Daniel M German
  2008-05-14  4:30     ` Carsten Dominik
                       ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Daniel M German @ 2008-05-14  4:12 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode

 John Rakestraw twisted the bytes to say:


 John> Richard G Riley <rileyrgdev@googlemail.com> wrote:
 >> Are there any add-ons anything to yank urls from firefox/iceweasel
 >> directly into a certain org-mode category?

 John> ouch. Your query reminds me that I promised long ago to write up my use
 John> of some code that Bastien adapted from a planner-mode extension. I'm in
 John> the midst of end-of-the-semester woes here (though I finally finished
 John> grading my finals late last night!), but here's a quick cut-and-paste
 John> of that code. It works very well for me.

 John> First, here's the template I use (apologies for formatting weirdness).
 John> You could add a function to semi-automate the category assignment -- 

Hi John,


I gave it a try (mozilla, ubuntu). The main challenge is that at some
point a MTA messed the elisp, so I had to figure out hoe to fix
it. Would you mind placing it somewhere where it can be downloaded or
sending it as an attachment?

I got everything to work, except that the link that it is passed to
remember contains a %3A instead of :: (i.e. http%3A//slashdot.org/)

One major warning: one must not select "Load this bookmark in the
sidebar" when adding the bookmarklet, otherwise it will not work.

Can I also suggest you add a version to the top of the file, so we can
keep track of future developments?

Thank John, this add-on will be of great help.

--dmg


-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-14  4:12   ` Daniel M German
@ 2008-05-14  4:30     ` Carsten Dominik
  2008-05-14 16:57     ` John Rakestraw
       [not found]     ` <871w44wlgz.fsf@uvic.ca>
  2 siblings, 0 replies; 25+ messages in thread
From: Carsten Dominik @ 2008-05-14  4:30 UTC (permalink / raw)
  To: dmg; +Cc: org-mode list

I guess this file could become part of the contrib directory?   
Bastien?  John?

- Carsten

On May 14, 2008, at 6:12 AM, Daniel M German wrote:
>
> Hi John,
>
>
> I gave it a try (mozilla, ubuntu). The main challenge is that at some
> point a MTA messed the elisp, so I had to figure out hoe to fix
> it. Would you mind placing it somewhere where it can be downloaded or
> sending it as an attachment?
>
> I got everything to work, except that the link that it is passed to
> remember contains a %3A instead of :: (i.e. http%3A//slashdot.org/)
>
> One major warning: one must not select "Load this bookmark in the
> sidebar" when adding the bookmarklet, otherwise it will not work.
>
> Can I also suggest you add a version to the top of the file, so we can
> keep track of future developments?
>
> Thank John, this add-on will be of great help.
>
> --dmg
>
>
> -- 
> --
> Daniel M. German
> http://turingmachine.org/
> http://silvernegative.com/
> dmg (at) uvic (dot) ca
> replace (at) with @ and (dot) with .
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-14  4:12   ` Daniel M German
  2008-05-14  4:30     ` Carsten Dominik
@ 2008-05-14 16:57     ` John Rakestraw
       [not found]     ` <871w44wlgz.fsf@uvic.ca>
  2 siblings, 0 replies; 25+ messages in thread
From: John Rakestraw @ 2008-05-14 16:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi Daniel and the list --

On Tue, 13 May 2008 21:12:13 -0700
Daniel M German <dmg@uvic.ca> wrote:

> I got everything to work, except that the link that it is passed to
> remember contains a %3A instead of :: (i.e. http%3A//slashdot.org/)

I'm afraid this is way beyond my expertise. I know only that "3A" is
the hex code for a colon, so at some point the colon that exists in
the url in the browser is translated into the hex code. I don't know
whether that translation happens in the javascript processing or what.
I'm using firefox/fedora, and things work well. (I'm not a programmer,
not even a hacker [in the good sense]. More of a tweaker.) So I'm afraid
I'm not any help here. 

More response to you and Carsten about documenting/publishing this
later (today, I hope).

--John


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
       [not found]     ` <871w44wlgz.fsf@uvic.ca>
@ 2008-05-18  1:27       ` Alan E. Davis
  2008-05-18  5:43         ` Daniel M German
  0 siblings, 1 reply; 25+ messages in thread
From: Alan E. Davis @ 2008-05-18  1:27 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2633 bytes --]

Speaking for myself, I haven't been able to grok this item.  I think there
are at least three code bits, and some other chunks in here.  A shell
script, some elisp, and some javascript?  Also, I do not understand what is
the bookmarklet.  I know what a bookmarklet is.

I'm going to pass on this for now; however, perhaps it is not unwarranted to
suggest that if this gets even to a contrib/ directory, some further
explanation may be needed for some of us.  Me in particular.

This could be EXTREMELY useful.

I recently started using Zotero to store links and selected parts of pages,
and I have been trying to reach out to a broader range of bibliography and
reference and collection managers/utilities.  This can help me, as I begin
to incorporate org-mode into my workstyle.  Saving selected text in a
remember note to be stored with the URL, and the ability to save this to an
org-mode file: that seems promising.

A clueless traveler,

Alan Davis

On Thu, May 15, 2008 at 8:48 AM, Daniel M German <dmg@uvic.ca> wrote:

>
>  Daniel> Hi John,
>
>  Daniel> I gave it a try (mozilla, ubuntu). The main challenge is that at
> some
>  Daniel> point a MTA messed the elisp, so I had to figure out hoe to fix
>  Daniel> it. Would you mind placing it somewhere where it can be downloaded
> or
>  Daniel> sending it as an attachment?
>
>  Daniel> I got everything to work, except that the link that it is passed
> to
>  Daniel> remember contains a %3A instead of :: (i.e. http%3A//
> slashdot.org/)
>
> Here is a small patch that fixes this problem:
>
> Use
>             (url (url-unhex-string (car splitparts)))
>
> intead of:
>
>             (url (car splitparts))
>
> That will properly unhex all the url. Once I did that URLs are working
> very well. it is an amazingly simple set of tools but it works
> great. Now I can easily keep bookmarks and selected text in an org
> file. It is already one of my can't-live-without pieces of software.
>
> I'll wait for you to release the "new" version of the module.
>
> Thanks again John.
>
>
>
> --
> --
> Daniel M. German
> http://turingmachine.org/
> http://silvernegative.com/
> dmg (at) uvic (dot) ca
> replace (at) with @ and (dot) with .
>
>
> _______________________________________________
> 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
>



-- 
Alan Davis, Kagman High School, Saipan lngndvs@gmail.com

"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man

"We have no art. We do everything as well as we can." ---Balinese saying

[-- Attachment #1.2: Type: text/html, Size: 3652 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-18  1:27       ` Alan E. Davis
@ 2008-05-18  5:43         ` Daniel M German
  2008-05-20 17:03           ` Richard G Riley
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel M German @ 2008-05-18  5:43 UTC (permalink / raw)
  To: Alan E. Davis; +Cc: emacs-orgmode



 Alan> Speaking for myself, I haven't been able to grok this item.  I think there are
 Alan> at least three code bits, and some other chunks in here.  A shell script, some
 Alan> elisp, and some javascript?  Also, I do not understand what is the
 Alan> bookmarklet.  I know what a bookmarklet is. 

Hi Alan,

Did you download the file as I indicated in my previous message? It has
detailed instructions on how to get all the pieces working.

--dmg



-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-18  5:43         ` Daniel M German
@ 2008-05-20 17:03           ` Richard G Riley
  2008-05-20 17:20             ` Daniel M German
  0 siblings, 1 reply; 25+ messages in thread
From: Richard G Riley @ 2008-05-20 17:03 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode

Daniel M German <dmg@uvic.ca> writes:

>  Alan> Speaking for myself, I haven't been able to grok this item.  I think there are
>  Alan> at least three code bits, and some other chunks in here.  A shell script, some
>  Alan> elisp, and some javascript?  Also, I do not understand what is the
>  Alan> bookmarklet.  I know what a bookmarklet is. 
>
> Hi Alan,
>
> Did you download the file as I indicated in my previous message? It has
> detailed instructions on how to get all the pieces working.
>
> --dmg

I followed the instructions but I cant get it working.

Are the instructions for adding 2 bookmarklets lacking since
it only really describes remember protocol? (Step 2).

Step 3 only mentioned the remember handler. Should there also be an
annotate handler?

I dont think I did anything too silly and wonder if anyone else managed
to install this properly? Currently when I click on the remember
bookmarklet the pane empties and emacs prompts me for a template type
but then does not insert the link. It just inserts "about:blank" as the
link.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-20 17:03           ` Richard G Riley
@ 2008-05-20 17:20             ` Daniel M German
  2008-05-20 20:46               ` Nick Dokos
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel M German @ 2008-05-20 17:20 UTC (permalink / raw)
  To: Richard G Riley; +Cc: emacs-orgmode

 >> 
 >> Hi Alan,
 >> 
 >> Did you download the file as I indicated in my previous message? It has
 >> detailed instructions on how to get all the pieces working.
 >> 
 >> --dmg

 Richard> I followed the instructions but I cant get it working.

 Richard> Are the instructions for adding 2 bookmarklets lacking since
 Richard> it only really describes remember protocol? (Step 2).

 Richard> Step 3 only mentioned the remember handler. Should there also be an
 Richard> annotate handler?


Start by doing remember first. Are you able to get the remember command
line script (what I call the handler) working? Try it from the command
line.

I suspect your javascript bookmarklet is not passing the info of the
page correctly. I would double check that first.

--dmg


 Richard> I dont think I did anything too silly and wonder if anyone else managed
 Richard> to install this properly? Currently when I click on the remember
 Richard> bookmarklet the pane empties and emacs prompts me for a template type
 Richard> but then does not insert the link. It just inserts "about:blank" as the
 Richard> link.



-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-20 17:20             ` Daniel M German
@ 2008-05-20 20:46               ` Nick Dokos
  2008-05-20 21:49                 ` Daniel M German
                                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Nick Dokos @ 2008-05-20 20:46 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode, Richard G Riley

Daniel M German <dmg@uvic.ca> wrote:

>  >> 
>  >> Hi Alan,
>  >> 
>  >> Did you download the file as I indicated in my previous message? It has
>  >> detailed instructions on how to get all the pieces working.
>  >> 
>  >> --dmg
> 
>  Richard> I followed the instructions but I cant get it working.
> 
>  Richard> Are the instructions for adding 2 bookmarklets lacking since
>  Richard> it only really describes remember protocol? (Step 2).
> 
>  Richard> Step 3 only mentioned the remember handler. Should there also be an
>  Richard> annotate handler?
> 
> 
> Start by doing remember first. Are you able to get the remember command
> line script (what I call the handler) working? Try it from the command
> line.
> 
> I suspect your javascript bookmarklet is not passing the info of the
> page correctly. I would double check that first.
> 
> --dmg
> 
> 
>  Richard> I dont think I did anything too silly and wonder if anyone else managed
>  Richard> to install this properly? Currently when I click on the remember
>  Richard> bookmarklet the pane empties and emacs prompts me for a template type
>  Richard> but then does not insert the link. It just inserts "about:blank" as the
>  Richard> link.
> 

I think part of the problem is that the comments are inconsistent:

Step 1 (and Daniel, in the mail above) talks about the "remember"
script, while the script itself and Step 3 talk about the
"org-annotation-helper" script.

Here is an attempt at clarification: it's mostly minor edits but there
are enough of them that I thought I'd send out the whole thing rather
than a patch. It is still very much oriented towards Linux.

However, I have problems with how the remember template works, so the
description below is fuzzy, perhaps incomplete, perhaps wrong.

With this caveat, Richard, can you try these steps out and see if they
work/make sense? If this is deemed OK, then maybe it can replace the
comment section in org-annotation-helper.el, after the requisite additions/
corrections/deletions are made.

Regards,
Nick

---------------------------------------------------------------------------
[Debugging notes - skip ahead if not interested]

Assuming I have defined a remember template like this:

           (?w "* %u %c \n\n%i" "~/lib/org/bookmarks.org" "Web links")

when bzg/org-annotation-helper calls org-remember with argument ?w, I
expect this template to pop up in a *Remember* buffer. Instead, I get
asked which template I want to use (I have three more templates in
org-remember-templates). When I say "w" and force the choice, the
contents of the buffer are not what I expect: I get the time stamp from
%u, and the link from %c, but *not* the selection from %i. I uncommented
the echo in the script and the browser is passing the selection to the
script correctly. I also single-stepped through
bzg/org-annotation-helper, which sets the :region property of the link
to the selection like so:

	(org-store-link-props :type type
			      :link url
			      :region region
			      :description title)

but somehow that seems to get dropped on the floor afterwards. Maybe a
bug in org-remember? I 'm under the (possibly erroneous?) impression
that we should be going through the if-true path of the following code
in org-remember (as shown by the arrow):

    ...
    ;; `org-select-remember-template'
    (setq org-select-template-temp-major-mode major-mode)
    (setq org-select-template-original-buffer (current-buffer))
    (if (eq org-finish-function 'org-remember-finalize)
?--->	(progn
	  (when (< (length org-remember-templates) 2)
	    (error "No other template available"))
	  (erase-buffer)
	  (let ((annotation (plist-get org-store-link-plist :annotation))
		(initial (plist-get org-store-link-plist :initial)))
	    (org-remember-apply-template))
	  (message "Press C-c C-c to remember data"))
      (if (org-region-active-p)
	  (org-do-remember (buffer-substring (point) (mark)))
	(org-do-remember))))))

but org-finish-function is nil in this case, so we fall through to the
org-do-remember at the end.

[end of debugging notes]
---------------------------------------------------------------------------

;; We want to be able to pass a URL and document title directly from a
;; web browser to Emacs.
;;
;; 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 emacsclient/gnuclient).  We use 
;; bookmarklets to create the remember:// urls dynamically.
;;
;; The protocol types currently recognized are:
;; 
;; remember://     start `remember' with the url and title filled in
;; annotation://   similar to `planner-annotation-as-kill' (org?)
;;
;; The urls used internally will have the following form:
;;
;;   remember://<the web page url>::remember::<the title>::remember::<selection>
;;
;; The annotation:// url is similar but there is no <selection> associated
;; with it.
;;
;; The web page url and the  title will be url-hex-encoded. 
;;
;;
;; The bookmarklets:
;;
;;----------------------------------------------------------------------
;; javascript:location.href='remember://' + location.href + \ 
;;   '::remember::' + escape(document.title) + '::remember::' + escape(window.getSelection())
;;----------------------------------------------------------------------
;; javascript:location.href='annotation://' + location.href + '::remember::' +\
;;     escape(document.title) ;; 
;;----------------------------------------------------------------------
;;
;;
;; The handler:
;;
;;----------------------------------------------------------------------
;; #!/bin/sh
;; # org-annotation-helper -- pass a remember-url to emacs
;; #
;; # Author: Geert Kloosterman <g.j.kloosterman@gmail.com>
;; # 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)"
;;----------------------------------------------------------------------
;; 
;;
;; To install:
;; 
;; Step 0: Install this module.
;;
;;  * Install this file and require it in your .emacs (or wherever you
;;    want to do it)
;;
;;    (require 'org-annotation-helper)
;;
;;
;; Step 1: Install the org-annotation-helper shell script.
;; 
;;  * Save the handler as a script, and make sure it is executable. In
;;    the following, we assume that it has been saved under the name
;;    "org-annotation-helper" in some directory in your $PATH.
;;
;;  * Try it: Make sure emacs is running and you have started its server
;;    mode (server-start).  Run this command from the command line:
;;
;;       org-annotation-helper 'remember://http%3A//orgmode.org/::remember::Org-Mode%20Homepage::remember::Notes'
;;
;;    Emacs should now show a remember window. If you have set up a
;;    remember template for this case, e.g. a template similar to the
;;    one in Step 4 below, the remember window will show a link to the
;;    orgmode.org site with the name "Org-Mode Homepage", with "Notes"
;;    added as initial content (XXX - this doesn't work?). Otherwise,
;;    you can insert the link with org-insert-link (commonly bound to
;;    C-c C-l).
;;
;;
;; Step 2: add two bookmarklets to the browser.
;;
;; For Firefox:
;;
;;  * Right click on the bookmarks area of Firefox. 
;;  * Select "New Bookmark".
;;  * In the Location field, fill the javascript code above (the bookmarklet).
;;  * Make sure "Load this bookmark in the sidebar" is deselected.
;;
;;  Try it. You should have now a url that starts with "remember://"
;;  and your browser will not know what do to with it.
;;
;;
;; Step 3: Add the handler for the "remember://" URI.
;;
;; For Firefox:
;;
;; To add a protocol handler (eg: remember://) in Firefox, take the
;; following steps:
;;
;;  * Type in "about:config" in the location bar.
;;  * Right click and from the drop-down menu, select New --> String.
;;  * The Preference Name should be "network.protocol-handler.app.remember".
;;  * The Value should be the name of the executable shell script (see
;;    Step 1 above, where we called it "org-annotation-helper"). 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.
;;
;; For Opera:
;;
;; Add the protocol in the Preferences->Advanced->Programs
;; dialog.
;;
;; 
;; Step 4: Configure a template.
;;
;; I personally  use the following template for this mode
;;
;;      (?w "* %u %c \n\n%i" "~/working/trunk/org/bookmarks.org" "Web links")
;;
;; %c will be replaced with the hyperlink to the page, displaying the
;;     title of the page.
;; %i will be replaced with the selected text from the browser.
;;
;; 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.
;;
;; Step 5:
;;    Enjoy!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-20 20:46               ` Nick Dokos
@ 2008-05-20 21:49                 ` Daniel M German
  2008-05-21  1:49                 ` John Rakestraw
  2008-05-21 10:51                 ` Richard G Riley
  2 siblings, 0 replies; 25+ messages in thread
From: Daniel M German @ 2008-05-20 21:49 UTC (permalink / raw)
  To: emacs-orgmode



Thanks Nick,

 Nick> Step 1 (and Daniel, in the mail above) talks about the "remember"
 Nick> script, while the script itself and Step 3 talk about the
 Nick> "org-annotation-helper" script.

I agree. The nomenclature is not the best.

 Nick> Here is an attempt at clarification: it's mostly minor edits but there
 Nick> are enough of them that I thought I'd send out the whole thing rather
 Nick> than a patch. It is still very much oriented towards Linux.

it works also under OS X.

 Nick> However, I have problems with how the remember template works, so the
 Nick> description below is fuzzy, perhaps incomplete, perhaps wrong.

Perhaps the solution is to split the command line script and the elisp into
different files. And provide a shortcut create to the boorkmarklet via a
web page.


 Nick> With this caveat, Richard, can you try these steps out and see if they
 Nick> work/make sense? If this is deemed OK, then maybe it can replace the
 Nick> comment section in org-annotation-helper.el, after the requisite additions/
 Nick> corrections/deletions are made.

 Nick> Regards,
 Nick> Nick

 Nick> ---------------------------------------------------------------------------
 Nick> [Debugging notes - skip ahead if not interested]

 Nick> Assuming I have defined a remember template like this:

           (?w "* %u %c \n\n%i" "~/lib/org/bookmarks.org" "Web links")

 Nick> when bzg/org-annotation-helper calls org-remember with argument ?w, I
 Nick> expect this template to pop up in a *Remember* buffer. Instead, I get
 Nick> asked which template I want to use (I have three more templates in
 Nick> org-remember-templates). When I say "w" and force the choice, the
 Nick> contents of the buffer are not what I expect: I get the time stamp from
 Nick> %u, and the link from %c, but *not* the selection from %i. I uncommented
 Nick> the echo in the script and the browser is passing the selection to the
 Nick> script correctly. I also single-stepped through
 Nick> bzg/org-annotation-helper, which sets the :region property of the link
 Nick> to the selection like so:

 Nick> 	(org-store-link-props :type type
 Nick> 			      :link url
 Nick> 			      :region region
 Nick> 			      :description title)

 Nick> but somehow that seems to get dropped on the floor afterwards. Maybe a
 Nick> bug in org-remember? I 'm under the (possibly erroneous?) impression
 Nick> that we should be going through the if-true path of the following code
 Nick> in org-remember (as shown by the arrow):

    ...
    ;; `org-select-remember-template'
    (setq org-select-template-temp-major-mode major-mode)
    (setq org-select-template-original-buffer (current-buffer))
    (if (eq org-finish-function 'org-remember-finalize)
 Nick> ?--->	(progn
 Nick> 	  (when (< (length org-remember-templates) 2)
 Nick> 	    (error "No other template available"))
 Nick> 	  (erase-buffer)
 Nick> 	  (let ((annotation (plist-get org-store-link-plist :annotation))
 Nick> 		(initial (plist-get org-store-link-plist :initial)))
 Nick> 	    (org-remember-apply-template))
 Nick> 	  (message "Press C-c C-c to remember data"))
      (if (org-region-active-p)
 Nick> 	  (org-do-remember (buffer-substring (point) (mark)))
 Nick> 	(org-do-remember))))))

 Nick> but org-finish-function is nil in this case, so we fall through to the
 Nick> org-do-remember at the end.

 Nick> [end of debugging notes]
 Nick> ---------------------------------------------------------------------------

 Nick> ;; We want to be able to pass a URL and document title directly from a
 Nick> ;; web browser to Emacs.
 Nick> ;;
 Nick> ;; We define a remember:// url handler in the browser and use a shell
 Nick> ;; script to handle the protocol.  This script passes the information
 Nick> ;; to a running Emacs process (using emacsclient/gnuclient).  We use 
 Nick> ;; bookmarklets to create the remember:// urls dynamically.
 Nick> ;;
 Nick> ;; The protocol types currently recognized are:
 Nick> ;; 
 Nick> ;; remember://     start `remember' with the url and title filled in
 Nick> ;; annotation://   similar to `planner-annotation-as-kill' (org?)
 Nick> ;;
 Nick> ;; The urls used internally will have the following form:
 Nick> ;;
 Nick> ;;   remember://<the web page url>::remember::<the title>::remember::<selection>
 Nick> ;;
 Nick> ;; The annotation:// url is similar but there is no <selection> associated
 Nick> ;; with it.
 Nick> ;;
 Nick> ;; The web page url and the  title will be url-hex-encoded. 
 Nick> ;;
 Nick> ;;
 Nick> ;; The bookmarklets:
 Nick> ;;
 Nick> ;;----------------------------------------------------------------------
 Nick> ;; javascript:location.href='remember://' + location.href + \ 
 Nick> ;;   '::remember::' + escape(document.title) + '::remember::' + escape(window.getSelection())
 Nick> ;;----------------------------------------------------------------------
 Nick> ;; javascript:location.href='annotation://' + location.href + '::remember::' +\
 Nick> ;;     escape(document.title) ;; 
 Nick> ;;----------------------------------------------------------------------
 Nick> ;;
 Nick> ;;
 Nick> ;; The handler:
 Nick> ;;
 Nick> ;;----------------------------------------------------------------------
 Nick> ;; #!/bin/sh
 Nick> ;; # org-annotation-helper -- pass a remember-url to emacs
 Nick> ;; #
 Nick> ;; # Author: Geert Kloosterman <g.j.kloosterman@gmail.com>
 Nick> ;; # Date: Sat Nov 19 22:33:18 2005
 Nick> ;; 
 Nick> ;; if [ -z "$1" ]; then
 Nick> ;;     echo "$0: Error: no arguments given!" 1>&2
 Nick> ;;     exit 1
 Nick> ;; fi
 Nick> ;; 
 Nick> ;; # To test uncomment following line
 Nick> ;; #echo $1 >> /tmp/remember.out
 Nick> ;; 
 Nick> ;; emacsclient --eval "(progn (bzg/org-annotation-helper \"$1\" ) nil)"
 Nick> ;;----------------------------------------------------------------------
 Nick> ;; 
 Nick> ;;
 Nick> ;; To install:
 Nick> ;; 
 Nick> ;; Step 0: Install this module.
 Nick> ;;
 Nick> ;;  * Install this file and require it in your .emacs (or wherever you
 Nick> ;;    want to do it)
 Nick> ;;
 Nick> ;;    (require 'org-annotation-helper)
 Nick> ;;
 Nick> ;;
 Nick> ;; Step 1: Install the org-annotation-helper shell script.
 Nick> ;; 
 Nick> ;;  * Save the handler as a script, and make sure it is executable. In
 Nick> ;;    the following, we assume that it has been saved under the name
 Nick> ;;    "org-annotation-helper" in some directory in your $PATH.
 Nick> ;;
 Nick> ;;  * Try it: Make sure emacs is running and you have started its server
 Nick> ;;    mode (server-start).  Run this command from the command line:
 Nick> ;;
 Nick> ;;       org-annotation-helper 'remember://http%3A//orgmode.org/::remember::Org-Mode%20Homepage::remember::Notes'
 Nick> ;;
 Nick> ;;    Emacs should now show a remember window. If you have set up a
 Nick> ;;    remember template for this case, e.g. a template similar to the
 Nick> ;;    one in Step 4 below, the remember window will show a link to the
 Nick> ;;    orgmode.org site with the name "Org-Mode Homepage", with "Notes"
 Nick> ;;    added as initial content (XXX - this doesn't work?). Otherwise,
 Nick> ;;    you can insert the link with org-insert-link (commonly bound to
 Nick> ;;    C-c C-l).
 Nick> ;;
 Nick> ;;
 Nick> ;; Step 2: add two bookmarklets to the browser.
 Nick> ;;
 Nick> ;; For Firefox:
 Nick> ;;
 Nick> ;;  * Right click on the bookmarks area of Firefox. 
 Nick> ;;  * Select "New Bookmark".
 Nick> ;;  * In the Location field, fill the javascript code above (the bookmarklet).
 Nick> ;;  * Make sure "Load this bookmark in the sidebar" is deselected.
 Nick> ;;
 Nick> ;;  Try it. You should have now a url that starts with "remember://"
 Nick> ;;  and your browser will not know what do to with it.
 Nick> ;;
 Nick> ;;
 Nick> ;; Step 3: Add the handler for the "remember://" URI.
 Nick> ;;
 Nick> ;; For Firefox:
 Nick> ;;
 Nick> ;; To add a protocol handler (eg: remember://) in Firefox, take the
 Nick> ;; following steps:
 Nick> ;;
 Nick> ;;  * Type in "about:config" in the location bar.
 Nick> ;;  * Right click and from the drop-down menu, select New --> String.
 Nick> ;;  * The Preference Name should be "network.protocol-handler.app.remember".
 Nick> ;;  * The Value should be the name of the executable shell script (see
 Nick> ;;    Step 1 above, where we called it "org-annotation-helper"). At
 Nick> ;;    least under Linux, this does not need to be the full path to the
 Nick> ;;    executable.
 Nick> ;;
 Nick> ;; See http://kb.mozillazine.org/Register_protocol for more details.
 Nick> ;;
 Nick> ;; For Opera:
 Nick> ;;
 Nick> ;; Add the protocol in the Preferences->Advanced->Programs
 Nick> ;; dialog.
 Nick> ;;
 Nick> ;; 
 Nick> ;; Step 4: Configure a template.
 Nick> ;;
 Nick> ;; I personally  use the following template for this mode
 Nick> ;;
 Nick> ;;      (?w "* %u %c \n\n%i" "~/working/trunk/org/bookmarks.org" "Web links")
 Nick> ;;
 Nick> ;; %c will be replaced with the hyperlink to the page, displaying the
 Nick> ;;     title of the page.
 Nick> ;; %i will be replaced with the selected text from the browser.
 Nick> ;;
 Nick> ;; By default the new remember notes are placed in the bookmarks.org
 Nick> ;; file under the "Web links" section, but it can be easily overriden
 Nick> ;; with C-u C-c C-c.
 Nick> ;;
 Nick> ;; Step 5:
 Nick> ;;    Enjoy!






-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-20 20:46               ` Nick Dokos
  2008-05-20 21:49                 ` Daniel M German
@ 2008-05-21  1:49                 ` John Rakestraw
  2008-05-21  5:28                   ` Carsten Dominik
  2008-05-21 14:58                   ` Nick Dokos
  2008-05-21 10:51                 ` Richard G Riley
  2 siblings, 2 replies; 25+ messages in thread
From: John Rakestraw @ 2008-05-21  1:49 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, 20 May 2008 16:46:37 -0400
Nick Dokos <nicholas.dokos@hp.com> wrote:

> when bzg/org-annotation-helper calls org-remember with argument ?w, I
> expect this template to pop up in a *Remember* buffer. Instead, I get
> asked which template I want to use (I have three more templates in
> org-remember-templates). 

I get the same thing -- in fact, org-annotation-helper has *never*
forced the selection of the template for me in the months I've been
using it; I've always had to select it by pressing "w". Even more
puzzling (to me, anyway), is that occasionally when I press "w" the
first time, I get nothing, but when I press it the second time, I get
the template, complete with a "w" keyed in at point.

> When I say "w" and force the choice, the
> contents of the buffer are not what I expect: I get the time stamp
> from %u, and the link from %c, but *not* the selection from %i. 

When I use the %i variable in the template, I get the same thing you
describe -- the selection doesn't show up in the note created from the
template. When I use "%:region" instead of "%i", it does show up as
expected.

--John

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21  1:49                 ` John Rakestraw
@ 2008-05-21  5:28                   ` Carsten Dominik
  2008-05-21 11:06                     ` Richard G Riley
                                       ` (2 more replies)
  2008-05-21 14:58                   ` Nick Dokos
  1 sibling, 3 replies; 25+ messages in thread
From: Carsten Dominik @ 2008-05-21  5:28 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode


On May 21, 2008, at 3:49 AM, John Rakestraw wrote:

> On Tue, 20 May 2008 16:46:37 -0400
> Nick Dokos <nicholas.dokos@hp.com> wrote:
>
>> when bzg/org-annotation-helper calls org-remember with argument ?w, I
>> expect this template to pop up in a *Remember* buffer. Instead, I get
>> asked which template I want to use (I have three more templates in
>> org-remember-templates).
>
> I get the same thing -- in fact, org-annotation-helper has *never*
> forced the selection of the template for me in the months I've been
> using it; I've always had to select it by pressing "w". Even more
> puzzling (to me, anyway), is that occasionally when I press "w" the
> first time, I get nothing, but when I press it the second time, I get
> the template, complete with a "w" keyed in at point.

This seems to be a bug in org-annotation-helper.el.
org-remember must be called like this:

(org-remember nil ?w)

instead of like this:

(org-remember ?w)


Furthermore, in order to get %i as the region, you need to
select the text in the *org-ann* temporary buffer, after inserting
the text.  So after "(insert region)", maybe you need something
like:

(insert-region)
(goto-char (point-max))
(set-mark (point-min))

An you need to have transient-mark-mode on for this.
This is a hack, I think it is actually better to use %:region in
the template instead.

HTH

- Carsten

>
>
>> When I say "w" and force the choice, the
>> contents of the buffer are not what I expect: I get the time stamp
>> from %u, and the link from %c, but *not* the selection from %i.
>
> When I use the %i variable in the template, I get the same thing you
> describe -- the selection doesn't show up in the note created from the
> template. When I use "%:region" instead of "%i", it does show up as
> expected.
>
> --John
>
> -- 
> John Rakestraw
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-20 20:46               ` Nick Dokos
  2008-05-20 21:49                 ` Daniel M German
  2008-05-21  1:49                 ` John Rakestraw
@ 2008-05-21 10:51                 ` Richard G Riley
  2 siblings, 0 replies; 25+ messages in thread
From: Richard G Riley @ 2008-05-21 10:51 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, Richard G Riley, dmg

Nick Dokos <nicholas.dokos@hp.com> writes:

> Daniel M German <dmg@uvic.ca> wrote:
>
>>  >> 
>>  >> Hi Alan,
>>  >> 
>>  >> Did you download the file as I indicated in my previous message? It has
>>  >> detailed instructions on how to get all the pieces working.
>>  >> 
>>  >> --dmg
>> 
>>  Richard> I followed the instructions but I cant get it working.
>> 
>>  Richard> Are the instructions for adding 2 bookmarklets lacking since
>>  Richard> it only really describes remember protocol? (Step 2).
>> 
>>  Richard> Step 3 only mentioned the remember handler. Should there also be an
>>  Richard> annotate handler?
>> 
>> 
>> Start by doing remember first. Are you able to get the remember command
>> line script (what I call the handler) working? Try it from the command
>> line.
>> 
>> I suspect your javascript bookmarklet is not passing the info of the
>> page correctly. I would double check that first.
>> 
>> --dmg
>> 
>> 
>>  Richard> I dont think I did anything too silly and wonder if anyone else managed
>>  Richard> to install this properly? Currently when I click on the remember
>>  Richard> bookmarklet the pane empties and emacs prompts me for a template type
>>  Richard> but then does not insert the link. It just inserts "about:blank" as the
>>  Richard> link.
>> 
>
> I think part of the problem is that the comments are inconsistent:
>
> Step 1 (and Daniel, in the mail above) talks about the "remember"
> script, while the script itself and Step 3 talk about the
> "org-annotation-helper" script.
>
> Here is an attempt at clarification: it's mostly minor edits but there
> are enough of them that I thought I'd send out the whole thing rather
> than a patch. It is still very much oriented towards Linux.
>
> However, I have problems with how the remember template works, so the
> description below is fuzzy, perhaps incomplete, perhaps wrong.

I still get prompted for a template type. Is there no way for the
bookmark code to auto select a "Bookmarks" template type?

>
> With this caveat, Richard, can you try these steps out and see if they
> work/make sense? If this is deemed OK, then maybe it can replace the
> comment section in org-annotation-helper.el, after the requisite additions/
> corrections/deletions are made.
>
> Regards,
> Nick
>
> ---------------------------------------------------------------------------
> [Debugging notes - skip ahead if not interested]
>
> Assuming I have defined a remember template like this:
>
>            (?w "* %u %c \n\n%i" "~/lib/org/bookmarks.org" "Web links")
>
> when bzg/org-annotation-helper calls org-remember with argument ?w, I
> expect this template to pop up in a *Remember* buffer. Instead, I get
> asked which template I want to use (I have three more templates in
> org-remember-templates). When I say "w" and force the choice, the
> contents of the buffer are not what I expect: I get the time stamp from
> %u, and the link from %c, but *not* the selection from %i. I uncommented
> the echo in the script and the browser is passing the selection to the
> script correctly. I also single-stepped through
> bzg/org-annotation-helper, which sets the :region property of the link
> to the selection like so:
>
> 	(org-store-link-props :type type
> 			      :link url
> 			      :region region
> 			      :description title)
>
> but somehow that seems to get dropped on the floor afterwards. Maybe a
> bug in org-remember? I 'm under the (possibly erroneous?) impression
> that we should be going through the if-true path of the following code
> in org-remember (as shown by the arrow):
>
>     ...
>     ;; `org-select-remember-template'
>     (setq org-select-template-temp-major-mode major-mode)
>     (setq org-select-template-original-buffer (current-buffer))
>     (if (eq org-finish-function 'org-remember-finalize)
> ?--->	(progn
> 	  (when (< (length org-remember-templates) 2)
> 	    (error "No other template available"))
> 	  (erase-buffer)
> 	  (let ((annotation (plist-get org-store-link-plist :annotation))
> 		(initial (plist-get org-store-link-plist :initial)))
> 	    (org-remember-apply-template))
> 	  (message "Press C-c C-c to remember data"))
>       (if (org-region-active-p)
> 	  (org-do-remember (buffer-substring (point) (mark)))
> 	(org-do-remember))))))
>
> but org-finish-function is nil in this case, so we fall through to the
> org-do-remember at the end.
>
> [end of debugging notes]
> ---------------------------------------------------------------------------
>
> ;; We want to be able to pass a URL and document title directly from a
> ;; web browser to Emacs.
> ;;
> ;; 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 emacsclient/gnuclient).  We use 
> ;; bookmarklets to create the remember:// urls dynamically.
> ;;
> ;; The protocol types currently recognized are:
> ;; 
> ;; remember://     start `remember' with the url and title filled in
> ;; annotation://   similar to `planner-annotation-as-kill' (org?)
> ;;
> ;; The urls used internally will have the following form:
> ;;
> ;;   remember://<the web page url>::remember::<the title>::remember::<selection>
> ;;
> ;; The annotation:// url is similar but there is no <selection> associated
> ;; with it.
> ;;
> ;; The web page url and the  title will be url-hex-encoded. 
> ;;
> ;;
> ;; The bookmarklets:
> ;;
> ;;----------------------------------------------------------------------
> ;; javascript:location.href='remember://' + location.href + \ 
> ;;   '::remember::' + escape(document.title) + '::remember::' + escape(window.getSelection())
> ;;----------------------------------------------------------------------
> ;; javascript:location.href='annotation://' + location.href + '::remember::' +\
> ;;     escape(document.title) ;; 
> ;;----------------------------------------------------------------------

Two of them - only one mentioned below.

There is still no comment as to what "annotate" actually means. Could I
also suggest for the non "codey" types that the code is kept on a single
like to avoid the need to paste into a seperate buffer and rejoin the
code before pasting it into the single line firefox properties dialog.


> ;;
> ;;
> ;; The handler:
> ;;
> ;;----------------------------------------------------------------------
> ;; #!/bin/sh
> ;; # org-annotation-helper -- pass a remember-url to emacs
> ;; #
> ;; # Author: Geert Kloosterman <g.j.kloosterman@gmail.com>
> ;; # 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)"

Works ok from command line.

> ;;----------------------------------------------------------------------
> ;; 
> ;;
> ;; To install:
> ;; 
> ;; Step 0: Install this module.
> ;;
> ;;  * Install this file and require it in your .emacs (or wherever you
> ;;    want to do it)
> ;;
> ;;    (require 'org-annotation-helper)
> ;;
> ;;
> ;; Step 1: Install the org-annotation-helper shell script.
> ;; 
> ;;  * Save the handler as a script, and make sure it is executable. In
> ;;    the following, we assume that it has been saved under the name
> ;;    "org-annotation-helper" in some directory in your $PATH.
> ;;
> ;;  * Try it: Make sure emacs is running and you have started its server
> ;;    mode (server-start).  Run this command from the command line:
> ;;
> ;;       org-annotation-helper 'remember://http%3A//orgmode.org/::remember::Org-Mode%20Homepage::remember::Notes'
> ;;
> ;;    Emacs should now show a remember window. If you have set up a
> ;;    remember template for this case, e.g. a template similar to the
> ;;    one in Step 4 below, the remember window will show a link to the
> ;;    orgmode.org site with the name "Org-Mode Homepage", with "Notes"
> ;;    added as initial content (XXX - this doesn't work?). Otherwise,
> ;;    you can insert the link with org-insert-link (commonly bound to
> ;;    C-c C-l).
> ;;
> ;;
> ;; Step 2: add two bookmarklets to the browser.

Only one described, maybe better to describe both.

> ;;
> ;; For Firefox:
> ;;
> ;;  * Right click on the bookmarks area of Firefox. 
> ;;  * Select "New Bookmark".
> ;;  * In the Location field, fill the javascript code above (the bookmarklet).
> ;;  * Make sure "Load this bookmark in the sidebar" is deselected.
> ;;
> ;;  Try it. You should have now a url that starts with "remember://"
> ;;  and your browser will not know what do to with it.

"The bookmark now references a url type of remember. We now
tell the browser what to do with it:"

> ;;
> ;;
> ;; Step 3: Add the handler for the "remember://" URI.
> ;;
> ;; For Firefox:
> ;;
> ;; To add a protocol handler (eg: remember://) in Firefox, take the
> ;; following steps:
> ;;
> ;;  * Type in "about:config" in the location bar.
> ;;  * Right click and from the drop-down menu, select New --> String.
> ;;  * The Preference Name should be "network.protocol-handler.app.remember".
> ;;  * The Value should be the name of the executable shell script (see
> ;;    Step 1 above, where we called it "org-annotation-helper"). 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.
> ;;
> ;; For Opera:
> ;;
> ;; Add the protocol in the Preferences->Advanced->Programs
> ;; dialog.
> ;;
> ;; 
> ;; Step 4: Configure a template.
> ;;
> ;; I personally  use the following template for this mode
> ;;
> ;;      (?w "* %u %c \n\n%i" "~/working/trunk/org/bookmarks.org" "Web links")
> ;;
> ;; %c will be replaced with the hyperlink to the page, displaying the
> ;;     title of the page.
> ;; %i will be replaced with the selected text from the browser.
> ;;
> ;; 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.
> ;;
> ;; Step 5:
> ;;    Enjoy!

Unfortunately when running from iceweasel under Debian I am sill being
prompted for a template and then I'm still getting about:blank as the
link inserted into the title.

It might be useful to add that adding location of org-annotation-helper
(is this a misnomer as I am a tad confused as to remember and annotate
here) to .gnomerc is important for desktop apps. I guess it can also be
added to an emacs shell path?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21  5:28                   ` Carsten Dominik
@ 2008-05-21 11:06                     ` Richard G Riley
  2008-05-21 15:44                       ` John Rakestraw
  2008-05-21 14:55                     ` John Rakestraw
  2008-05-21 15:05                     ` Daniel M German
  2 siblings, 1 reply; 25+ messages in thread
From: Richard G Riley @ 2008-05-21 11:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <C.Dominik@uva.nl> writes:

> On May 21, 2008, at 3:49 AM, John Rakestraw wrote:
>
>> On Tue, 20 May 2008 16:46:37 -0400
>> Nick Dokos <nicholas.dokos@hp.com> wrote:
>>
>>> when bzg/org-annotation-helper calls org-remember with argument ?w, I
>>> expect this template to pop up in a *Remember* buffer. Instead, I get
>>> asked which template I want to use (I have three more templates in
>>> org-remember-templates).
>>
>> I get the same thing -- in fact, org-annotation-helper has *never*
>> forced the selection of the template for me in the months I've been
>> using it; I've always had to select it by pressing "w". Even more
>> puzzling (to me, anyway), is that occasionally when I press "w" the
>> first time, I get nothing, but when I press it the second time, I get
>> the template, complete with a "w" keyed in at point.
>
> This seems to be a bug in org-annotation-helper.el.
> org-remember must be called like this:

> (org-remember nil ?w)
>
> instead of like this:
>
> (org-remember ?w)

When I tried this, then I get prompted for no templates (good) but there
is no url inserted either.

Has anyone else had success following Nick's new instructions to get
this working? I just tried from scratch and am seeing the same issues.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21  5:28                   ` Carsten Dominik
  2008-05-21 11:06                     ` Richard G Riley
@ 2008-05-21 14:55                     ` John Rakestraw
  2008-05-21 15:05                     ` Daniel M German
  2 siblings, 0 replies; 25+ messages in thread
From: John Rakestraw @ 2008-05-21 14:55 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On Wed, 21 May 2008 07:28:58 +0200
Carsten Dominik <C.Dominik@uva.nl> wrote:

> This seems to be a bug in org-annotation-helper.el.
> org-remember must be called like this:
> 
> (org-remember nil ?w)
> 
> instead of like this:
> 
> (org-remember ?w)

Thanks, Carsten. That fixed it.

--John


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21  1:49                 ` John Rakestraw
  2008-05-21  5:28                   ` Carsten Dominik
@ 2008-05-21 14:58                   ` Nick Dokos
  1 sibling, 0 replies; 25+ messages in thread
From: Nick Dokos @ 2008-05-21 14:58 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode

John Rakestraw <lists@johnrakestraw.com> wrote:


> ... Even more puzzling (to me, anyway), is that occasionally when I
> press "w" the first time, I get nothing, but when I press it the
> second time, I get the template, complete with a "w" keyed in at
> point.

Me too :-) I've learnt to just start typing what I want: after the
first character typed, the display refreshes and I just continue
normally.


> When I use the %i variable in the template, I get the same thing you
> describe -- the selection doesn't show up in the note created from the
> template. When I use "%:region" instead of "%i", it does show up as
> expected.
> 

That's good to know: I'll try that later on.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21  5:28                   ` Carsten Dominik
  2008-05-21 11:06                     ` Richard G Riley
  2008-05-21 14:55                     ` John Rakestraw
@ 2008-05-21 15:05                     ` Daniel M German
  2 siblings, 0 replies; 25+ messages in thread
From: Daniel M German @ 2008-05-21 15:05 UTC (permalink / raw)
  To: emacs-orgmode


 Carsten> This seems to be a bug in org-annotation-helper.el.
 Carsten> org-remember must be called like this:

 Carsten> (org-remember nil ?w)

 Carsten> instead of like this:

 Carsten> (org-remember ?w)


 Carsten> Furthermore, in order to get %i as the region, you need to
 Carsten> select the text in the *org-ann* temporary buffer, after inserting
 Carsten> the text.  So after "(insert region)", maybe you need something
 Carsten> like:

 Carsten> (insert-region)
 Carsten> (goto-char (point-max))
 Carsten> (set-mark (point-min))

 Carsten> An you need to have transient-mark-mode on for this.
 Carsten> This is a hack, I think it is actually better to use %:region in
 Carsten> the template instead.

Yes, that was a hack. I could not find any other way to "select" the
text than to create a new buffer where I set the mark, then pasted the
text --that seemed enought for my emacs configuration to have the text
selected. I'll look at your suggestions and update the code.

Thanks Carsten,

--daniel


-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21 11:06                     ` Richard G Riley
@ 2008-05-21 15:44                       ` John Rakestraw
  2008-05-21 16:10                         ` Nick Dokos
  0 siblings, 1 reply; 25+ messages in thread
From: John Rakestraw @ 2008-05-21 15:44 UTC (permalink / raw)
  To: Richard G Riley; +Cc: emacs-orgmode

On Wed, 21 May 2008 13:06:53 +0200
Richard G Riley <rileyrgdev@googlemail.com> wrote:

> Has anyone else had success following Nick's new instructions to get
> this working? I just tried from scratch and am seeing the same issues.

It's working for me. I should admit (for those who have not been
following this thread) that I had this working in Bastien's earlier
version, so "following Nick's new instructions" (and Ben's
instructions) means looking through those instructions to make the
requisite changes to Bastien's earlier version.

Three points that might be relevant:

  - my org-annotation-helper.el file incorporates the change suggested
    by Carsten's recent email in this thread:
    - "(org-remember nil ?w)" instead of "(org-remember ?w)
  - my template uses "%:region" instead of "%i" to set the location
    for the region copied in the browser to be inserted.
  - I updated my system this week from Fedora 7 to Fedora 9. It
    appears that he new version of Firefox (3.0b5) changes the naming
    convention for the network.protocol-handler inserted in
    about.config:
      - "network.protocol-handler.app.remember" instead of
        "network.protocol-handler.remember" (I can't verify this
        because I can't figure out how to delete the
        network.protocol-handler to start from scratch, but it appears
        that if you just set up the bookmarklet and then click on it,
        Firefox 3 will ask you for the application -- you then
        navigate to the shell script, double-click on it, and firefox
        sets up network.protocol-handler for you.)

If it's not working for you, then I think (though remember I'm not a
programmer ;-) that the problem is likely either in your template or
in the bookmarklet set-up. You might start troubleshooting by
following Dan's suggestion to test your template by starting emacs and
then running this command from a shell prompt:

  org-annotation-helper 'remember://http%3A//orgmode.org/ \
  ::remember::Org-Mode%20Homepage::remember::Notes' 

If that opens up your template with the proper insertions, then check
out the bookmarklet.

Hope that helps -- or at least that it doesn't introduce further
confusions.

--John


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21 15:44                       ` John Rakestraw
@ 2008-05-21 16:10                         ` Nick Dokos
  2008-05-23 23:28                           ` Daniel M German
  0 siblings, 1 reply; 25+ messages in thread
From: Nick Dokos @ 2008-05-21 16:10 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode, Richard G Riley

John Rakestraw <lists@johnrakestraw.com> wrote:


> If it's not working for you, then I think (though remember I'm not a
> programmer ;-) that the problem is likely either in your template or
> in the bookmarklet set-up. You might start troubleshooting by
> following Dan's suggestion to test your template by starting emacs and
> then running this command from a shell prompt:
> 
>   org-annotation-helper 'remember://http%3A//orgmode.org/ \
>   ::remember::Org-Mode%20Homepage::remember::Notes' 
> 
> If that opens up your template with the proper insertions, then check
> out the bookmarklet.
> 

It might help to uncomment the echo in the shell script. When
you click on the bookmarklet, the script should run, and save the
argument that it was called with, in /tmp/remember.out. It should look
something like this:

   remember://http://foo.bar.com/baz.html::remember::<title>::remember::<note>

or like this:

   annotation://http://foo.bar.com/baz.html::remember::<title>

depending on which of the two bookmarklets you clicked and whether you
had selected some text in the browser (that goes into <note>).

If that's the case, then the browser set-up is fine. If not, it's not!-)
Divide et impera.

Nick

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-21 16:10                         ` Nick Dokos
@ 2008-05-23 23:28                           ` Daniel M German
       [not found]                             ` <7bef1f890805232005s4755106eg2c928029e6db1767@mail.gmail.com>
  2008-05-24  3:14                             ` Alan E. Davis
  0 siblings, 2 replies; 25+ messages in thread
From: Daniel M German @ 2008-05-23 23:28 UTC (permalink / raw)
  To: emacs-orgmode


Check the new release. It contains a FAQ with a list of things you can
do to debug your configuration.


-dmg
-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Fwd: firefox urls
       [not found]                             ` <7bef1f890805232005s4755106eg2c928029e6db1767@mail.gmail.com>
@ 2008-05-24  3:08                               ` Alan E. Davis
  0 siblings, 0 replies; 25+ messages in thread
From: Alan E. Davis @ 2008-05-24  3:08 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2249 bytes --]

Thank you for the help.  I can see the light, at the end of the tunnel.
Close, but no cigar.  yet.

On Sat, May 24, 2008 at 9:28 AM, Daniel M German <dmg@uvic.ca> wrote:

>
> Check the new release. It contains a FAQ with a list of things you can
> do to debug your configuration.


I don't know where to look for the new release.  I downloaded the same one,
and followed the instructions as close as I could to *the letter*.  Here are
some of the stumbling blocks I discovered.  I was so close, I tweaked a
number of things, but none of them got the whole thing to work.

  -  In the code, the function is called "bmg/org-annotation-helper".  Am I
correct to delete the "bmg/"?

 -  I put the script into /usr/local/sbin.  I am using Ubuntu 8.04.  It
would have helped me to know the correct name of the script.  I ended up
putting two copies---remember and org-annotation-remember.  The script code
itself suggests that the name would be the
latter---org-annotation-remember---while the explanation SORT OF seemed to
suggest it would be called remember.  May I ask what it should be?

  -  when setting up Firefox using "about:config" is the name of the program
supposed to be the name of the script, or the name of the emacs function?

  - the bookmarklet code was broken with a "\" and a bunch of "%20"s.
That threw me.  But when I deleted the %20\%20 and some more un-needed %20s,
the behavior of the browser changed, and started asking me for the name of a
program.

  -  I haven't found an FAQ, but I found the instructions in the file
helpful.  A few more words would have clarified the above points, perhaps.


Thank you again.
 Alan

>
>
>
> -dmg
> --
> --
> Daniel M. German
> http://turingmachine.org/
> http://silvernegative.com/
> dmg (at) uvic (dot) ca
> replace (at) with @ and (dot) with .
>
>
> _______________________________________________
> 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
>



-- 
Alan Davis, Kagman High School, Saipan lngndvs@gmail.com

"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man

"We have no art. We do everything as well as we can." ---Balinese saying

[-- Attachment #1.2: Type: text/html, Size: 3630 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-23 23:28                           ` Daniel M German
       [not found]                             ` <7bef1f890805232005s4755106eg2c928029e6db1767@mail.gmail.com>
@ 2008-05-24  3:14                             ` Alan E. Davis
  2008-05-24  3:20                               ` Alan E. Davis
       [not found]                               ` <87r6bsmle5.fsf@uvic.ca>
  1 sibling, 2 replies; 25+ messages in thread
From: Alan E. Davis @ 2008-05-24  3:14 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 966 bytes --]

 Adding to my own reply to DMG and forward to the list (having forgotten to
click on "send to all") .

Am I dense to ask how to use this capacity?  When I run the script, I do get
an emacs buffer.  How would I use the function in firefox?  Click on the
bookmark toolbar?  (Using Firefox 3.0 b5, there is no "add bookmark" under
the menu item "Bookmarks".)

I assume also I need to name the bookmarklet as I am typing it in?  There
are two bookmarklets and I was a little confused how to handle the second
one.  I guess do the same thing.  I named them, respectively, "remember" and
"annotation".  I think the second one seemed to cause less of a response
than the first, although neither of them is working as it should.

Thank you again.

Alan

-- 
Alan Davis, Kagman High School, Saipan lngndvs@gmail.com

"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man

"We have no art. We do everything as well as we can." ---Balinese saying

[-- Attachment #1.2: Type: text/html, Size: 1221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
  2008-05-24  3:14                             ` Alan E. Davis
@ 2008-05-24  3:20                               ` Alan E. Davis
       [not found]                               ` <87r6bsmle5.fsf@uvic.ca>
  1 sibling, 0 replies; 25+ messages in thread
From: Alan E. Davis @ 2008-05-24  3:20 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1827 bytes --]

Please forgive me for adding more cluelessness to the pot.

I think the "new version" may be in the development branch of org-mode?  I
do not want to get lost in constantly updating to the newest code, but if
this code is there, I would like to.  I have not been able to understand how
to get the latest git repository.  I guess I haven't found the docs for
that.  I have often upgraded from CVS and SVN.  May I request a pointer?  Is
this code in the CONTRIB directory of the git repository?

Thank you again.

Alan

On Sat, May 24, 2008 at 1:14 PM, Alan E. Davis <lngndvs@gmail.com> wrote:

>  Adding to my own reply to DMG and forward to the list (having forgotten to
> click on "send to all") .
>
> Am I dense to ask how to use this capacity?  When I run the script, I do
> get an emacs buffer.  How would I use the function in firefox?  Click on the
> bookmark toolbar?  (Using Firefox 3.0 b5, there is no "add bookmark" under
> the menu item "Bookmarks".)
>
> I assume also I need to name the bookmarklet as I am typing it in?  There
> are two bookmarklets and I was a little confused how to handle the second
> one.  I guess do the same thing.  I named them, respectively, "remember" and
> "annotation".  I think the second one seemed to cause less of a response
> than the first, although neither of them is working as it should.
>
> Thank you again.
>
> Alan
>
> --
> Alan Davis, Kagman High School, Saipan lngndvs@gmail.com
>
> "It's never a matter of liking or disliking ..."
> ---Santa Ynez Chumash Medicine Man
>
> "We have no art. We do everything as well as we can." ---Balinese saying
>
>


-- 
Alan Davis, Kagman High School, Saipan lngndvs@gmail.com

"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man

"We have no art. We do everything as well as we can." ---Balinese saying

[-- Attachment #1.2: Type: text/html, Size: 2552 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: firefox urls
       [not found]                               ` <87r6bsmle5.fsf@uvic.ca>
@ 2008-05-24  5:18                                 ` Alan E. Davis
  0 siblings, 0 replies; 25+ messages in thread
From: Alan E. Davis @ 2008-05-24  5:18 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 964 bytes --]

Your newer version with commentary and faq was very helpful.  You had
already answered every one of my questions.  However, it would seem to make
sense to have a generic name that would drop right into the lisp directory.
Not everyone does it my way, though.  Anyway, it all makes good sense now.


Thank you again,

Alan

On Sat, May 24, 2008 at 1:27 PM, Daniel M German <dmg@uvic.ca> wrote:

>
>
> I posted the link on the ORG mailing list. See the .html file
>
> http://turingmachine.org/~dmg/temp/org-annot-0.3.tar.gz<http://turingmachine.org/%7Edmg/temp/org-annot-0.3.tar.gz>
>
>
>
>
> --
> --
> Daniel M. German
> http://turingmachine.org/
> http://silvernegative.com/
> dmg (at) uvic (dot) ca
> replace (at) with @ and (dot) with .
>



-- 
Alan Davis, Kagman High School, Saipan lngndvs@gmail.com

"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man

"We have no art. We do everything as well as we can." ---Balinese saying

[-- Attachment #1.2: Type: text/html, Size: 1579 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-05-24  5:18 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-12 15:22 firefox urls Richard G Riley
2008-05-12 15:33 ` John Rakestraw
2008-05-14  4:12   ` Daniel M German
2008-05-14  4:30     ` Carsten Dominik
2008-05-14 16:57     ` John Rakestraw
     [not found]     ` <871w44wlgz.fsf@uvic.ca>
2008-05-18  1:27       ` Alan E. Davis
2008-05-18  5:43         ` Daniel M German
2008-05-20 17:03           ` Richard G Riley
2008-05-20 17:20             ` Daniel M German
2008-05-20 20:46               ` Nick Dokos
2008-05-20 21:49                 ` Daniel M German
2008-05-21  1:49                 ` John Rakestraw
2008-05-21  5:28                   ` Carsten Dominik
2008-05-21 11:06                     ` Richard G Riley
2008-05-21 15:44                       ` John Rakestraw
2008-05-21 16:10                         ` Nick Dokos
2008-05-23 23:28                           ` Daniel M German
     [not found]                             ` <7bef1f890805232005s4755106eg2c928029e6db1767@mail.gmail.com>
2008-05-24  3:08                               ` Fwd: " Alan E. Davis
2008-05-24  3:14                             ` Alan E. Davis
2008-05-24  3:20                               ` Alan E. Davis
     [not found]                               ` <87r6bsmle5.fsf@uvic.ca>
2008-05-24  5:18                                 ` Alan E. Davis
2008-05-21 14:55                     ` John Rakestraw
2008-05-21 15:05                     ` Daniel M German
2008-05-21 14:58                   ` Nick Dokos
2008-05-21 10:51                 ` Richard G Riley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).