Fix `org-up-heading-safe'

* lisp/org.el (org-up-heading-safe): Do not throw any error, as
  advertised in the docstring.
This commit is contained in:
Nicolas Goaziou 2014-09-15 18:47:22 +02:00
parent a927894d12
commit 9ba9f916e8
1 changed files with 5 additions and 8 deletions

View File

@ -23702,13 +23702,10 @@ 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)
(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 ()