From: Roberto Huelga <rhuelga@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Patch org-capture-set-target-location
Date: Sat, 22 Nov 2014 20:51:55 +0100 [thread overview]
Message-ID: <CAPJ+JL14BSLDYAiT=Nr=1j-EUrkV82me=GowCuYEuWjgfC4z8w@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 732 bytes --]
Patch proposal for org-capture-set-target-location
The idea is that when somebody use the function or file+function targets
you can make the template subheading from the heading where the
custom-function set the point.
org-capture-set-target-loction force the org-capture-plist :exact-position
to (point).
So the template is inserted in the same level not as subheading
With my patch the custom-function can (org-capture-put :exact-position
nil), and now if point its placed in a heading the template is created as
his subheading.
For a use case can look at the following emacs.stackexchange question
http://emacs.stackexchange.com/questions/3750/org-capture-files-entry-under-wrong-datetree/3765#3765
Thanks.
Roberto Huelga.
[-- Attachment #1.2: Type: text/html, Size: 1484 bytes --]
[-- Attachment #2: 0001-org-capture.el-set-exact-position-only-if-not-set.patch --]
[-- Type: application/octet-stream, Size: 1493 bytes --]
From 7d3c262b14fccc728163d84aded3ec0fe8fa892f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20Huelga=20D=C3=ADaz?= <rhuelga@gmail.com>
Date: Sat, 22 Nov 2014 20:29:56 +0100
Subject: [PATCH] org-capture.el: set :exact-position only if not set
* org-capture.el: (org-capture-set-target-location): on function and
file+function don't set org-capture-plist :exact-position if already
set. So now in the function you can set it to nil, and the template
can be inserted as subheading of the places set by the function.
Patch proposal by Roberto Huelga Díaz
TINYCHANGE
---
lisp/org-capture.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 65de098..afbe607 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -935,12 +935,14 @@ Store them in the capture property list."
(org-capture-put-target-region-and-position)
(widen)
(funcall (nth 2 target))
- (org-capture-put :exact-position (point))
+ (unless (memq :exact-position org-capture-plist)
+ (org-capture-put :exact-position (point)))
(setq target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p))))
((eq (car target) 'function)
(funcall (nth 1 target))
- (org-capture-put :exact-position (point))
+ (unless (memq :exact-position org-capture-plist)
+ (org-capture-put :exact-position (point)))
(setq target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p))))
((eq (car target) 'clock)
--
2.1.2
next reply other threads:[~2014-11-22 19:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-22 19:51 Roberto Huelga [this message]
2014-11-23 18:15 ` Patch org-capture-set-target-location Nicolas Goaziou
2014-11-24 10:54 ` Roberto Huelga
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='CAPJ+JL14BSLDYAiT=Nr=1j-EUrkV82me=GowCuYEuWjgfC4z8w@mail.gmail.com' \
--to=rhuelga@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 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).