diff options
author | Pierre Téchoueyres <pierre.techoueyres@free.fr> | 2018-03-28 01:35:22 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-04-05 16:45:40 +0200 |
commit | befc92b9c0b1837266e42c74c0fb7fc8f878b919 (patch) | |
tree | 93afb1d89a13744a8f73871b48a79e7d1fa9745c | |
parent | 3e1f111c3b862ebe7394377dd1d2c2b60a261c99 (diff) | |
download | org-mode-befc92b9c0b1837266e42c74c0fb7fc8f878b919.tar.gz |
org-agenda: Call `recenter' only if buffer has a window
* lisp/org-agenda.el (org-agenda-list): Condition the call to
`recenter` only when the buffer has a window associated.
This permit to call `org-agenda-list` in a `with-temp-buffer` like
below:
(with-temp-buffer
(let ((org-agenda-sticky nil)
(org-agenda-buffer-tmp-name (buffer-name)))
(org-agenda-list 1)
(buffer-string))
-rw-r--r-- | lisp/org-agenda.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 5bbf5e3..78f67cc 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4261,8 +4261,9 @@ items if they have an hour specification like [h]h:mm." (insert tbl))) (goto-char (point-min)) (or org-agenda-multi (org-agenda-fit-window-to-buffer)) - (unless (and (pos-visible-in-window-p (point-min)) - (pos-visible-in-window-p (point-max))) + (unless (or (not (get-buffer-window)) + (and (pos-visible-in-window-p (point-min)) + (pos-visible-in-window-p (point-max)))) (goto-char (1- (point-max))) (recenter -1) (if (not (pos-visible-in-window-p (or start-pos 1))) |