* org-protocol://remember:// question
@ 2009-04-02 6:50 Tassilo Horn
2009-04-02 11:10 ` Sebastian Rose
2009-04-03 22:59 ` Sebastian Rose
0 siblings, 2 replies; 14+ messages in thread
From: Tassilo Horn @ 2009-04-02 6:50 UTC (permalink / raw)
To: emacs-orgmode
Hi all,
first I'd like to say that this is superb. It'll deprecate my
home-brewn remember webpage hacks for conkeror soon. :-)
Ok, now the problem I have: I defined a remember template for
remembering pages from my browser like that:
--8<---------------cut here---------------start------------->8---
(setq org-default-notes-file "~/repos/org/remember.org"
org-remember-default-headline 'bottom
org-remember-templates
'(;; TODOs
("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n %i")))
--8<---------------cut here---------------end--------------->8---
When I execute
emacsclient \
'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The%20title/body'
now I get a remember buffer with these contents:
--8<---------------cut here---------------start------------->8---
* BROWSER
(created: [2009-04-02 Thu 08:41])
body
--8<---------------cut here---------------end--------------->8---
Accorting to the template table at [1] I thought that the TITLE would be
filled in after BROWSER, and the [[URL][TITLE]] link between the
timestamp and the BODY. But that's not the case. The [[URL][TITLE]] is
on top of the kill-ring, though.
What am I doing wrong?
BTW: Has some Conkeror user managed to setup an org-protocol handler
yet?
Bye,
Tassilo
__________
[1] http://orgmode.org/worg/org-contrib/org-protocol.php
--
No person, no idea, and no religion deserves to be illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 6:50 org-protocol://remember:// question Tassilo Horn
@ 2009-04-02 11:10 ` Sebastian Rose
2009-04-02 12:28 ` Sebastian Rose
2009-04-02 16:03 ` Carsten Dominik
2009-04-03 22:59 ` Sebastian Rose
1 sibling, 2 replies; 14+ messages in thread
From: Sebastian Rose @ 2009-04-02 11:10 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-orgmode
Hi Tassilo,
your right, the docs are wrong, Sorry for the inconvenience.
Actually, I now understand Bastiens comment in org-annotation-helper.el:
;; FIXME can't access %a in the template -- how to set annotation?
I'll fix the table in the docs.
I'll be back as soon as possible.
Sebastian
Tassilo Horn <tassilo@member.fsf.org> writes:
> Hi all,
>
> first I'd like to say that this is superb. It'll deprecate my
> home-brewn remember webpage hacks for conkeror soon. :-)
>
> Ok, now the problem I have: I defined a remember template for
> remembering pages from my browser like that:
>
>
> (setq org-default-notes-file "~/repos/org/remember.org"
> org-remember-default-headline 'bottom
> org-remember-templates
> '(;; TODOs
> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n %i")))
>
> When I execute
>
> emacsclient \
> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The%20title/body'
>
> now I get a remember buffer with these contents:
>
>
> * BROWSER
> (created: [2009-04-02 Thu 08:41])
>
>
>
> body
>
> Accorting to the template table at [1] I thought that the TITLE would be
> filled in after BROWSER, and the [[URL][TITLE]] link between the
> timestamp and the BODY. But that's not the case. The [[URL][TITLE]] is
> on top of the kill-ring, though.
>
> What am I doing wrong?
>
> BTW: Has some Conkeror user managed to setup an org-protocol handler
> yet?
>
> Bye,
> Tassilo
> __________
> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 11:10 ` Sebastian Rose
@ 2009-04-02 12:28 ` Sebastian Rose
2009-04-02 16:03 ` Carsten Dominik
2009-04-02 16:03 ` Carsten Dominik
1 sibling, 1 reply; 14+ messages in thread
From: Sebastian Rose @ 2009-04-02 12:28 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
Hi,
there is no good way to access the title. The following path to
org-protocol.el is a work around for this. It simply kills the title
before the org-link. That way we could insert the title with
C-y M-y
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 417 bytes --]
diff --git a/org-protocol.el b/org-protocol.el
index 4ca81ad..2ae87bc 100644
--- a/org-protocol.el
+++ b/org-protocol.el
@@ -345,6 +345,7 @@ Now template ?b will be used."
(cons (list url title) org-stored-links))
;; FIXME can't access %a in the template -- how to set annotation?
(raise-frame)
+ (kill-new title)
(kill-new orglink)
(set-buffer b)
(insert region)
[-- Attachment #3: Type: text/plain, Size: 2907 bytes --]
I'd prefer to have some registers we could write to when calling
org-remember from code. That registers could be checked and emptied in
`org-remember-apply-template' like this:
(defvar org-remember-template-values (make-hash-table))
(defun org-remember-put-register(key val)
"Put something in org-remember-template-values"
(puthash key val org-remember-template-values))
(defun org-remember-get-register(key)
"Remove and retrieve some value from org-remember-template-values"
(let ((ret (gethash key org-remember-template-values)))
(puthash key nil org-remember-template-values)
ret))
.....
(defun org-remember-apply-template
.....
(v-x (or (org-remember-get-register ?x)
(org-get-x-clipboard 'PRIMARY)
(org-get-x-clipboard 'CLIPBOARD)
(org-get-x-clipboard 'SECONDARY)))
.....
How about that?
Sebastian
Sebastian Rose <sebastian_rose@gmx.de> writes:
> Hi Tassilo,
>
>
> your right, the docs are wrong, Sorry for the inconvenience.
>
> Actually, I now understand Bastiens comment in org-annotation-helper.el:
>
> ;; FIXME can't access %a in the template -- how to set annotation?
>
> I'll fix the table in the docs.
>
> I'll be back as soon as possible.
>
> Sebastian
>
>
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Hi all,
>>
>> first I'd like to say that this is superb. It'll deprecate my
>> home-brewn remember webpage hacks for conkeror soon. :-)
>>
>> Ok, now the problem I have: I defined a remember template for
>> remembering pages from my browser like that:
>>
>>
>> (setq org-default-notes-file "~/repos/org/remember.org"
>> org-remember-default-headline 'bottom
>> org-remember-templates
>> '(;; TODOs
>> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
>> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n %i")))
>>
>> When I execute
>>
>> emacsclient \
>> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The%20title/body'
>>
>> now I get a remember buffer with these contents:
>>
>>
>> * BROWSER
>> (created: [2009-04-02 Thu 08:41])
>>
>>
>>
>> body
>>
>> Accorting to the template table at [1] I thought that the TITLE would be
>> filled in after BROWSER, and the [[URL][TITLE]] link between the
>> timestamp and the BODY. But that's not the case. The [[URL][TITLE]] is
>> on top of the kill-ring, though.
>>
>> What am I doing wrong?
>>
>> BTW: Has some Conkeror user managed to setup an org-protocol handler
>> yet?
>>
>> Bye,
>> Tassilo
>> __________
>> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
[-- Attachment #4: 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 related [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 12:28 ` Sebastian Rose
@ 2009-04-02 16:03 ` Carsten Dominik
0 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2009-04-02 16:03 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Tassilo Horn, emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 3845 bytes --]
Hi Sebastian,
there is a much better solution, see my other mail.
- Carsten
On Apr 2, 2009, at 2:28 PM, Sebastian Rose wrote:
> Hi,
>
>
> there is no good way to access the title. The following path to
> org-protocol.el is a work around for this. It simply kills the title
> before the org-link. That way we could insert the title with
>
> C-y M-y
>
>
> diff --git a/org-protocol.el b/org-protocol.el
> index 4ca81ad..2ae87bc 100644
> --- a/org-protocol.el
> +++ b/org-protocol.el
> @@ -345,6 +345,7 @@ Now template ?b will be used."
> (cons (list url title) org-stored-links))
> ;; FIXME can't access %a in the template -- how to set
> annotation?
> (raise-frame)
> + (kill-new title)
> (kill-new orglink)
> (set-buffer b)
> (insert region)
>
>
> I'd prefer to have some registers we could write to when calling
> org-remember from code. That registers could be checked and emptied in
> `org-remember-apply-template' like this:
>
>
>
> (defvar org-remember-template-values (make-hash-table))
>
> (defun org-remember-put-register(key val)
> "Put something in org-remember-template-values"
> (puthash key val org-remember-template-values))
>
> (defun org-remember-get-register(key)
> "Remove and retrieve some value from org-remember-template-
> values"
> (let ((ret (gethash key org-remember-template-values)))
> (puthash key nil org-remember-template-values)
> ret))
>
> .....
>
> (defun org-remember-apply-template
>
> .....
>
> (v-x (or (org-remember-get-register ?x)
> (org-get-x-clipboard 'PRIMARY)
> (org-get-x-clipboard 'CLIPBOARD)
> (org-get-x-clipboard 'SECONDARY)))
>
> .....
>
>
>
> How about that?
>
>
>
> Sebastian
>
>
>
>
> Sebastian Rose <sebastian_rose@gmx.de> writes:
>> Hi Tassilo,
>>
>>
>> your right, the docs are wrong, Sorry for the inconvenience.
>>
>> Actually, I now understand Bastiens comment in org-annotation-
>> helper.el:
>>
>> ;; FIXME can't access %a in the template -- how to set annotation?
>>
>> I'll fix the table in the docs.
>>
>> I'll be back as soon as possible.
>>
>> Sebastian
>>
>>
>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>
>>> Hi all,
>>>
>>> first I'd like to say that this is superb. It'll deprecate my
>>> home-brewn remember webpage hacks for conkeror soon. :-)
>>>
>>> Ok, now the problem I have: I defined a remember template for
>>> remembering pages from my browser like that:
>>>
>>>
>>> (setq org-default-notes-file "~/repos/org/remember.org"
>>> org-remember-default-headline 'bottom
>>> org-remember-templates
>>> '(;; TODOs
>>> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
>>> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n
>>> %i")))
>>>
>>> When I execute
>>>
>>> emacsclient \
>>> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The
>>> %20title/body'
>>>
>>> now I get a remember buffer with these contents:
>>>
>>>
>>> * BROWSER
>>> (created: [2009-04-02 Thu 08:41])
>>>
>>>
>>>
>>> body
>>>
>>> Accorting to the template table at [1] I thought that the TITLE
>>> would be
>>> filled in after BROWSER, and the [[URL][TITLE]] link between the
>>> timestamp and the BODY. But that's not the case. The [[URL]
>>> [TITLE]] is
>>> on top of the kill-ring, though.
>>>
>>> What am I doing wrong?
>>>
>>> BTW: Has some Conkeror user managed to setup an org-protocol handler
>>> yet?
>>>
>>> Bye,
>>> Tassilo
>>> __________
>>> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
>
> --
> Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449
> Hannover
> Tel.: +49 (0)511 - 36 58 472
> Fax: +49 (0)1805 - 233633 - 11044
> mobil: +49 (0)173 - 83 93 417
> Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
> Http: www.emma-stil.de
[-- Attachment #1.2: Type: text/html, Size: 9714 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] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 11:10 ` Sebastian Rose
2009-04-02 12:28 ` Sebastian Rose
@ 2009-04-02 16:03 ` Carsten Dominik
2009-04-02 18:00 ` Sebastian Rose
1 sibling, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2009-04-02 16:03 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Tassilo Horn, emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 3001 bytes --]
Hi Sebastian, Tassilo,
this can be easily fixed.
Org-protocol may add arbitrary properties to the link properties.
For example, after a call
(org-store-link-props :type type
:link url
:region region
:description title
:hello "Hello world")
a template could use "%:hello" to access and insert this
string. I have just changed org-remember so that the
property :annotation will be the default for %a.
Sebastian, could you please add
:annotation (concat "[[" url "][" title "]]")
or something similar to the call to org-store-link-props?
Also, feel free to add any other properties that might
provide useful information for a template.
HTH
- Carsten
On Apr 2, 2009, at 1:10 PM, Sebastian Rose wrote:
> Hi Tassilo,
>
>
> your right, the docs are wrong, Sorry for the inconvenience.
>
> Actually, I now understand Bastiens comment in org-annotation-
> helper.el:
>
> ;; FIXME can't access %a in the template -- how to set annotation?
>
> I'll fix the table in the docs.
>
> I'll be back as soon as possible.
>
> Sebastian
>
>
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Hi all,
>>
>> first I'd like to say that this is superb. It'll deprecate my
>> home-brewn remember webpage hacks for conkeror soon. :-)
>>
>> Ok, now the problem I have: I defined a remember template for
>> remembering pages from my browser like that:
>>
>>
>> (setq org-default-notes-file "~/repos/org/remember.org"
>> org-remember-default-headline 'bottom
>> org-remember-templates
>> '(;; TODOs
>> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
>> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n
>> %i")))
>>
>> When I execute
>>
>> emacsclient \
>> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The
>> %20title/body'
>>
>> now I get a remember buffer with these contents:
>>
>>
>> * BROWSER
>> (created: [2009-04-02 Thu 08:41])
>>
>>
>>
>> body
>>
>> Accorting to the template table at [1] I thought that the TITLE
>> would be
>> filled in after BROWSER, and the [[URL][TITLE]] link between the
>> timestamp and the BODY. But that's not the case. The [[URL]
>> [TITLE]] is
>> on top of the kill-ring, though.
>>
>> What am I doing wrong?
>>
>> BTW: Has some Conkeror user managed to setup an org-protocol handler
>> yet?
>>
>> Bye,
>> Tassilo
>> __________
>> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
>
> --
> Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449
> Hannover
> Tel.: +49 (0)511 - 36 58 472
> Fax: +49 (0)1805 - 233633 - 11044
> mobil: +49 (0)173 - 83 93 417
> Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
> Http: www.emma-stil.de
>
>
> _______________________________________________
> 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
[-- Attachment #1.2: Type: text/html, Size: 6163 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] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 16:03 ` Carsten Dominik
@ 2009-04-02 18:00 ` Sebastian Rose
2009-04-03 7:47 ` Carsten Dominik
0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Rose @ 2009-04-02 18:00 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Tassilo Horn, emacs-orgmode
Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Sebastian, Tassilo,
>
> this can be easily fixed.
>
> Org-protocol may add arbitrary properties to the link properties.
> For example, after a call
>
> (org-store-link-props :type type
> :link url
> :region region
> :description title
> :hello "Hello world")
>
> a template could use "%:hello" to access and insert this
> string. I have just changed org-remember so that the
> property :annotation will be the default for %a.
> Sebastian, could you please add
>
> :annotation (concat "[[" url "][" title "]]")
>
> or something similar to the call to org-store-link-props?
>
> Also, feel free to add any other properties that might
> provide useful information for a template.
Doesn't that apply to certain link types only?
Also, the situation seems to be different for org-protocol-remember. I
think it's the way remember is used inside that function that has to be
changed.
Maybe I can figure that out.
Anyway, I pulled and restarted emacs.
But still, for
(setq org-remember-templates
'(
;; Test template:
(?z "* %^{Title}\n\n a: %a\n A: %A\n i: %i\n t: %t\n T: %T\n u: %u\n U: %U\n n: %n\n c: %c\n x: %x\n:bla: %:bla\n:description: %:description\n %?\n\n" "~/xy.org" "Remember")
))
The template is filled with this (when I use org-protocol-remember):
* Results
a:
A:
i: initial content, the region when remember is called with C-u.
t: <2009-04-02 Do>
T: <2009-04-02 Do 19:36>
u: [2009-04-02 Do]
U: [2009-04-02 Do 19:36]
n: %n
c: [[http://orgmode.org/manual/Remember-templates.html#Remember-templates][Remember templates - The Org Manual]]
x: [[http://orgmode.org/manual/Remember-templates.html#Remember-templates][Remember templates - The Org Manual]]
:bla: %:bla
:description: %:description
If I call org-remember directly through `C-c r', the template is filled differently:
* asdf
a: [[file:~/emacs/lisp/sr-org-mode.el::]]
A: [[file:~/emacs/lisp/sr-org-mode.el::][asdf]]
i:
t: <2009-04-02 Do>
T: <2009-04-02 Do 19:47>
u: [2009-04-02 Do]
U: [2009-04-02 Do 19:47]
n: %n
c: (?x "* \n\n a: %a\n A: %A\n i: %i\n t: %t\n T: %T\n u: %u\n U: %U\n n: %n\n c: %c\n x: %x\n:bla: %:bla\n:description: %:description\n %?\n\n" "~/xy.org" "Remember")
x: (?x "* %^{Title}\n\n a: %a\n A: %A\n i: %i\n t: %t\n T: %T\n u: %u\n U: %U\n n: %n\n c: %c\n x: %x\n:bla: %:bla\n:description: %:description\n %?\n\n" "~/xy.org" "Remember")
:bla: %:bla
:description: %:description
Note that %n is not filled too.
> HTH
>
> - Carsten
>
> On Apr 2, 2009, at 1:10 PM, Sebastian Rose wrote:
>
>> Hi Tassilo,
>>
>>
>> your right, the docs are wrong, Sorry for the inconvenience.
>>
>> Actually, I now understand Bastiens comment in org-annotation-
>> helper.el:
>>
>> ;; FIXME can't access %a in the template -- how to set annotation?
>>
>> I'll fix the table in the docs.
>>
>> I'll be back as soon as possible.
>>
>> Sebastian
>>
>>
>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>
>>> Hi all,
>>>
>>> first I'd like to say that this is superb. It'll deprecate my
>>> home-brewn remember webpage hacks for conkeror soon. :-)
>>>
>>> Ok, now the problem I have: I defined a remember template for
>>> remembering pages from my browser like that:
>>>
>>>
>>> (setq org-default-notes-file "~/repos/org/remember.org"
>>> org-remember-default-headline 'bottom
>>> org-remember-templates
>>> '(;; TODOs
>>> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
>>> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n %i")))
>>>
>>> When I execute
>>>
>>> emacsclient \
>>> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The
>>> %20title/body'
>>>
>>> now I get a remember buffer with these contents:
>>>
>>>
>>> * BROWSER
>>> (created: [2009-04-02 Thu 08:41])
>>>
>>>
>>>
>>> body
>>>
>>> Accorting to the template table at [1] I thought that the TITLE would be
>>> filled in after BROWSER, and the [[URL][TITLE]] link between the
>>> timestamp and the BODY. But that's not the case. The [[URL]
>>> [TITLE]] is
>>> on top of the kill-ring, though.
>>>
>>> What am I doing wrong?
>>>
>>> BTW: Has some Conkeror user managed to setup an org-protocol handler
>>> yet?
>>>
>>> Bye,
>>> Tassilo
>>> __________
>>> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
>>
>> --
>> Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
>> Tel.: +49 (0)511 - 36 58 472
>> Fax: +49 (0)1805 - 233633 - 11044
>> mobil: +49 (0)173 - 83 93 417
>> Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
>> Http: www.emma-stil.de
>>
>>
>> _______________________________________________
>> 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
>
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 18:00 ` Sebastian Rose
@ 2009-04-03 7:47 ` Carsten Dominik
2009-04-03 12:06 ` Sebastian Rose
2009-04-03 12:34 ` Sebastian Rose
0 siblings, 2 replies; 14+ messages in thread
From: Carsten Dominik @ 2009-04-03 7:47 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Tassilo Horn, emacs-orgmode
On Apr 2, 2009, at 8:00 PM, Sebastian Rose wrote:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> Hi Sebastian, Tassilo,
>>
>> this can be easily fixed.
>>
>> Org-protocol may add arbitrary properties to the link properties.
>> For example, after a call
>>
>> (org-store-link-props :type type
>> :link url
>> :region region
>> :description title
>> :hello "Hello world")
>>
>> a template could use "%:hello" to access and insert this
>> string. I have just changed org-remember so that the
>> property :annotation will be the default for %a.
>> Sebastian, could you please add
>>
>> :annotation (concat "[[" url "][" title "]]")
>>
>> or something similar to the call to org-store-link-props?
>>
>> Also, feel free to add any other properties that might
>> provide useful information for a template.
>
>
> Doesn't that apply to certain link types only?
>
> Also, the situation seems to be different for org-protocol-remember. I
> think it's the way remember is used inside that function that has to
> be
> changed.
> Maybe I can figure that out.
Sorry my mistake. Indeed, the way you call org-remember
overwrites the link property list. What you need to do is this:
(let (remember-annotation-functions)
(org-remember nil (string-to-char template)))
Now, another advantage of doing it like this is that you
do not even have to create a temporary buffer from which you
launch org-remember. Right now you do this, only for
the effect to get the region inserted for %i.
Much easier will not be to set the :initial property in the
call to org-store-link-props.
Thus, don't even create the *org-protocol* buffer and then do this:
(org-store-link-props :type type
:link url
:annotation (concat "[[" url "][" title "]]")
:initial (or region "")
:description title)
(setq org-stored-links
(cons (list url title) org-stored-links))
(raise-frame)
(kill-new orglink)
(let (remember-annotation-functions)
(org-remember nil (string-to-char template)))
I hope that this will take care of it.
- Carsten
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-03 7:47 ` Carsten Dominik
@ 2009-04-03 12:06 ` Sebastian Rose
2009-04-03 12:34 ` Sebastian Rose
1 sibling, 0 replies; 14+ messages in thread
From: Sebastian Rose @ 2009-04-03 12:06 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Tassilo Horn, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 62 bytes --]
Ahaaa, thanks Carsten!
That's good. So this here will do:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1267 bytes --]
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 1593764..b368602 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -335,23 +335,18 @@ Now template ?b will be used."
(match-string 1 url)))
(title (cadr parts))
(region (caddr parts))
- orglink)
+ orglink
+ remember-annotation-functions)
(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)
(kill-new orglink)
- (set-buffer b)
- (insert region)
- (mark-whole-buffer)
- (org-remember nil (string-to-char template))
- (kill-buffer b))
- (message "Org-mode not loaded."))
+ (org-store-link-props :type type
+ :link url
+ :description title
+ :initial region)
+ (raise-frame)
+ (org-remember nil (string-to-char template))))
nil)
[-- Attachment #3: Type: text/plain, Size: 2706 bytes --]
...which is much simpler than before :)
Best,
Sebastian
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Apr 2, 2009, at 8:00 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> Hi Sebastian, Tassilo,
>>>
>>> this can be easily fixed.
>>>
>>> Org-protocol may add arbitrary properties to the link properties.
>>> For example, after a call
>>>
>>> (org-store-link-props :type type
>>> :link url
>>> :region region
>>> :description title
>>> :hello "Hello world")
>>>
>>> a template could use "%:hello" to access and insert this
>>> string. I have just changed org-remember so that the
>>> property :annotation will be the default for %a.
>>> Sebastian, could you please add
>>>
>>> :annotation (concat "[[" url "][" title "]]")
>>>
>>> or something similar to the call to org-store-link-props?
>>>
>>> Also, feel free to add any other properties that might
>>> provide useful information for a template.
>>
>>
>> Doesn't that apply to certain link types only?
>>
>> Also, the situation seems to be different for org-protocol-remember. I
>> think it's the way remember is used inside that function that has to be
>> changed.
>> Maybe I can figure that out.
>
> Sorry my mistake. Indeed, the way you call org-remember
> overwrites the link property list. What you need to do is this:
>
> (let (remember-annotation-functions)
> (org-remember nil (string-to-char template)))
>
> Now, another advantage of doing it like this is that you
> do not even have to create a temporary buffer from which you
> launch org-remember. Right now you do this, only for
> the effect to get the region inserted for %i.
>
> Much easier will not be to set the :initial property in the
> call to org-store-link-props.
>
> Thus, don't even create the *org-protocol* buffer and then do this:
>
> (org-store-link-props :type type
> :link url
> :annotation (concat "[[" url "][" title "]]")
> :initial (or region "")
> :description title)
> (setq org-stored-links
> (cons (list url title) org-stored-links))
> (raise-frame)
> (kill-new orglink)
> (let (remember-annotation-functions)
> (org-remember nil (string-to-char template)))
>
> I hope that this will take care of it.
>
> - Carsten
>
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
[-- Attachment #4: 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 related [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-03 7:47 ` Carsten Dominik
2009-04-03 12:06 ` Sebastian Rose
@ 2009-04-03 12:34 ` Sebastian Rose
2009-04-03 16:58 ` Carsten Dominik
1 sibling, 1 reply; 14+ messages in thread
From: Sebastian Rose @ 2009-04-03 12:34 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Tassilo Horn, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
I encountered another problem:
Using `C-c C-k' in the remember buffer is OK.
But if the user interupts `org-remember' by `C-g' (e.g. when reading
some text interactively), emacsclient will be waiting for ever.
Unfortunately, there seems no easy way to fix this in a way, that we
could mix org-protocol arguments and filenames for emacsclient.
A solution for this problem is, to introduce a new property:
(defconst org-protocol-protocol-alist-default
'(("org-remember" :protocol "remember" :function org-protocol-remember :kill-client t)
...
and unconditionally kill the client, once a sub-protocol with a non-nil
`:kill-client' property is detected.
The appended patch does all the changes we need:
- call org-remember the right way
- kill emacsclient for org-protocol-remember and all those handlers,
which have the `:kill-client' property set to a non-nil value.
Regards,
Sebastian
[-- Attachment #2: patch-org-protocol.el --]
[-- Type: application/emacs-lisp, Size: 6244 bytes --]
[-- Attachment #3: Type: text/plain, Size: 2641 bytes --]
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Apr 2, 2009, at 8:00 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> Hi Sebastian, Tassilo,
>>>
>>> this can be easily fixed.
>>>
>>> Org-protocol may add arbitrary properties to the link properties.
>>> For example, after a call
>>>
>>> (org-store-link-props :type type
>>> :link url
>>> :region region
>>> :description title
>>> :hello "Hello world")
>>>
>>> a template could use "%:hello" to access and insert this
>>> string. I have just changed org-remember so that the
>>> property :annotation will be the default for %a.
>>> Sebastian, could you please add
>>>
>>> :annotation (concat "[[" url "][" title "]]")
>>>
>>> or something similar to the call to org-store-link-props?
>>>
>>> Also, feel free to add any other properties that might
>>> provide useful information for a template.
>>
>>
>> Doesn't that apply to certain link types only?
>>
>> Also, the situation seems to be different for org-protocol-remember. I
>> think it's the way remember is used inside that function that has to be
>> changed.
>> Maybe I can figure that out.
>
> Sorry my mistake. Indeed, the way you call org-remember
> overwrites the link property list. What you need to do is this:
>
> (let (remember-annotation-functions)
> (org-remember nil (string-to-char template)))
>
> Now, another advantage of doing it like this is that you
> do not even have to create a temporary buffer from which you
> launch org-remember. Right now you do this, only for
> the effect to get the region inserted for %i.
>
> Much easier will not be to set the :initial property in the
> call to org-store-link-props.
>
> Thus, don't even create the *org-protocol* buffer and then do this:
>
> (org-store-link-props :type type
> :link url
> :annotation (concat "[[" url "][" title "]]")
> :initial (or region "")
> :description title)
> (setq org-stored-links
> (cons (list url title) org-stored-links))
> (raise-frame)
> (kill-new orglink)
> (let (remember-annotation-functions)
> (org-remember nil (string-to-char template)))
>
> I hope that this will take care of it.
>
> - Carsten
>
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
[-- Attachment #4: 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] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-03 12:34 ` Sebastian Rose
@ 2009-04-03 16:58 ` Carsten Dominik
0 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2009-04-03 16:58 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Tassilo Horn, emacs-orgmode
Applied, thanks.
Would you mind turning on indent-tabs-mode in these files?
I am having trouble wit the patches because of this.
Thanks.
- Carsten
On Apr 3, 2009, at 2:34 PM, Sebastian Rose wrote:
>
>
> I encountered another problem:
>
> Using `C-c C-k' in the remember buffer is OK.
>
> But if the user interupts `org-remember' by `C-g' (e.g. when reading
> some text interactively), emacsclient will be waiting for ever.
>
>
> Unfortunately, there seems no easy way to fix this in a way, that we
> could mix org-protocol arguments and filenames for emacsclient.
>
> A solution for this problem is, to introduce a new property:
>
>
> (defconst org-protocol-protocol-alist-default
> '(("org-remember" :protocol "remember" :function org-protocol-
> remember :kill-client t)
> ...
>
> and unconditionally kill the client, once a sub-protocol with a non-
> nil
> `:kill-client' property is detected.
>
>
>
> The appended patch does all the changes we need:
>
> - call org-remember the right way
> - kill emacsclient for org-protocol-remember and all those
> handlers,
> which have the `:kill-client' property set to a non-nil value.
>
>
>
> Regards,
>
> Sebastian
>
>
> <patch-org-protocol.el>
>
>
>
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Apr 2, 2009, at 8:00 PM, Sebastian Rose wrote:
>>
>>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>>> Hi Sebastian, Tassilo,
>>>>
>>>> this can be easily fixed.
>>>>
>>>> Org-protocol may add arbitrary properties to the link properties.
>>>> For example, after a call
>>>>
>>>> (org-store-link-props :type type
>>>> :link url
>>>> :region region
>>>> :description title
>>>> :hello "Hello world")
>>>>
>>>> a template could use "%:hello" to access and insert this
>>>> string. I have just changed org-remember so that the
>>>> property :annotation will be the default for %a.
>>>> Sebastian, could you please add
>>>>
>>>> :annotation (concat "[[" url "][" title "]]")
>>>>
>>>> or something similar to the call to org-store-link-props?
>>>>
>>>> Also, feel free to add any other properties that might
>>>> provide useful information for a template.
>>>
>>>
>>> Doesn't that apply to certain link types only?
>>>
>>> Also, the situation seems to be different for org-protocol-
>>> remember. I
>>> think it's the way remember is used inside that function that has
>>> to be
>>> changed.
>>> Maybe I can figure that out.
>>
>> Sorry my mistake. Indeed, the way you call org-remember
>> overwrites the link property list. What you need to do is this:
>>
>> (let (remember-annotation-functions)
>> (org-remember nil (string-to-char template)))
>>
>> Now, another advantage of doing it like this is that you
>> do not even have to create a temporary buffer from which you
>> launch org-remember. Right now you do this, only for
>> the effect to get the region inserted for %i.
>>
>> Much easier will not be to set the :initial property in the
>> call to org-store-link-props.
>>
>> Thus, don't even create the *org-protocol* buffer and then do this:
>>
>> (org-store-link-props :type type
>> :link url
>> :annotation (concat "[[" url "][" title "]]")
>> :initial (or region "")
>> :description title)
>> (setq org-stored-links
>> (cons (list url title) org-stored-links))
>> (raise-frame)
>> (kill-new orglink)
>> (let (remember-annotation-functions)
>> (org-remember nil (string-to-char template)))
>>
>> I hope that this will take care of it.
>>
>> - Carsten
>>
>
> --
> Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449
> Hannover
> Tel.: +49 (0)511 - 36 58 472
> Fax: +49 (0)1805 - 233633 - 11044
> mobil: +49 (0)173 - 83 93 417
> Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
> Http: www.emma-stil.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-02 6:50 org-protocol://remember:// question Tassilo Horn
2009-04-02 11:10 ` Sebastian Rose
@ 2009-04-03 22:59 ` Sebastian Rose
2009-04-04 9:42 ` Tassilo Horn
1 sibling, 1 reply; 14+ messages in thread
From: Sebastian Rose @ 2009-04-03 22:59 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-orgmode
Hi Tassilo,
the issue should be fixed now. The docs should now match the reality.
Your templates may refer to the page title through
%:description
See
http://orgmode.org/worg/org-contrib/org-protocol.php#example-template
once it's updated.
Best regards,
Sebastian
Tassilo Horn <tassilo@member.fsf.org> writes:
> Hi all,
>
> first I'd like to say that this is superb. It'll deprecate my
> home-brewn remember webpage hacks for conkeror soon. :-)
>
> Ok, now the problem I have: I defined a remember template for
> remembering pages from my browser like that:
>
>
> (setq org-default-notes-file "~/repos/org/remember.org"
> org-remember-default-headline 'bottom
> org-remember-templates
> '(;; TODOs
> ("TODO" ?t "* TODO %?\n (created: %U)\n %i\n %a")
> ("BROWSER" ?b "* BROWSER %a\n (created: %U)\n\n %A\n\n %i")))
>
> When I execute
>
> emacsclient \
> 'org-protocol://remember://b/http:%2F%2Flocalhost%2Findex.html/The%20title/body'
>
> now I get a remember buffer with these contents:
>
>
> * BROWSER
> (created: [2009-04-02 Thu 08:41])
>
>
>
> body
>
> Accorting to the template table at [1] I thought that the TITLE would be
> filled in after BROWSER, and the [[URL][TITLE]] link between the
> timestamp and the BODY. But that's not the case. The [[URL][TITLE]] is
> on top of the kill-ring, though.
>
> What am I doing wrong?
>
> BTW: Has some Conkeror user managed to setup an org-protocol handler
> yet?
>
> Bye,
> Tassilo
> __________
> [1] http://orgmode.org/worg/org-contrib/org-protocol.php
--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.: +49 (0)511 - 36 58 472
Fax: +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http: www.emma-stil.de
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-03 22:59 ` Sebastian Rose
@ 2009-04-04 9:42 ` Tassilo Horn
2009-04-04 13:39 ` Sebastian Rose
0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2009-04-04 9:42 UTC (permalink / raw)
To: emacs-orgmode
Sebastian Rose <sebastian_rose@gmx.de> writes:
Hi Sebastian,
> the issue should be fixed now. The docs should now match the reality.
>
> Your templates may refer to the page title through
>
> %:description
>
> See
> http://orgmode.org/worg/org-contrib/org-protocol.php#example-template
> once it's updated.
Ok, now I use this template
("BROWSER" ?w "* BROWSER %:description\n (created: %U)\n\n %c\n\n %i")
and all fields are filled in. Thanks!
But one question remains. Do I have to do some special quoting in order
to allow the protocol to split URL, TITLE and TEXT correctly? Let's say
I do
emacsclient -c \
'org-protocol:/remember:/http://www.google.de/the search engine/bla fasel bla'
the link (%c) looks like [[http:][www.google.de]] which in not quite
correct.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Re: org-protocol://remember:// question
2009-04-04 9:42 ` Tassilo Horn
@ 2009-04-04 13:39 ` Sebastian Rose
2009-04-04 17:36 ` Tassilo Horn
0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Rose @ 2009-04-04 13:39 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-orgmode
Tassilo Horn <tassilo@member.fsf.org> writes:
> But one question remains. Do I have to do some special quoting in order
> to allow the protocol to split URL, TITLE and TEXT correctly? Let's say
> I do
>
> emacsclient -c \
> 'org-protocol:/remember:/http://www.google.de/the search engine/bla fasel bla'
>
> the link (%c) looks like [[http:][www.google.de]] which in not quite
> correct.
Yes. The best is to URL-encode the fields.
The slash is used as field separator for the following reason:
emacsclient compresses double or tripple slashes to one ("//" -> "/"),
which means those double slashes won't survive a call.
http://www.google.de/the search engine/
would become
http:/www.google.de/the search engine/
Hence we must encode slashes anyway. Double slashes are quite common on
web pages and could also reside in their titles.
But you could use any string as separator in custom handlers.
Best,
Sebastian
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: org-protocol://remember:// question
2009-04-04 13:39 ` Sebastian Rose
@ 2009-04-04 17:36 ` Tassilo Horn
0 siblings, 0 replies; 14+ messages in thread
From: Tassilo Horn @ 2009-04-04 17:36 UTC (permalink / raw)
To: emacs-orgmode
Sebastian Rose <sebastian_rose@gmx.de> writes:
Hi Sebastian,
> Yes. The best is to URL-encode the fields.
Ok, no problem. I guess they're url-encoded when I get them inside
Conkeror, anyway.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-04-04 17:36 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 6:50 org-protocol://remember:// question Tassilo Horn
2009-04-02 11:10 ` Sebastian Rose
2009-04-02 12:28 ` Sebastian Rose
2009-04-02 16:03 ` Carsten Dominik
2009-04-02 16:03 ` Carsten Dominik
2009-04-02 18:00 ` Sebastian Rose
2009-04-03 7:47 ` Carsten Dominik
2009-04-03 12:06 ` Sebastian Rose
2009-04-03 12:34 ` Sebastian Rose
2009-04-03 16:58 ` Carsten Dominik
2009-04-03 22:59 ` Sebastian Rose
2009-04-04 9:42 ` Tassilo Horn
2009-04-04 13:39 ` Sebastian Rose
2009-04-04 17:36 ` Tassilo Horn
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.