* 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-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 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
[parent not found: <7bef1f890805232005s4755106eg2c928029e6db1767@mail.gmail.com>]
* 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
[parent not found: <87r6bsmle5.fsf@uvic.ca>]
* 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
* 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 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 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-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