emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Tassilo Horn <tassilo@member.fsf.org>, emacs-orgmode@gnu.org
Subject: Re: org-protocol://remember:// question
Date: Fri, 03 Apr 2009 14:06:35 +0200	[thread overview]
Message-ID: <87ab6yym9g.fsf@kassiopeya.MSHEIMNETZ> (raw)
In-Reply-To: <C95FA732-90DE-4F6D-A42C-CB5CB3073BDB@gmail.com> (Carsten Dominik's message of "Fri, 3 Apr 2009 09:47:47 +0200")

[-- 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

  reply	other threads:[~2009-04-03 12:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ab6yym9g.fsf@kassiopeya.MSHEIMNETZ \
    --to=sebastian_rose@gmx.de \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).