From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.bugs Subject: bug#61546: [PATCH] Fix some org functionality breaking upon changing `calendar-buffer' Date: Thu, 16 Feb 2023 07:01:23 +0100 Message-ID: <87r0uq2los.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40945"; mail-complaints-to="usenet@ciao.gmane.io" To: 61546@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 16 07:03:28 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSXMd-000AUc-OR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Feb 2023 07:03:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSXMF-0002P1-O0; Thu, 16 Feb 2023 01:03:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSXME-0002LM-Qd for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:03:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSXME-0003mT-D1 for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:03:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSXME-0005gm-6u for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Feb 2023 06:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61546 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167652732321769 (code B ref -1); Thu, 16 Feb 2023 06:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Feb 2023 06:02:03 +0000 Original-Received: from localhost ([127.0.0.1]:34654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSXLG-0005f1-No for submit@debbugs.gnu.org; Thu, 16 Feb 2023 01:02:03 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:57944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSXLB-0005eO-BN for submit@debbugs.gnu.org; Thu, 16 Feb 2023 01:02:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSXKt-0001Pn-SF for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:01:48 -0500 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSXKp-0003Vf-Mq for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:01:38 -0500 Original-Received: by mail-wr1-x434.google.com with SMTP id bu23so751445wrb.8 for ; Wed, 15 Feb 2023 22:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=84oD02kiLfJ+OyfJNGZTW574xmNmbDV/Uljsx/BbiiQ=; b=OEFViZqFXWHXMkQdJNF43tHbIwl+xgX39G9QOLfE4ahImpMB6KO7MLUnPHO7uQNLwO Uj4hfHjtXsj2fVhKH35qvWpGkgG0u5b5BAYTiTv3diFaLCu45lmkppCtJDeaWSwD//sx SUvm/APzDznBhuCzSwdm9fZUhTWwTW7jaPog70IZctbHRYRTduScUY61WoeTD70Zt+DF QzI51AWX+TavhpZLlGUcDmtdqEWzBWmnO9JYt7UOucNF04nnppedPNizu/xWrJwLWkIB RIBD7/IkZ4y5yDVFLGAxSd6Sdk+/HnnoKq6bZJBYZWLfQnBhtYb67Ht6Ed+9H8B8YOYc Vvhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=84oD02kiLfJ+OyfJNGZTW574xmNmbDV/Uljsx/BbiiQ=; b=CjwX6mO3nvhbVpjt/OD9GOUOQY82CBJQQpkCMVVtzm256oqza8C8dfg9DAteUS0dST NsAEi2j5ua5reXF8HGC5DQYvQoT5aYZ0esBTVyp4pDj4Ind5C2/Jv846MP7osfq8jEMU q8fQdSeXSgEP86yOqAUZZWN4kuFh3GRXWH+68i2hcgmAuKiAVytNzeuVwqu//zLJlBCb G6DKFF4fIZdJunr+DN286F2CQfOpxlHP4CKOva62QNfL9CiUPxMx5zO9aBmupQ+oMsO0 ln9C4fLOrIYEHLP3H5PzEn9oTzKv/Y/FNSNnBDPYYqHBzJKcbezvluRW2clAJDsTeQxw 1xCw== X-Gm-Message-State: AO0yUKWflrvCfIQnHYQQn43+hj9lIub/LB50PNwHOYwbUuS5ipBpeKJD C/RApYGbYyHFCs+X0gVduLDP7uQoViI= X-Google-Smtp-Source: AK7set+ovPLUFNXfa26w6G8JJVUQKRvjA86M3SgqvkwokqVX9U3knOSiw+oo0EoybIcbqUttc9caNQ== X-Received: by 2002:adf:f40f:0:b0:2c5:512b:afc1 with SMTP id g15-20020adff40f000000b002c5512bafc1mr3623746wro.47.1676527293253; Wed, 15 Feb 2023 22:01:33 -0800 (PST) Original-Received: from thuna ([90.147.71.250]) by smtp.gmail.com with ESMTPSA id d11-20020adffd8b000000b002c54536c662sm561533wrr.34.2023.02.15.22.01.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 22:01:32 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=thuna.cing@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255793 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-the-calendar-buffer-variable.patch Content-Description: The main patch >From 1facad66a10211470cc7d785dfd4418217553b57 Mon Sep 17 00:00:00 2001 From: Thuna 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 --=-=-=--