فهرست منبع

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.

Carsten Dominik 15 سال پیش
والد
کامیت
9491fc8d5d
3فایلهای تغییر یافته به همراه19 افزوده شده و 4 حذف شده
  1. 9 0
      lisp/ChangeLog
  2. 3 4
      lisp/org-remember.el
  3. 7 0
      lisp/org.el

+ 9 - 0
lisp/ChangeLog

@@ -1,3 +1,12 @@
+2009-09-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* 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  <carsten.dominik@gmail.com>
 
 	* org-agenda.el (org-agenda-highlight-todo): Fix text property

+ 3 - 4
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

+ 7 - 0
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 "\\|")