emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-capture: file+function
@ 2010-08-18 12:58 Jambunathan K
  2010-08-18 16:13 ` Jambunathan K
  2010-09-03  1:36 ` Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: Jambunathan K @ 2010-08-18 12:58 UTC (permalink / raw)
  To: emacs-orgmode


I have run into couple of issues with file+function templates. Let me
explain.

I have the following entry in org-capture-templates

(
 ("b" "Bookmarks" entry
  (file+function "~/bookmark.org" point)
  "** %c\n   %i \n   %?"))

The intention is to add a bookmark entry at the cursor position. This
entry gets triggered by an org-protocol://capture://b/... entry in the
browser

With the above setup I notice the following.

1. Entry doesn't get added at the cursor position.

   For example, create an empty bookmark.org like this.

   * Heading1

   and position cursor at the end of the heading line.

   Trigger a bookmark entry. Notice that the entry gets added *before*
   the heading line.

2. Entry gets added with single '*' as opposed to '**' (Latter one was
    what was advised)

IMHO, org-mode shouldn't override my advise when creating such
file+function entries.

To elaborate further,

When I am researching a topic, I create a new headline in the
bookmark.org and all subsequent bookmarks gets added to the cursor
position. When I move on to another topic, I create another heading and
position my cursor underneath it and all future bookmarks go under the
new topic.

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

Jambunathan K.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] org-capture: file+function
  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
  2010-09-03  1:38   ` Bastien
  2010-09-03  1:36 ` Bastien
  1 sibling, 2 replies; 5+ messages in thread
From: Jambunathan K @ 2010-08-18 16:13 UTC (permalink / raw)
  To: emacs-orgmode


    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)

Jambunathan K.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [BUG] org-capture: file+function
  2010-08-18 16:13 ` Jambunathan K
@ 2010-08-20 15:08   ` Carsten Dominik
  2010-09-03  1:38   ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-08-20 15:08 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] org-capture: file+function
  2010-08-18 12:58 [BUG] org-capture: file+function Jambunathan K
  2010-08-18 16:13 ` Jambunathan K
@ 2010-09-03  1:36 ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2010-09-03  1:36 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

> I wonder whether this - "create entry at the target file at the current
> cursor location" - is a common workflow for others.

I don't know about others, but I don't have this need and I think
implementing this might lead to a lot of manual mistakes - what if your
cursor is not really where you think it is?  Or not at a beginning of a
line?

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [BUG] org-capture: file+function
  2010-08-18 16:13 ` Jambunathan K
  2010-08-20 15:08   ` Carsten Dominik
@ 2010-09-03  1:38   ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2010-09-03  1:38 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

> 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)

Org is very good at helping us UWWRN vs DWIM.

;)

PS: "understand what we really need"

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-03  1:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2010-09-03  1:38   ` Bastien
2010-09-03  1:36 ` Bastien

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).