mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 15:32:52 +00:00
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 ()
|
||||
"Move cursor to the first headline and recenter the headline."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
|
||||
(set-window-start (selected-window) (point-at-bol))))
|
||||
(let ((window (get-buffer-window)))
|
||||
(when window
|
||||
(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
|
||||
|
||||
|
|
Loading…
Reference in a new issue