From: Juan <Pechiar@computer.org>
To: carsten.dominik@gmail.com
Cc: Emacs-orgmode <emacs-orgmode@gnu.org>
Subject: org-capture file+function match [PATCH] + question
Date: Wed, 30 Jun 2010 12:53:57 -0300 [thread overview]
Message-ID: <20100630155357.GA19738@soloJazz.com> (raw)
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)
next reply other threads:[~2010-06-30 15:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 15:53 Juan [this message]
2010-07-05 6:56 ` org-capture file+function match [PATCH] + question Carsten Dominik
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=20100630155357.GA19738@soloJazz.com \
--to=pechiar@computer.org \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.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.