emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Prompt org-capture for buffer?
@ 2018-02-06 20:28 Lawrence Bottorff
  2018-02-07 15:47 ` Rasmus
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Bottorff @ 2018-02-06 20:28 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

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?

LB

[-- Attachment #2: Type: text/html, Size: 564 bytes --]

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

* Re: Prompt org-capture for buffer?
  2018-02-06 20:28 Prompt org-capture for buffer? Lawrence Bottorff
@ 2018-02-07 15:47 ` Rasmus
  0 siblings, 0 replies; 2+ messages in thread
From: Rasmus @ 2018-02-07 15:47 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> 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

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

end of thread, other threads:[~2018-02-07 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 20:28 Prompt org-capture for buffer? Lawrence Bottorff
2018-02-07 15:47 ` Rasmus

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