From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-protocol://remember:// question Date: Thu, 2 Apr 2009 18:03:24 +0200 Message-ID: <237B552C-F72D-49A0-9250-7B26D39E464F@gmail.com> References: <87ocvfh7lc.fsf@thinkpad.tsdh.de> <8763hn48gj.fsf@kassiopeya.MSHEIMNETZ> <871vsb44u6.fsf@kassiopeya.MSHEIMNETZ> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary="===============1251201924==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LpPPB-00036y-53 for emacs-orgmode@gnu.org; Thu, 02 Apr 2009 12:04:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LpPP5-0002wU-FX for emacs-orgmode@gnu.org; Thu, 02 Apr 2009 12:04:36 -0400 Received: from [199.232.76.173] (port=56602 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LpPP5-0002vu-1k for emacs-orgmode@gnu.org; Thu, 02 Apr 2009 12:04:31 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:37229) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LpPP3-0006uQ-Rc for emacs-orgmode@gnu.org; Thu, 02 Apr 2009 12:04:30 -0400 Received: by ewy4 with SMTP id 4so647925ewy.42 for ; Thu, 02 Apr 2009 09:04:28 -0700 (PDT) In-Reply-To: <871vsb44u6.fsf@kassiopeya.MSHEIMNETZ> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastian Rose Cc: Tassilo Horn , emacs-orgmode@gnu.org --===============1251201924== Content-Type: multipart/alternative; boundary=Apple-Mail-1-535483674 --Apple-Mail-1-535483674 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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 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 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 --Apple-Mail-1-535483674 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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."
=             (c= ons (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)
=             &n= bsp;(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%2= 0title/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://orgmo= de.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

= --Apple-Mail-1-535483674-- --===============1251201924== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1251201924==--