This patch adds support for specifying the ID of a target headline. Open issues: * Using a cons cell seems a bit ugly. A string would be fine too but this is already used by the headline itself in the choice element. * The visual appearance of the ID choice is suboptimal. Is there any way to hide the const visually? * The comments in the remember buffer seems to be setup wrong, where must I hook in to support IDs there? diff --git a/home/mpohlack/src/org-mode/lisp/org-remember.el b/org-remember.el index 59e015f..a0dbac4 100644 --- a/home/mpohlack/src/org-mode/lisp/org-remember.el +++ b/org-remember.el @@ -108,7 +108,8 @@ An optional fifth element can specify the headline in that file that should be offered first when the user is asked to file the entry. The default headline is given in the variable `org-remember-default-headline'. When this element is `top' or `bottom', the note will be placed as a level-1 -entry at the beginning or end of the file, respectively. +entry at the beginning or end of the file, respectively. You can also specify +the `ID' of a target headline. An optional sixth element specifies the contexts in which the template will be offered to the user. This element can be a list of major modes @@ -195,7 +196,8 @@ calendar | %:type %:date" (const :tag "Use `org-remember-default-headline'" nil) (const :tag "At beginning of file" top) (const :tag "At end of file" bottom) - (const :tag "In a date tree" date-tree)) + (const :tag "In a date tree" date-tree) + (cons :tag "ID" (const :tag "" ID) (string :tag "ID"))) (choice :tag "Context" (const :tag "Use in all contexts" nil) (const :tag "Use in all contexts" t) @@ -974,6 +976,10 @@ See also the variable `org-reverse-note-order'." (org-datetree-find-date-create reference-date) (setq reversed nil) (setq org-goto-start-pos (point))) + ((consp heading) + (setq org-goto-start-pos (org-find-entry-with-id (cdr heading))) + (when (not org-goto-start-pos) + (error "Target headline with ID '%s' not found" (cdr heading)))) ((and (stringp heading) (string-match "\\S-" heading)) (goto-char (point-min)) (if (re-search-forward