diff options
Diffstat (limited to 'helm-utils.el')
-rw-r--r-- | helm-utils.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/helm-utils.el b/helm-utils.el index ea99cb91..5d202c85 100644 --- a/helm-utils.el +++ b/helm-utils.el @@ -404,12 +404,17 @@ Default is `helm-current-buffer'." (defun helm-goto-char (loc) "Go to char, revealing if necessary." + (require 'org) ; On some old Emacs versions org may not be loaded. (goto-char loc) - (when (or (eq major-mode 'org-mode) - (and (boundp 'outline-minor-mode) - outline-minor-mode)) - (require 'org) ; On some old Emacs versions org may not be loaded. - (org-reveal))) + (let ((fn (cond ((eq major-mode 'org-mode) #'org-reveal) + ((and (boundp 'outline-minor-mode) + outline-minor-mode) + #'outline-show-subtree)))) + ;; outline may fail in some conditions e.g. with markdown enabled + ;; (issue #1919). + (condition-case nil + (and fn (funcall fn)) + (error nil)))) (defun helm-goto-line (lineno &optional noanim) "Goto LINENO opening only outline headline if needed. |