diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-16 19:27:38 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-16 19:27:38 +0200 |
commit | 3082ea9a30bb9782f233e01c1b312fc8b1651c5e (patch) | |
tree | 32c77235b7ed9def31e67252efa4aca6a3640db7 | |
parent | 56cf6ad42de9f00fe90cfb5230468872e679c163 (diff) | |
download | org-mode-3082ea9a30bb9782f233e01c1b312fc8b1651c5e.tar.gz |
Use a better regexp to find a refile target headline
* lisp/org.el (org-complex-heading-regexp-format): Document the variable.
(org-get-refile-targets): Use `org-complex-heading-regexp-format' to
make the regular expression for matching the headline.
Now we use the format for the complex heading regexp, which means that
Changing the TODO state, level, priority, or tags of a heading will
still allow the heading to be matched by the regexp.
-rw-r--r-- | lisp/org.el | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el index 003ab84..9cb3799 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4038,7 +4038,11 @@ 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) +(defvar org-complex-heading-regexp-format nil + "Printf format to make regexp to match an exact headline. +This regexp will match the headline of any node which hase the exact +headline text that is put into the format, but may have any TODO state, +priority and tags.") (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. @@ -9941,15 +9945,8 @@ on the system \"/user@host:\"." (setq level (org-reduced-level (- (match-end 1) (match-beginning 1))) txt (org-link-display-format (match-string 4)) - re (concat "^" (regexp-quote - (buffer-substring - (match-beginning 1) - (match-end 4))))) - (if (match-end 5) (setq re (concat - re "[ \t]+" - (regexp-quote - (match-string 5))))) - (setq re (concat re "[ \t]*$")) + re (format org-complex-heading-regexp-format + (regexp-quote (match-string 4)))) (when org-refile-use-outline-path (setq txt (mapconcat 'org-protect-slash |