From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: [BUG] org-capture: file+function Date: Fri, 20 Aug 2010 17:08:49 +0200 Message-ID: References: <814oesdqn3.fsf@gmail.com> <8139ubhpa8.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=41421 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmUMv-0002tk-L0 for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 12:23:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmUMu-0004Mb-E6 for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 12:23:01 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:53857) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmUMu-0004MU-7A for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 12:23:00 -0400 Received: by eyg7 with SMTP id 7so2382052eyg.0 for ; Fri, 20 Aug 2010 09:22:59 -0700 (PDT) In-Reply-To: <8139ubhpa8.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jambunathan K Cc: emacs-orgmode@gnu.org 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