emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-protocol://remember:// question


From: Sebastian Rose
Subject: Re: [Orgmode] org-protocol://remember:// question
Date: Fri, 03 Apr 2009 14:34:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)


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: patch-org-protocol.el
Description: application/emacs-lisp





Carsten Dominik <address@hidden> writes:
> On Apr 2, 2009, at 8:00 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <address@hidden> 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: address@hidden, address@hidden
Http:  www.emma-stil.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]