Hi Bastien, thanks for your reply.
On 28.01.2012 17:00, Bastien wrote: > Hi Martin, > > Martin Pohlack <m...@os.inf.tu-dresden.de> writes: > >> I am in the process of switching from org-remember to org-capture. > > Possibly useless hint: M-x org-capture-import-remember-templates RET Yes thanks. Unfortunately, this does not convert my custom function :-). In fact, it does not convert anything (with org-mode 7.6). > Can you restate the problem more directly? What are your capture > template, what is it supposed to achieve, how does it fail to do > what you want -- we'll work out something from there. All right, here is my (stripped down) setup: '(org-remember-templates (quote ( ("Inbox-Arbeit" 97 "* INBOX %^{Title} %U%? %i" "~/Daten/plan_arbeit.org" my-org-remember-headline nil) ("Inbox-Privat" 112 "* INBOX %^{Title} %U%? %i" "~/Daten/plan_privat.org" my-org-remember-headline nil) ("Journal" 106 "* %^{Eintrag}%?%i%&" "~/Daten/Journal.org" return_formated_date nil)))) Let' focus on the first entry (Inbox-Arbeit): the only non-standard thing here is the function my-org-remember-headline. ---->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---------------------------------------------------------------- Run on “host1” it will return “Inbox:host1”, etc. My “plan_arbeit.org” file contains this structure: ---->8---------------------------------------------------------------- * Inbox *** Inbox:host1 *** Inbox:host2 ---->8---------------------------------------------------------------- So that each machine has a separate inbox under a global container. This reduces git merge conflicts when I merge my plan files from different machines (but this is a side discussion). What changed from org-remember to org-capture is that custom functions used to return a string with a target parent headline. Now they are expected to modify “point” as a side effect before the actual capturing happens (and not return anything). Here is my new capture template: '(org-capture-templates (quote ( ("a" "Inbox-Arbeit" entry (file+function "~/Daten/plan_arbeit.org" my-org-capture-function) "* INBOX %^{Title} %U%? %i")))) I drafted this new function for org-capture: ---->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---------------------------------------------------------------- This shall capture again under “Inbox/Inbox:$hostname”. The function feels clumsy because this functionality should already be in org-mode (e.g., the refiling stuff). Also, it files new items as first child under the target and not as last child. The question is simply: Is there a more elegant approach, maybe using the refiling mechanism? Have I overlooked something obvious? Thanks, Martin