[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] org-capture file+function match [PATCH] + question
From: |
Juan |
Subject: |
[Orgmode] org-capture file+function match [PATCH] + question |
Date: |
Wed, 30 Jun 2010 12:53:57 -0300 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] org-capture file+function match [PATCH] + question,
Juan <=