all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
@ 2023-02-16  6:01 Thuna
  2023-02-16  9:24 ` Stefan Kangas
  2023-05-02 11:38 ` Ihor Radchenko
  0 siblings, 2 replies; 11+ messages in thread
From: Thuna @ 2023-02-16  6:01 UTC (permalink / raw)
  To: 61546

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

Some code in org seems to break when calendar-buffer is modified, as
they rely on it being its default value, "*Calendar*".  The attached
patch fixes that.  I haven't tested it, however, it should work fine.
The `require's all seem correct as well.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: The main patch --]
[-- Type: text/x-patch, Size: 4021 bytes --]

From 1facad66a10211470cc7d785dfd4418217553b57 Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
Date: Tue, 14 Feb 2023 19:52:37 +0100
Subject: [PATCH 1/3] Use the calendar-buffer variable

* lisp/org/org.el (org-read-date org-eval-in-calendar
org-timestamp-change org-modify-ts-extra org-goto-calendar):
lisp/org/org-agenda.el (org-agenda-clock-goto):
test/lisp/calendar/cal-julian-tests.el (with-cal-julian-test): Use the
variable `calendar-buffer' instead of its default value, the literal
string `"*Calendar*"'.
---
 lisp/org/org-agenda.el                 |  2 +-
 lisp/org/org.el                        | 12 ++++++------
 test/lisp/calendar/cal-julian-tests.el |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 3db33c4d63e..63757cf5e1c 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -10555,7 +10555,7 @@ org-agenda-clock-goto
 (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/org.el b/lisp/org/org.el
index 9a4f7803cf4..f602bfb8c8a 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -13710,7 +13710,7 @@ org-read-date
 	    (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
@@ -13746,7 +13746,7 @@ org-read-date
 		      (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))))))
@@ -14103,7 +14103,7 @@ org-eval-in-calendar
 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))
@@ -14952,7 +14952,7 @@ org-timestamp-change
 			     (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))))))
 
@@ -14995,7 +14995,7 @@ org-modify-ts-extra
 
 (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
@@ -15022,7 +15022,7 @@ org-goto-calendar
 
 (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))))
 
diff --git a/test/lisp/calendar/cal-julian-tests.el b/test/lisp/calendar/cal-julian-tests.el
index e0d74e8a6cd..4207d1ee285 100644
--- a/test/lisp/calendar/cal-julian-tests.el
+++ b/test/lisp/calendar/cal-julian-tests.el
@@ -47,7 +47,7 @@ with-cal-julian-test
          (progn
            (calendar)
            ,@body)
-       (kill-buffer "*Calendar*"))))
+       (kill-buffer calendar-buffer))))
 
 (ert-deftest cal-julian-test-goto-date ()
   (with-cal-julian-test
-- 
2.38.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-02 18:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16  6:01 bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer' Thuna
2023-02-16  9:24 ` Stefan Kangas
2023-02-16  9:35   ` Thuna
2023-02-16  9:57     ` Ihor Radchenko
2023-02-16 10:02       ` Thuna
2023-02-16 10:17         ` Ihor Radchenko
2023-02-28  9:28           ` Bastien Guerry
2023-02-28  9:28           ` Bastien Guerry
2023-02-16 10:17         ` Ihor Radchenko
2023-05-02 11:38 ` Ihor Radchenko
2023-05-02 18:04   ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.