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

2018-02-07 Thread Rasmus
Lawrence Bottorff  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




[O] Prompt org-capture for buffer?

2018-02-06 Thread Lawrence Bottorff
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