Fix `org-occur' when called non-interactively
* lisp/org.el (org-first-headline-recenter): Check if current buffer is actually displayed in a window before trying to recenter view.
This commit is contained in:
parent
8638c14fbd
commit
1ca1d52e92
|
@ -7252,9 +7252,11 @@ show that drawer instead."
|
||||||
|
|
||||||
(defun org-first-headline-recenter ()
|
(defun org-first-headline-recenter ()
|
||||||
"Move cursor to the first headline and recenter the headline."
|
"Move cursor to the first headline and recenter the headline."
|
||||||
(goto-char (point-min))
|
(let ((window (get-buffer-window)))
|
||||||
(when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
|
(when window
|
||||||
(set-window-start (selected-window) (point-at-bol))))
|
(goto-char (point-min))
|
||||||
|
(when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
|
||||||
|
(set-window-start window (line-beginning-position))))))
|
||||||
|
|
||||||
;;; Saving and restoring visibility
|
;;; Saving and restoring visibility
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue