GNU bug report logs - #61546
[PATCH] Fix some org functionality breaking upon changing `calendar-buffer'

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Thu, 16 Feb 2023 06:03:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61546 in the body.
You can then email your comments to 61546 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 06:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thuna <thuna.cing <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 16 Feb 2023 06:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix some org functionality breaking upon changing
 `calendar-buffer'
Date: Thu, 16 Feb 2023 07:01:23 +0100
[Message part 1 (text/plain, inline)]
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.

[0001-Use-the-calendar-buffer-variable.patch (text/x-patch, inline)]
From 1facad66a10211470cc7d785dfd4418217553b57 Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing <at> 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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 09:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Thuna <thuna.cing <at> gmail.com>, 61546 <at> debbugs.gnu.org
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Thu, 16 Feb 2023 01:24:27 -0800
Thuna <thuna.cing <at> gmail.com> writes:

> 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.

In general, it's better to send patches for org-mode to the org-mode
mailing list.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 09:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, 61546 <at> debbugs.gnu.org
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Thu, 16 Feb 2023 10:35:09 +0100
> In general, it's better to send patches for org-mode to the org-mode
> mailing list.

Right, sorry, I split this off of 61547 and forgot to send it to the
org-mode mailing list.  Should I do it now or is it fine here also?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 09:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 61546 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Thu, 16 Feb 2023 09:57:09 +0000
Thuna <thuna.cing <at> gmail.com> writes:

>> In general, it's better to send patches for org-mode to the org-mode
>> mailing list.
>
> Right, sorry, I split this off of 61547 and forgot to send it to the
> org-mode mailing list.  Should I do it now or is it fine here also?

I happen to see this email.

The patch looks fine, even if the other patch is not merged.
It is also compatible with Emacs 26.

However, I need to know if you have FSF copyright assignment. If not,
you will need to add TINYCHANGE cookie to the commit message. See
https://orgmode.org/worg/org-contribute.html#first-patch

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 10:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 61546 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Thu, 16 Feb 2023 11:02:29 +0100
> I happen to see this email.
>
> The patch looks fine, even if the other patch is not merged.
> It is also compatible with Emacs 26.
Ok, that is good to know.

> However, I need to know if you have FSF copyright assignment.
I am in the process of getting my copyright assignment however it is
happening extremely slowly; I would not be surprised if it took another
month.

> If not, you will need to add TINYCHANGE cookie to the commit
> message. See https://orgmode.org/worg/org-contribute.html#first-patch
That is a bit of an issue.  Do org contributions and emacs contributions
count towards the same 15 LoC limit?  If so, I have already exhausted
mine, so TINYCHANGE won't work.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Thu, 16 Feb 2023 10:17:02 GMT) Full text and rfc822 format available.

Message #20 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Thuna <thuna.cing <at> gmail.com>, Bastien <bzg <at> gnu.org>
Cc: 61546 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Thu, 16 Feb 2023 10:17:01 +0000
Thuna <thuna.cing <at> gmail.com> writes:

>> If not, you will need to add TINYCHANGE cookie to the commit
>> message. See https://orgmode.org/worg/org-contribute.html#first-patch
> That is a bit of an issue.  Do org contributions and emacs contributions
> count towards the same 15 LoC limit?  If so, I have already exhausted
> mine, so TINYCHANGE won't work.

AFAIK, we count separately. Org mode is a separate project, despite
being distributed together with Emacs. At least, we usually only
consider LOCs contributed to Org.

Let me CC Bastien (the Org maintainer) to clarify.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Tue, 28 Feb 2023 09:29:01 GMT) Full text and rfc822 format available.

Message #23 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Bastien Guerry <bzg <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 61546 <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>, Thuna <thuna.cing <at> gmail.com>
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Tue, 28 Feb 2023 10:28:31 +0100
Ihor Radchenko <yantar92 <at> posteo.net> writes:

>> That is a bit of an issue.  Do org contributions and emacs contributions
>> count towards the same 15 LoC limit?  

Yes.  Copyright-wise, contributions to Org are contributions to Emacs.

>> If so, I have already exhausted mine, so TINYCHANGE won't work.
>
> AFAIK, we count separately. Org mode is a separate project, despite
> being distributed together with Emacs. At least, we usually only
> consider LOCs contributed to Org.
>
> Let me CC Bastien (the Org maintainer) to clarify.

Hopefully done, thanks!

-- 
 Bastien Guerry




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61546; Package emacs. (Tue, 02 May 2023 11:36:01 GMT) Full text and rfc822 format available.

Message #26 received at 61546 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 61546 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Tue, 02 May 2023 11:38:40 +0000
Thuna <thuna.cing <at> gmail.com> writes:

> 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.

I now applied an equivalent patch onto main in Org.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9ea50ca21

Stefan, please note that part of the patch is for Emacs:

test/lisp/calendar/cal-julian-tests.el

> 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
>

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 02 May 2023 18:04:02 GMT) Full text and rfc822 format available.

Notification sent to Thuna <thuna.cing <at> gmail.com>:
bug acknowledged by developer. (Tue, 02 May 2023 18:04:02 GMT) Full text and rfc822 format available.

Message #31 received at 61546-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 61546-done <at> debbugs.gnu.org, stefankangas <at> gmail.com, thuna.cing <at> gmail.com
Subject: Re: bug#61546: [PATCH] Fix some org functionality breaking upon
 changing `calendar-buffer'
Date: Tue, 02 May 2023 21:04:13 +0300
> Cc: 61546 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Tue, 02 May 2023 11:38:40 +0000
> 
> Thuna <thuna.cing <at> gmail.com> writes:
> 
> > 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.
> 
> I now applied an equivalent patch onto main in Org.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9ea50ca21
> 
> Stefan, please note that part of the patch is for Emacs:

I'm not Stefan, but I've installed this part on the emacs-29 branch,
and I'm therefore closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 31 May 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.