From: Carsten Dominik <carsten.dominik@gmail.com>
To: Juan <pechiar@computer.org>
Cc: Emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-capture file+function match [PATCH] + question
Date: Mon, 5 Jul 2010 08:56:17 +0200 [thread overview]
Message-ID: <D21F2256-10EF-4538-810B-CFD2AEC714C1@gmail.com> (raw)
In-Reply-To: <20100630155357.GA19738@soloJazz.com>
Hi Juan,
I have now taken a look at the file+regexp, file+function,
and function targets in capture. They should work now, including
using :prepend to position at the beginning of the regexp
in the file+regexp target specification. For file+function and
for function, :prepend has no effect.
If you still feel like testing them, this would be much appreciated.
- Carsten
On Jun 30, 2010, at 5:53 PM, Juan wrote:
> Hi Carsten,
>
> Below is a patch for file+function matching (nth 1 instead of nth 2
> when calling the match function).
>
>
> Question:
>
> I'm having trouble with both file+function and file+regexp capture
> targets.
>
> My actual capture text ends up at the end of the file (or top of file
> if :prepend is set), instead of at the point of match.
>
> I think it has something to do with org-capture-place-entry, after the
> suspicious comment:
>
> (cond
> ((not target-entry-p)
> ;; Insert as top-level entry, either at beginning or at end of
> file
>
> I would expect the cursor to stay at the point of match (match-end or
> match-beginning depending on :prepend).
>
> An example template and match function goes below.
>
> Am I missing something?
>
> Saludos,
> .j.
>
>
> 8<---- example template & function ------------------------------
>
> Example template:
>
> '(("h" "New clock-in" plain
> (file+function "~/shared/everything.org" match-function)
> "*** %u %^{Task}\n " :prepend t :immediate-finish
> t :clock-in t))
>
> Example matching function:
>
> (defun match-function ()
> (goto-char (point-min))
> (search-forward "<<insert-here>>")
> (goto-char (match-beginning 0))
> )
>
>
> 8<----- PATCH -------------------------------------------------------
>
> diff --git a/lisp/org-capture.el b/lisp/org-capture.el
> index fb3c06a..f12826a 100644
> --- a/lisp/org-capture.el
> +++ b/lisp/org-capture.el
> @@ -586,7 +586,7 @@ already gone."
>
> ((eq (car target) 'file+function)
> (set-buffer (org-capture-target-buffer (nth 1 target)))
> - (funcall (nth 1 target))
> + (funcall (nth 2 target))
> (setq target-entry-p (and (org-mode-p) (org-at-heading-p))))
>
> ((eq (car target) 'clock)
- Carsten
prev parent reply other threads:[~2010-07-05 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 15:53 org-capture file+function match [PATCH] + question Juan
2010-07-05 6:56 ` Carsten Dominik [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D21F2256-10EF-4538-810B-CFD2AEC714C1@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=pechiar@computer.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 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.