From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pohlack Subject: org-remember to org-capture Date: Fri, 27 Jan 2012 15:05:50 +0100 Message-ID: <4F22AF3E.70109@os.inf.tu-dresden.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqmRB-0007zE-UX for emacs-orgmode@gnu.org; Fri, 27 Jan 2012 09:06:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqmR6-0001Fw-MV for emacs-orgmode@gnu.org; Fri, 27 Jan 2012 09:05:57 -0500 Received: from os.inf.tu-dresden.de ([141.76.48.99]:39385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqmR6-0001Fk-Hh for emacs-orgmode@gnu.org; Fri, 27 Jan 2012 09:05:52 -0500 Received: from [217.9.48.20] (helo=[165.204.15.163]) by os.inf.tu-dresden.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77) id 1RqmR5-0003U8-0H for emacs-orgmode@gnu.org; Fri, 27 Jan 2012 15:05:51 +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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Hi, I am in the process of switching from org-remember to org-capture. I used a custom function with org-remember to capture into a host-specific sub-tree under "* Inbox" in order to minimize git merge conflicts between my machines. My tree typically looks like this: * Inbox *** Inbox:host1 ***** INBOX idea 1 ***** INBOX idea 2 *** Inbox:host2 ***** INBOX idea 3 The custom function with org-remember only needed to create the target headline's name. Org-remember would find it or create it (IIRC): ---->8---------------------------------------------------------------- (defun my-host-name () "Returns the name of the current host minus the domain." (let ((hostname (downcase (system-name)))) (save-match-data (substring hostname (string-match "^[^.]+" hostname) (match-end 0))))) (defun my-org-remember-headline () (concatenate 'string "Inbox:" (my-host-name))) ---->8---------------------------------------------------------------- The problem is now that org-capture expects a function that creates the target node and positions point at a child of the target, is this correct? My hacky solution is to use the file+function template and looks like this: ---->8---------------------------------------------------------------- (defun my-org-capture-function () (goto-char (org-find-exact-headline-in-buffer (concatenate 'string "Inbox:" (my-host-name)) nil t)) (org-end-of-line) (org-insert-subheading "")) ---->8---------------------------------------------------------------- But it looks clumsy and always inserts as first child. Is there a more elegant approach, maybe using the refiling mechanism? Thanks, Martin