From 9491fc8d5d56995f2d856b6fffa863f7ea1f2a55 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 19 Sep 2009 08:06:11 +0100 Subject: [PATCH] Find headings for remember also if they have a TODO keyword or a priority So far the headline had to match the one specified in the template exactly, except for tags. Now a TODO keyword and a priority can be added, and the headline will still be found. Reported by Samuel Wales and Bernt Hansen. --- lisp/ChangeLog | 9 +++++++++ lisp/org-remember.el | 7 +++---- lisp/org.el | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 526234aea..d20bf7c74 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2009-09-19 Carsten Dominik + + * org.el (org-complex-heading-regexp-format): New variable. + (org-set-regexps-and-options): Define + `org-complex-heading-regexp-format'. + + * org-remember.el (org-go-to-remember-target) + (org-remember-handler): Use `org-complex-heading-regexp-format'. + 2009-09-18 Carsten Dominik * org-agenda.el (org-agenda-highlight-todo): Fix text property diff --git a/lisp/org-remember.el b/lisp/org-remember.el index fac5521d1..4d846495c 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -771,8 +771,7 @@ The user is queried for the template." (widen) (goto-char (point-min)) (if (re-search-forward - (concat "^\\*+[ \t]+" (regexp-quote heading) - (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$")) + (format org-complex-heading-regexp-format (regexp-quote heading)) nil t) (goto-char (match-beginning 0)) (error "Target headline not found: %s" heading)))) @@ -951,8 +950,8 @@ See also the variable `org-reverse-note-order'." ((and (stringp heading) (string-match "\\S-" heading)) (goto-char (point-min)) (if (re-search-forward - (concat "^\\*+[ \t]+" (regexp-quote heading) - (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$")) + (format org-complex-heading-regexp-format + (regexp-quote heading)) nil t) (setq org-goto-start-pos (match-beginning 0)) (when fastp diff --git a/lisp/org.el b/lisp/org.el index eb30acd05..af770798c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3422,6 +3422,8 @@ group 3: Priority cookie group 4: True headline group 5: Tags") (make-variable-buffer-local 'org-complex-heading-regexp) +(defvar org-complex-heading-regexp-format nil) +(make-variable-buffer-local 'org-complex-heading-regexp-format) (defvar org-todo-line-tags-regexp nil "Matches a headline and puts TODO state into group 2 if present. Also put tags into group 4 if tags are present.") @@ -3777,6 +3779,11 @@ means to push this value onto the list in the variable.") (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)" "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") + org-complex-heading-regexp-format + (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" + (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") + "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(%s\\)" + "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") org-nl-done-regexp (concat "\n\\*+[ \t]+" "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|")