diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2014-09-15 18:47:22 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2014-09-15 18:49:19 +0200 |
commit | 9ba9f916e87297d863c197cb87199adbb39da894 (patch) | |
tree | e5f3b010524035374f45e64b26727b8f649e2142 | |
parent | a927894d12060405f8499d5be022fe920501576b (diff) | |
download | org-mode-9ba9f916e87297d863c197cb87199adbb39da894.tar.gz |
Fix `org-up-heading-safe'
* lisp/org.el (org-up-heading-safe): Do not throw any error, as
advertised in the docstring.
-rwxr-xr-x | lisp/org.el | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lisp/org.el b/lisp/org.el index f5fe259..bf56218 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -23702,14 +23702,11 @@ headline found, or nil if no higher level is found. Also, this function will be a lot faster than `outline-up-heading', because it relies on stars being the outline starters. This can really make a significant difference in outlines with very many siblings." - (let (start-level re) - (org-back-to-heading t) - (setq start-level (funcall outline-level)) - (if (equal start-level 1) - nil - (setq re (concat "^\\*\\{1," (number-to-string (1- start-level)) "\\} ")) - (if (re-search-backward re nil t) - (funcall outline-level))))) + (when (ignore-errors (org-back-to-heading t)) + (let ((level-up (1- (funcall outline-level)))) + (and (> level-up 0) + (re-search-backward (format "^\\*\\{1,%d\\} " level-up) nil t) + (funcall outline-level))))) (defun org-first-sibling-p () "Is this heading the first child of its parents?" |