emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: [BUG] org-capture: file+function


From: Carsten Dominik
Subject: Re: [Orgmode] Re: [BUG] org-capture: file+function
Date: Fri, 20 Aug 2010 17:08:49 +0200

Hi,

On Aug 18, 2010, at 6:13 PM, Jambunathan K wrote:


   jambu> I wonder whether this - "create entry at the target file at
   jambu> the current cursor location" - is a common workflow for
   jambu> others. If yes, may be having an escape sequence for this
   jambu> would be a good idea.

Went for a jog. As a result I think there could be some disagreement on
whether this is a bug.

My current need is quite simple. I need some way to express this -

1. The captured entry goes in to the given target file.
2. It goes under the heading where the cursor is. The cursor may or
  maynot be on the target heading.
3. It goes as a subheading under the current heading. Append or prepend
  as specified.

That said there should be a way to express this as well - the entry goes
where the point is and the way it is specified. (ie dwim)


Here is a capture entry that should do what you want.

((";" "bookmark" plain
  (file+function "~/lib/emacs/work/org-mode/t/b.org"
                 (lambda ()
                   (while (org-up-heading-safe))
                   (org-end-of-subtree t)
                   (or (bolp) (newline))))
  "** %?")



How it works:

1. We use `plain', not `entry' to get the text inserted as it is, with no
   magic to try to adapt the level
2. We make he function first travel up the hierarchy to loose
   any dependence on local current depth
3. The we use org-end-of-subtree to jump to the end of the tree,
   then make sure we are in a new line.

Hope this helps.

- Carsten


Jambunathan K.

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten






reply via email to

[Prev in Thread] Current Thread [Next in Thread]