From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Prompt org-capture for buffer? Date: Wed, 07 Feb 2018 16:47:40 +0100 Message-ID: <87h8qshkdf.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejRxU-0007p8-F5 for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 10:48:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejRxQ-0000uD-64 for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 10:48:28 -0500 Received: from [195.159.176.226] (port=47852 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejRxP-0000u5-UB for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 10:48:24 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ejRv9-00065X-7s for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 16:46:03 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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