unofficial mirror of bug-gnu-emacs@gnu.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; 9+ 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] 9+ messages in thread

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  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-05-02 11:38 ` Ihor Radchenko
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2023-02-16  9:24 UTC (permalink / raw)
  To: Thuna, 61546

Thuna <thuna.cing@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.





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  2023-02-16  9:24 ` Stefan Kangas
@ 2023-02-16  9:35   ` Thuna
  2023-02-16  9:57     ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Thuna @ 2023-02-16  9:35 UTC (permalink / raw)
  To: Stefan Kangas, 61546


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





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  2023-02-16  9:35   ` Thuna
@ 2023-02-16  9:57     ` Ihor Radchenko
  2023-02-16 10:02       ` Thuna
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2023-02-16  9:57 UTC (permalink / raw)
  To: Thuna; +Cc: 61546, Stefan Kangas

Thuna <thuna.cing@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>





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  2023-02-16  9:57     ` Ihor Radchenko
@ 2023-02-16 10:02       ` Thuna
  2023-02-16 10:17         ` Ihor Radchenko
       [not found]         ` <87v8k13of6.fsf@localhost>
  0 siblings, 2 replies; 9+ messages in thread
From: Thuna @ 2023-02-16 10:02 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 61546, Stefan Kangas


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





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  2023-02-16 10:02       ` Thuna
@ 2023-02-16 10:17         ` Ihor Radchenko
       [not found]         ` <87v8k13of6.fsf@localhost>
  1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-02-16 10:17 UTC (permalink / raw)
  To: Thuna, Bastien; +Cc: 61546, emacs-orgmode, Stefan Kangas

Thuna <thuna.cing@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>





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
       [not found]         ` <87v8k13of6.fsf@localhost>
@ 2023-02-28  9:28           ` Bastien Guerry
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien Guerry @ 2023-02-28  9:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 61546, emacs-orgmode, Stefan Kangas, Thuna

Ihor Radchenko <yantar92@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





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  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-05-02 11:38 ` Ihor Radchenko
  2023-05-02 18:04   ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2023-05-02 11:38 UTC (permalink / raw)
  To: Thuna; +Cc: 61546, Stefan Kangas

Thuna <thuna.cing@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>





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

* bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer'
  2023-05-02 11:38 ` Ihor Radchenko
@ 2023-05-02 18:04   ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2023-05-02 18:04 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 61546-done, stefankangas, thuna.cing

> Cc: 61546@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Tue, 02 May 2023 11:38:40 +0000
> 
> Thuna <thuna.cing@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.





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

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

Thread overview: 9+ 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
     [not found]         ` <87v8k13of6.fsf@localhost>
2023-02-28  9:28           ` Bastien Guerry
2023-05-02 11:38 ` Ihor Radchenko
2023-05-02 18:04   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).