emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Prompt org-capture for buffer?


From: Rasmus
Subject: Re: [O] Prompt org-capture for buffer?
Date: Wed, 07 Feb 2018 16:47:40 +0100
User-agent: Emacs Gnus

Lawrence Bottorff <address@hidden> writes:

> I've got this
>
>  '(org-capture-templates
>    (quote
>     (("a" "Normal add" entry (file "~/org/notes.org")
>       "* %(plainutc)\n%x%?"))))
>
> But it wants to put my captured things into ~/org/notes.org . Is there any
> way to have it prompt for which buffer to add to -- or even just put it in
> the active buffer?

You could either use "file+function" or "function" and write a function to
find location or file/buffer and location, respectively.  See the
‘org-capture-templates’ docstring.

             (file+function "path/to/file" function-finding-location)
                 A function to find the right location in the file

             (function function-finding-location)
                Most general way: write your own function which both visits
                the file and moves point to the right location

Functions take no arguments and in the case of file+function, the function
is run from the file buffer.

Example:

            (file+function "~/doc.org"
                           (lambda ()
                             (org-goto-local-search-headings
                              (ido-completing-read
                               "File note to: "
                               (org-element-map
                                   (org-element-parse-buffer)
                                   'headline
                                 (lambda (hl)
                                   (and (= (org-element-property :level hl) 1)
                                        (org-element-property :title hl)))))
                              nil nil)
                             (forward-line 1))
             :prepend t
             :empty-lines-after 1)


Hope it helps,
Rasmus

-- 
. . . It begins of course with The Internet.  A Net of Peers




reply via email to

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