org.el (org-imenu-get-tree): Fix bug when matching against empty headlines

* org.el (org-imenu-get-tree): Fix bug when matching against empty
headlines.

Thanks to Jambunathan for reporting this.
This commit is contained in:
Bastien Guerry 2013-02-26 22:02:13 +01:00
parent 2efbd0f138
commit 2b13d090d1

View file

@ -22213,7 +22213,7 @@ Show the heading too, if it is currently invisible."
(re (concat "^" (org-get-limited-outline-regexp))) (re (concat "^" (org-get-limited-outline-regexp)))
(subs (make-vector (1+ n) nil)) (subs (make-vector (1+ n) nil))
(last-level 0) (last-level 0)
m level head) m level head0 head)
(save-excursion (save-excursion
(save-restriction (save-restriction
(widen) (widen)
@ -22221,9 +22221,9 @@ Show the heading too, if it is currently invisible."
(while (re-search-backward re nil t) (while (re-search-backward re nil t)
(setq level (org-reduced-level (funcall outline-level))) (setq level (org-reduced-level (funcall outline-level)))
(when (and (<= level n) (when (and (<= level n)
(looking-at org-complex-heading-regexp)) (looking-at org-complex-heading-regexp)
(setq head (org-link-display-format (setq head0 (org-match-string-no-properties 4)))
(org-match-string-no-properties 4)) (setq head (org-link-display-format head0)
m (org-imenu-new-marker)) m (org-imenu-new-marker))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t) (org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (>= level last-level) (if (>= level last-level)