From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: org mode capture to headline at point Date: Sat, 28 May 2016 08:49:28 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1148b4402996160533e096a9 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6X7r-0004Pi-TU for emacs-orgmode@gnu.org; Sat, 28 May 2016 01:49:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6X7p-000347-Nn for emacs-orgmode@gnu.org; Sat, 28 May 2016 01:49:30 -0400 Received: from mail-yw0-x241.google.com ([2607:f8b0:4002:c05::241]:35390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6X7p-000341-IW for emacs-orgmode@gnu.org; Sat, 28 May 2016 01:49:29 -0400 Received: by mail-yw0-x241.google.com with SMTP id n16so8957401ywd.2 for ; Fri, 27 May 2016 22:49:28 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Ian McB Cc: org mode --001a1148b4402996160533e096a9 Content-Type: text/plain; charset=UTF-8 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 wrote: > Xebar Saram 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. > > > --001a1148b4402996160533e096a9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thx ian

this is very useful!
=
i wonder if any of the elisp gurus would know a workaround t= he fact that the point needs to be on the starting asterix? it would be coo= l to just not worry where the point is in the current header and have the c= apture 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> write= s:

>
> Hi all
> any one knows how to launch a capture (thats pre defined) but auto ref= ile
that capture to the/beneath the current header at point?
>
> thx
>
> Z
>


A while back I stumbled onto this thread looking for the same p= roblem. 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:
=C2=A0 =C2=A0 =C2=A0("ss" "Future subtask" entry
=C2=A0 =C2=A0 =C2=A0 (function my-org-move-point-to-capture)
=C2=A0 =C2=A0 =C2=A0 "* TODO %?
=C2=A0 :PROPERTIES:
=C2=A0 :Created: %U
=C2=A0 :END:")

the necessary function
(defun my-org-move-point-to-capture ()
=C2=A0 (cond ((org-at-heading-p) (org-beginning-of-line))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (t (org-previous-visible-heading 1))))

So pretty simple all in all. Keep in mind I'm pretty new to Elisp, Emac= s 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<= br> behaviour to end up at that asterisk is different depending on whether poin= t
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.



--001a1148b4402996160533e096a9--