* org mode capture to headline at point
@ 2016-05-13 15:08 Xebar Saram
2016-05-13 17:07 ` Phil Hudson
2016-05-24 15:27 ` Ian McB
0 siblings, 2 replies; 6+ messages in thread
From: Xebar Saram @ 2016-05-13 15:08 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
Hi all
any one knows how to launch a capture (thats pre defined) but auto refile
that capture to the/beneath the current header at point?
thx
Z
[-- Attachment #2: Type: text/html, Size: 240 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: org mode capture to headline at point
2016-05-13 15:08 org mode capture to headline at point Xebar Saram
@ 2016-05-13 17:07 ` Phil Hudson
2016-05-24 15:27 ` Ian McB
1 sibling, 0 replies; 6+ messages in thread
From: Phil Hudson @ 2016-05-13 17:07 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode
On Fri, 13 May 2016 at 4:08:04 pm BST, Xebar Saram <zeltakc@gmail.com> wrote:
> any one knows how to launch a capture (thats pre defined) but auto refile that
> capture to the/beneath the current header at point?
Hope I've understood your requirement correctly. I think this will do
what you want:
If you can redefine the capture template, then use the 'function' target
location option and specify a function that either does nothing (if you
will always have point /exactly/ where you want the capture inserted
before you invoke capture), or else one that inserts the start of a new
entry below point. Then you can just C-c C-c to get your capture where
you want it instead of C-c C-w, no refile required.
--
Phil Hudson http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: org mode capture to headline at point
2016-05-13 15:08 org mode capture to headline at point Xebar Saram
2016-05-13 17:07 ` Phil Hudson
@ 2016-05-24 15:27 ` Ian McB
2016-05-28 5:49 ` Xebar Saram
1 sibling, 1 reply; 6+ messages in thread
From: Ian McB @ 2016-05-24 15:27 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc <at> gmail.com> writes:
>
> Hi all
> any one knows how to launch a capture (thats pre defined) but auto refile
that capture to the/beneath the current header at point?
>
> thx
>
> Z
>
A while back I stumbled onto this thread looking for the same problem. Like
Phil Hudson suggested I created a capture template using a custom function.
I'll share my solution below.
one of the capture templates using the function:
("ss" "Future subtask" entry
(function my-org-move-point-to-capture)
"* TODO %?
:PROPERTIES:
:Created: %U
:END:")
the necessary function
(defun my-org-move-point-to-capture ()
(cond ((org-at-heading-p) (org-beginning-of-line))
(t (org-previous-visible-heading 1))))
So pretty simple all in all. Keep in mind I'm pretty new to Elisp, Emacs and
org-mode. One gotcha in writing the function which I didn't find easily
documented was that (point) needs to end up over the asterisk starting a
headline to result in the capture being a subheading of that headline. The
behaviour to end up at that asterisk is different depending on whether point
is in the body of the heading or on the headline itself at the time of
capturing.
Hope this is useful. I've been wanting to subscribe to this list for a while
now, to ask about some bugs and strange behaviours.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: org mode capture to headline at point
2016-05-24 15:27 ` Ian McB
@ 2016-05-28 5:49 ` Xebar Saram
2016-05-28 14:00 ` yanmcbe
0 siblings, 1 reply; 6+ messages in thread
From: Xebar Saram @ 2016-05-28 5:49 UTC (permalink / raw)
To: Ian McB; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]
Thx ian
this is very useful!
i wonder if any of the elisp gurus would know a workaround the fact that
the point needs to be on the starting asterix? it would be cool to just not
worry where the point is in the current header and have the capture add
another same level header below
best
Z
On Tue, May 24, 2016 at 6:27 PM, Ian McB <yanmcbe@gmail.com> wrote:
> Xebar Saram <zeltakc <at> gmail.com> writes:
>
> >
> > Hi all
> > any one knows how to launch a capture (thats pre defined) but auto refile
> that capture to the/beneath the current header at point?
> >
> > thx
> >
> > Z
> >
>
>
> A while back I stumbled onto this thread looking for the same problem. Like
> Phil Hudson suggested I created a capture template using a custom function.
> I'll share my solution below.
>
> one of the capture templates using the function:
> ("ss" "Future subtask" entry
> (function my-org-move-point-to-capture)
> "* TODO %?
> :PROPERTIES:
> :Created: %U
> :END:")
>
> the necessary function
> (defun my-org-move-point-to-capture ()
> (cond ((org-at-heading-p) (org-beginning-of-line))
> (t (org-previous-visible-heading 1))))
>
> So pretty simple all in all. Keep in mind I'm pretty new to Elisp, Emacs
> and
> org-mode. One gotcha in writing the function which I didn't find easily
> documented was that (point) needs to end up over the asterisk starting a
> headline to result in the capture being a subheading of that headline. The
> behaviour to end up at that asterisk is different depending on whether
> point
> is in the body of the heading or on the headline itself at the time of
> capturing.
>
> Hope this is useful. I've been wanting to subscribe to this list for a
> while
> now, to ask about some bugs and strange behaviours.
>
>
>
[-- Attachment #2: Type: text/html, Size: 2501 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-29 15:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-13 15:08 org mode capture to headline at point Xebar Saram
2016-05-13 17:07 ` Phil Hudson
2016-05-24 15:27 ` Ian McB
2016-05-28 5:49 ` Xebar Saram
2016-05-28 14:00 ` yanmcbe
2016-05-29 15:07 ` Xebar Saram
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).