[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Capture feature suggestion: place the mark from a template
From: |
Nick Dokos |
Subject: |
Re: [O] Capture feature suggestion: place the mark from a template |
Date: |
Tue, 24 Apr 2012 10:53:39 -0400 |
Colin Fraizer <address@hidden> wrote:
> I use a capture template like this:
>
> ("t" "Todo" entry (file+headline "todo.org" "Tasks")
> "* TODO %?\n :HIDDEN:\n %U\n :END:\n%!" :prepend t)
>
> to create todo items. I want the cursor to be at the end of the
> headline so I can type that in, but then I want to be able to quickly
> jump to the end so I can type any details that I want.
>
> I use "the mark" for that purpose, so I can type "C-x C-x" to jump
> right where I want. So I modified the function
> org-capture-place-entry to add the following lines:
>
> (goto-char beg)
> (if (re-search-forward "%!" end t)
> (progn
> (push-mark nil t nil)
> (replace-match "")))
>
> just before the final (goto-char beg) that will put the cursor
> position at "%?".
>
> (I guess I could have put that following ``(goto-char beg)'' inside
> that ``(progn ...)''.)
>
> Would anyone else find this a useful addition to the capture template
> mechanism?
>
Maybe - but in this particular case, you could just go to the end of the
buffer with M-> (end-of-buffer), right?
And there might be a problem with your proposal: if I push a bunch of
marks during the capture, what happens after the capture is done? Are
they still on the stack? If so, should they be?
Nick