From 9ea50ca21172fbc6b69aa8af5216909e813f6fcd Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Tue, 2 May 2023 13:33:34 +0200 Subject: [PATCH] Use `calendar-buffer' constant to refer to calendar buffers * lisp/org-agenda.el (org-agenda-diary-entry-in-org-file): * lisp/org.el (org-read-date): (org-eval-in-calendar): (org-timestamp-change): (org-recenter-calendar): (org-get-date-from-calendar): Use `calendar-buffer' instead of hard-coded "*Calendar*". Reported-by: Thuna Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61546 --- lisp/org-agenda.el | 2 +- lisp/org.el | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 2fcb6cf75..bafd8b7f8 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -10571,7 +10571,7 @@ buffer, display it in another window." (defun org-agenda-diary-entry-in-org-file () "Make a diary entry in the file `org-agenda-diary-file'." (let (d1 d2 char (text "") dp1 dp2) - (if (equal (buffer-name) "*Calendar*") + (if (equal (buffer-name) calendar-buffer) (setq d1 (calendar-cursor-to-date t) d2 (car calendar-mark-ring)) (setq dp1 (get-text-property (line-beginning-position) 'day)) diff --git a/lisp/org.el b/lisp/org.el index f5cc51110..4fb2e94c8 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13753,7 +13753,7 @@ user." (calendar) (when (eq calendar-setup 'calendar-only) (setq cal-frame - (window-frame (get-buffer-window "*Calendar*" 'visible))) + (window-frame (get-buffer-window calendar-buffer 'visible))) (select-frame cal-frame)) (org-eval-in-calendar '(setq cursor-type nil) t) (unwind-protect @@ -13789,7 +13789,7 @@ user." (when org-read-date-overlay (delete-overlay org-read-date-overlay) (setq org-read-date-overlay nil))))) - (bury-buffer "*Calendar*") + (bury-buffer calendar-buffer) (when cal-frame (delete-frame cal-frame) (select-frame-set-input-focus cur-frame)))))) @@ -14146,7 +14146,7 @@ user function argument order change dependent on argument order." Unless KEEPDATE is non-nil, update `org-ans2' to the cursor date." (let ((sf (selected-frame)) (sw (selected-window))) - (select-window (get-buffer-window "*Calendar*" t)) + (select-window (get-buffer-window calendar-buffer t)) (eval form t) (when (and (not keepdate) (calendar-cursor-to-date)) (let* ((date (calendar-cursor-to-date)) @@ -15005,7 +15005,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like (org-get-heading t t))))))))) ;; Try to recenter the calendar window, if any. (when (and org-calendar-follow-timestamp-change - (get-buffer-window "*Calendar*" t) + (get-buffer-window calendar-buffer t) (memq timestamp? '(day month year))) (org-recenter-calendar (time-to-days time)))))) @@ -15048,7 +15048,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like (defun org-recenter-calendar (d) "If the calendar is visible, recenter it to date D." - (let ((cwin (get-buffer-window "*Calendar*" t))) + (let ((cwin (get-buffer-window calendar-buffer t))) (when cwin (let ((calendar-move-hook nil)) (with-selected-window cwin @@ -15075,7 +15075,7 @@ A prefix ARG can be used to force the current date." (defun org-get-date-from-calendar () "Return a list (month day year) of date at point in calendar." - (with-current-buffer "*Calendar*" + (with-current-buffer calendar-buffer (save-match-data (calendar-cursor-to-date))))