emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: [BUG] org-capture: file+function
Date: Fri, 20 Aug 2010 17:08:49 +0200	[thread overview]
Message-ID: <BC63E369-F650-4643-92DA-FA52C77699DD@gmail.com> (raw)
In-Reply-To: <8139ubhpa8.fsf@gmail.com>

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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

  reply	other threads:[~2010-08-20 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 12:58 [BUG] org-capture: file+function Jambunathan K
2010-08-18 16:13 ` Jambunathan K
2010-08-20 15:08   ` Carsten Dominik [this message]
2010-09-03  1:38   ` Bastien
2010-09-03  1:36 ` Bastien

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=BC63E369-F650-4643-92DA-FA52C77699DD@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kjambunathan@gmail.com \
    /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).