emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: %( in capture template
Date: Sun, 19 Feb 2017 16:34:07 -0700	[thread overview]
Message-ID: <CAJcAo8uOJcVn6jbYZ=MEzPJ+H+78Q285zZYF1Y9+h031ROxGQQ@mail.gmail.com> (raw)
In-Reply-To: <87r32uzgzk.fsf@nicolasgoaziou.fr>

On 2/19/17, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> I have trouble understanding the double quote above. Do you mean the
> text below is inserted within the %(concat ...) or are these your
> templates? In this case, which one produces the error?

thanks for asking about this.

for clarity, let's do it from the beginning.

[first please note that i am experiencing random results.  sometimes
it works fine but:

  1] sometimes nothing shows up
  2] sometimes as i will describe below
  3] sometimes nothing shows up, but "Warning (emacs): Please update
your org protocol handler to deal with new-style links." buffer pops
up

what i will describe is 2, which is the topic of this thread.]

just now i selected the first two paragraphs of the quote of your
email, and clicked the org-capture extension unicorn.

i use this function:

(defun alpha-org-protocol-string (link description region)
  (format "* x
           link %s
           description %s
           region %s
           " link description region))

the result of clicking on the unicorn:

===
***** x
           link
https://mail.google.com/mail/u/0/h/rfjkj7op114w/?&th=15a580ccf5cb9d34&v=c
           description Gmail - %( in capture template
           region
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?&th=15a580ccf5cb9d34&v=c"
"Gmail - %( in capture template" "> with the new org maint code, i
still occasionally get the literal string.
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?&th=15a580ccf5cb9d34&v=c"
"Gmail - %( in capture template" ">
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?&th=15a580ccf5cb9d34&v=c"
"Gmail - %( in capture template" "> it occurs when the region spans a
blank line.
===

region should be what i selected.  instead it is a garbled version of
what i selected with the literal function call text.  is this user
error?

the double quotes are as you see them.  i did not add any.

below are my templates.

  (add-to-list 'org-capture-templates
               `("L" "Protocol L for link" entry
                 (file+headline ,org-default-notes-file "xyzzy-remember")
                 ;; fixme perhaps i do not need the %i, if it is for no text
                 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\") L"
                 :prepend t :immediate-finish t :jump-to-captured t))
  ;; this seems to get called by org capture whether selection or not
  (add-to-list 'org-capture-templates
               `("p" "Protocol p" entry
                 (file+headline ,org-default-notes-file "xyzzy-remember")
                 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\")"
                 :prepend t :immediate-finish t :jump-to-captured t))

the org capture extension is set to p, so the second one should be the
operative one.  but what do i know?

so perhaps %i is being set to some crazy value.

i definitely do not understand any of this stuff.

  reply	other threads:[~2017-02-19 23:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 19:16 %( in capture template Samuel Wales
2017-01-10 23:38 ` Nick Dokos
2017-01-11  0:20   ` Samuel Wales
2017-01-11  8:56     ` Nicolas Goaziou
2017-01-12  2:19       ` Samuel Wales
     [not found]         ` <CAJcAo8u3=OqneKTpKWxBYwJW1Z-N9tQOe1-RZDD2-3OLgZkbxw@mail.gmail.com>
2017-02-09  4:41           ` Samuel Wales
2017-02-19  9:07             ` Nicolas Goaziou
2017-02-19 23:34               ` Samuel Wales [this message]
2017-02-19 23:34                 ` Samuel Wales
2017-03-07  3:45                 ` Samuel Wales
2017-01-11  0:00 ` Nicolas Goaziou
2017-03-13  1:45   ` Samuel Wales
2017-03-14  8:13     ` Nicolas Goaziou
2017-03-17  3:22       ` Samuel Wales

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='CAJcAo8uOJcVn6jbYZ=MEzPJ+H+78Q285zZYF1Y9+h031ROxGQQ@mail.gmail.com' \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).