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#61547: [PATCH] calendar.el buffer name variables, use defcustom and change name Date: Thu, 16 Feb 2023 07:11:40 +0100 Message-ID: <87pmaa2l7n.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="5165"; mail-complaints-to="usenet@ciao.gmane.io" To: 61547@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 16 07:12:23 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 1pSXVH-00017U-0R for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Feb 2023 07:12:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSXV0-00084X-7b; Thu, 16 Feb 2023 01:12:06 -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 1pSXUx-00080r-Mv for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:12:04 -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 1pSXUx-0000yn-9B for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:12:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSXUw-00064m-Iz for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:12: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:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61547 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.167652791423340 (code B ref -1); Thu, 16 Feb 2023 06:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Feb 2023 06:11:54 +0000 Original-Received: from localhost ([127.0.0.1]:34670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSXUm-00064L-LX for submit@debbugs.gnu.org; Thu, 16 Feb 2023 01:11:54 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:44968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSXUi-000648-62 for submit@debbugs.gnu.org; Thu, 16 Feb 2023 01:11:51 -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 1pSXUh-0007jy-2Q for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:11:47 -0500 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSXUd-00088x-Bu for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 01:11:46 -0500 Original-Received: by mail-wr1-x42c.google.com with SMTP id by3so755916wrb.10 for ; Wed, 15 Feb 2023 22:11:43 -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=M6UknJ4aDkYHzcehUVqcvJ2XwXSX98MuXMlu4vGN/N4=; b=IGFhferxYDprxRS0UZ+trMmWCt0GkiENaP9btz/k/8RtV6375FHe0LCKyYhBDPK+6q d+/705Qsr3sU5JO0hxwnTdrEirrFUFjQJvODWuWP8luyYhHf7ijMFvy49z/d7tL4p0l1 9rb+tKwO9rdGir+2JucIyr1ydeqLbqThc5EXO2AH0pygGPuL0BKrfXIlRVZUsx/cZ96B 2lqElZ9q4kC8GTYDMBFAqpAU3bftStr6zAZRXVGmnvvAjwlNfjHI30mgIMzGzUHYJqd4 8NK4MjatCjUxaHxycDMuWZYo0IEiJ4YVK47GMDD0qu7/uDM4KuMx4lVKGTkCDyEQH/o3 lRGA== 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=M6UknJ4aDkYHzcehUVqcvJ2XwXSX98MuXMlu4vGN/N4=; b=sAyDd9+mv+BhkyxabU4Hnfl99CoC9H/DHeL3rt+vPA6pJZJeKkb4h3YBnd5LYj6zI8 aC/aGj/taM1wPIsU1P30kpIVZbJFJ7ApeVolPkH+2U1r3Fu5rc8ye7gXNKYiVDgo/A/S 5ZcbSduEcyjHLh8/FnwSUChbTyZZTzncd5kp/o2huC8NdA1kPSmOOZw0qrvwuZF2ne0m TPZPo+N5ZseiekEtBsm8RCtLQ4Mu4eGwbev1BGm+vfoJHgiEAcvf9dfhvwr98hdVRDuz O3pBa7rV2gcrjbXu2v9bd/rzrzeKcpkDv1EcYDbgSjQbXP5Lw4QLZZwnk58/Mx3yAibD b6Iw== X-Gm-Message-State: AO0yUKUb/fPbL84d5/572Ig5+QvtvQmdN6OpCbA8OmBUbDBU1QCVooOm 3lbmHpsjwH0y7VCpiqwJdpNRXwG1mWI= X-Google-Smtp-Source: AK7set/Czr7hGfv4ZcaQIa5Z++GZ03vOacUnwgGlI6VW30btEP7Dwo20Eef7jSYGgFqHacoC0uz1Nw== X-Received: by 2002:adf:f64f:0:b0:2c5:592b:b71b with SMTP id x15-20020adff64f000000b002c5592bb71bmr3703120wrp.45.1676527901305; Wed, 15 Feb 2023 22:11:41 -0800 (PST) Original-Received: from thuna ([90.147.71.250]) by smtp.gmail.com with ESMTPSA id r10-20020a5d694a000000b002c5539171d1sm573759wrw.41.2023.02.15.22.11.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 22:11:40 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=thuna.cing@gmail.com; helo=mail-wr1-x42c.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:255794 Archived-At: --=-=-= Content-Type: text/plain The variable `calendar-buffer' is defined with defconst, however I am not sure why this is the case. In fact, there are a bunch of buffer name options in calendar.el that are defined using `defconst', and they might be better as `defcustom' instead. This patch switches those variables to `defcustom'. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Define-calendar.el-buffer-names-with-defcustom-inste.patch Content-Description: The defconst patch >From b99bec6273a59204750820acd69f392a535e1722 Mon Sep 17 00:00:00 2001 From: Thuna Date: Thu, 16 Feb 2023 06:03:00 +0100 Subject: [PATCH 1/2] Define calendar.el buffer names with defcustom instead of defconst * lisp/calendar/calendar.el (calendar-buffer holiday-buffer diary-fancy-buffer calendar-other-calendars-buffer lunar-phases-buffer solar-sunrises-buffer calendar-hebrew-yahrzeit-buffer): Define the variables using `defcustom' instead of `defconst'. --- lisp/calendar/calendar.el | 49 ++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index faa88e7f52f..2521a9c73c1 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1079,26 +1079,47 @@ calendar-time-zone-style (defconst calendar-first-date-row 3 "First row in the calendar with actual dates.") -(defconst calendar-buffer "*Calendar*" - "Name of the buffer used for the calendar.") +(defcustom calendar-buffer "*Calendar*" + "Name of the buffer used for the calendar." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst holiday-buffer "*Holidays*" - "Name of the buffer used for the displaying the holidays.") +(defcustom holiday-buffer "*Holidays*" + "Name of the buffer used for the displaying the holidays." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst diary-fancy-buffer "*Fancy Diary Entries*" - "Name of the buffer used for the optional fancy display of the diary.") +(defcustom diary-fancy-buffer "*Fancy Diary Entries*" + "Name of the buffer used for the optional fancy display of the diary." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst calendar-other-calendars-buffer "*Other Calendars*" - "Name of the buffer used for the display of date on other calendars.") +(defcustom calendar-other-calendars-buffer "*Other Calendars*" + "Name of the buffer used for the display of date on other calendars." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst lunar-phases-buffer "*Phases of Moon*" - "Name of the buffer used for the lunar phases.") +(defcustom lunar-phases-buffer "*Phases of Moon*" + "Name of the buffer used for the lunar phases." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst solar-sunrises-buffer "*Sunrise/Sunset Times*" - "Name of buffer used for sunrise/sunset times.") +(defcustom solar-sunrises-buffer "*Sunrise/Sunset Times*" + "Name of buffer used for sunrise/sunset times." + :type 'string + :version "30.0.50" + :group 'calendar) -(defconst calendar-hebrew-yahrzeit-buffer "*Yahrzeits*" - "Name of the buffer used by `calendar-hebrew-list-yahrzeits'.") +(defcustom calendar-hebrew-yahrzeit-buffer "*Yahrzeits*" + "Name of the buffer used by `calendar-hebrew-list-yahrzeits'." + :type 'string + :version "30.0.50" + :group 'calendar) (defmacro calendar-increment-month (mon yr n &optional nmonths) "Increment the variables MON and YR by N months. -- 2.38.2 --=-=-= Content-Type: text/plain I think the variable names should also be `*-buffer-name' instead of `*-buffer' in order to better reflect what they are. The following patch does that, marking the old variables as obsolete and using the new name in various places. It's pretty straightforward and it should work but I haven't tested so a double check would be appreciated. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0002-Make-calendar.el-buffer-variables-obsolete-for-buffe.patch Content-Transfer-Encoding: quoted-printable Content-Description: The `-name' suffix patch >From 8b837af563c6e875befe6ef1cd33b54efd5e7b5e Mon Sep 17 00:00:00 2001 From: Thuna Date: Thu, 16 Feb 2023 06:08:25 +0100 Subject: [PATCH 2/2] Make calendar.el `*-buffer' variables obsolete for `*-buffer-name' * lisp/calendar/calendar.el (calendar-buffer holiday-buffer diary-fancy-buffer calendar-other-calendars-buffer lunar-phases-buffer solar-sunrises-buffer calendar-hebrew-yahrzeit-buffer calendar-buffer-name holiday-buffer-name diary-fancy-buffer-name calendar-other-calendars-buffer-name lunar-phases-buffer-name solar-sunrises-buffer-name calendar-hebrew-yahrzeit-buffer-name): Mark `*-buffer' variables as obsolete in favor of their `*-buffer-name' equivalents. * lisp/calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern calendar-hebrew-list-yahrzeits calendar-hebrew-list-yahrzeits): lisp/calendar/cal-x.el (calendar-dedicate-diary calendar-frame-setup): lisp/calendar/calendar.el (calendar-basic-setup calendar-basic-setup calendar-generate-window calendar-generate-month calendar-string-spread calendar-update-mode-line calendar-unmark calendar-mark-visible-date calendar-print-other-dates): lisp/calendar/diary-lib.el (diary-header-line-format diary-display-no-entries diary-fancy-display diary-print-entries diary-mail-entries diary-mark-sexp-entries calendar-mark-days-named calendar-mark-date-pattern calendar-mark-1 diary-insert-cyclic-entry): lisp/calendar/holidays.el (calendar-list-holidays list-holidays calendar-cursor-holidays): lisp/calendar/lunar.el (calendar-lunar-phases): lisp/calendar/solar.el (calendar-sunrise-sunset-month): lisp/calendar/todo-mode.el (todo-set-date-from-calendar): lisp/org/org-agenda.el (org-get-entries-from-diary org-get-entries-from-diary org-get-entries-from-diary): lisp/org/org.el (org-read-date org-eval-in-calendar org-timestamp-change org-modify-ts-extra org-goto-calendar): test/lisp/calendar/cal-julian-tests.el (with-cal-julian-test): Replace the `*-buffer' variables for their `*-buffer-name' equivalent. --- lisp/calendar/cal-hebrew.el | 6 +-- lisp/calendar/cal-x.el | 8 ++-- lisp/calendar/calendar.el | 63 +++++++++++++++++--------- lisp/calendar/diary-lib.el | 22 ++++----- lisp/calendar/holidays.el | 6 +-- lisp/calendar/lunar.el | 2 +- lisp/calendar/solar.el | 2 +- lisp/calendar/todo-mode.el | 2 +- lisp/org/org-agenda.el | 8 ++-- lisp/org/org.el | 12 ++--- test/lisp/calendar/cal-julian-tests.el | 2 +- 11 files changed, 77 insertions(+), 56 deletions(-) diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index b6c60185029..35c122e5ab3 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el @@ -614,7 +614,7 @@ calendar-hebrew-mark-date-pattern passed to `calendar-mark-visible-date' as MARK." ;; FIXME not the same as the Bah=C3=A1=E2=80=99=C3=AD and Islamic cases,= so can't use ;; calendar-mark-1. - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (if (and (not (zerop month)) (not (zerop day))) (if (not (zerop year)) ;; Fully specified Hebrew date. @@ -679,7 +679,7 @@ calendar-hebrew-list-yahrzeits from the cursor position." (interactive (let* ((death-date - (if (equal (current-buffer) (get-buffer calendar-buffer)) + (if (equal (current-buffer) (get-buffer calendar-buffer-name)) (calendar-cursor-to-date t) (let* ((today (calendar-current-date)) (year (calendar-read-sexp @@ -718,7 +718,7 @@ calendar-hebrew-list-yahrzeits (calendar-absolute-from-gregorian death-date))) (h-year (calendar-extract-year h-date)) (i (1- start-year))) - (calendar-in-read-only-buffer calendar-hebrew-yahrzeit-buffer + (calendar-in-read-only-buffer calendar-hebrew-yahrzeit-buffer-name (calendar-set-mode-line (format "Yahrzeit dates for %s =3D %s" (calendar-date-string death-date) diff --git a/lisp/calendar/cal-x.el b/lisp/calendar/cal-x.el index 58eea324e82..d61ac1a76d7 100644 --- a/lisp/calendar/cal-x.el +++ b/lisp/calendar/cal-x.el @@ -97,10 +97,10 @@ calendar-dedicate-diary (progn ;; If there are no diary entries, there won't be a buffer ;; to dedicate, so make a basic one. - (or (get-buffer diary-fancy-buffer) - (calendar-in-read-only-buffer diary-fancy-buffer + (or (get-buffer diary-fancy-buffer-name) + (calendar-in-read-only-buffer diary-fancy-buffer-name (calendar-set-mode-line "Diary Entries"))) - diary-fancy-buffer) + diary-fancy-buffer-name) (get-file-buffer diary-file))) t)) =20 @@ -138,7 +138,7 @@ calendar-frame-setup calendar-and-diary-frame-parameters calendar-frame-parameters)))) (calendar-basic-setup prompt (not (eq config 'one-frame))) - (set-window-buffer (selected-window) calendar-buffer) + (set-window-buffer (selected-window) calendar-buffer-name) (set-window-dedicated-p (selected-window) t) (if (eq config 'one-frame) (calendar-dedicate-diary)))))) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 2521a9c73c1..093873e84a5 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1079,43 +1079,64 @@ calendar-time-zone-style (defconst calendar-first-date-row 3 "First row in the calendar with actual dates.") =20 -(defcustom calendar-buffer "*Calendar*" +(make-obsolete-variable 'calendar-buffer + 'calendar-buffer-name + "30.0.50") +(defcustom calendar-buffer-name "*Calendar*" "Name of the buffer used for the calendar." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom holiday-buffer "*Holidays*" +(make-obsolete-variable 'holiday-buffer + 'holiday-buffer-name + "30.0.50") +(defcustom holiday-buffer-name "*Holidays*" "Name of the buffer used for the displaying the holidays." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom diary-fancy-buffer "*Fancy Diary Entries*" +(make-obsolete-variable 'diary-fancy-buffer + 'diary-fancy-buffer-name + "30.0.50") +(defcustom diary-fancy-buffer-name "*Fancy Diary Entries*" "Name of the buffer used for the optional fancy display of the diary." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom calendar-other-calendars-buffer "*Other Calendars*" +(make-obsolete-variable 'calendar-other-calendars-buffer + 'calendar-other-calendars-buffer-name + "30.0.50") +(defcustom calendar-other-calendars-buffer-name "*Other Calendars*" "Name of the buffer used for the display of date on other calendars." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom lunar-phases-buffer "*Phases of Moon*" +(make-obsolete-variable 'lunar-phases-buffer + 'lunar-phases-buffer-name + "30.0.50") +(defcustom lunar-phases-buffer-name "*Phases of Moon*" "Name of the buffer used for the lunar phases." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom solar-sunrises-buffer "*Sunrise/Sunset Times*" +(make-obsolete-variable 'solar-sunrises-buffer + 'solar-sunrises-buffer-name + "30.0.50") +(defcustom solar-sunrises-buffer-name "*Sunrise/Sunset Times*" "Name of buffer used for sunrise/sunset times." :type 'string :version "30.0.50" :group 'calendar) =20 -(defcustom calendar-hebrew-yahrzeit-buffer "*Yahrzeits*" +(make-obsolete-variable 'calendar-hebrew-yahrzeit-buffer + 'calendar-hebrew-yahrzeit-buffer-name + "30.0.50") +(defcustom calendar-hebrew-yahrzeit-buffer-name "*Yahrzeits*" "Name of the buffer used by `calendar-hebrew-list-yahrzeits'." :type 'string :version "30.0.50" @@ -1341,7 +1362,7 @@ calendar-basic-setup display the generated calendar." (interactive "P") (let ((buff (current-buffer))) - (set-buffer (get-buffer-create calendar-buffer)) + (set-buffer (get-buffer-create calendar-buffer-name)) (calendar-mode) (let* ((pop-up-windows t) ;; Not really needed now, but means we use exactly the same @@ -1386,7 +1407,7 @@ calendar-basic-setup ;; horizontally and we end up with three side-by-side windows. (when (window-splittable-p (selected-window) t) (split-window-right)) - (pop-to-buffer calendar-buffer) + (pop-to-buffer calendar-buffer-name) ;; Has the window already been split vertically? (when (and (not (window-dedicated-p)) (window-splittable-p (selected-window)) @@ -1425,7 +1446,7 @@ calendar-generate-window (today-visible (or (not mon) (<=3D (abs (calendar-interval mon yr month yea= r)) 1))) (in-calendar-window (eq (window-buffer) - (get-buffer calendar-buffer)))) + (get-buffer calendar-buffer-name)))) (calendar-generate (or mon month) (or yr year)) (calendar-update-mode-line) (calendar-cursor-to-visible-date @@ -1565,10 +1586,10 @@ calendar-generate-month (calendar-insert-at-column indent calendar-intermonth-text trunc)= ))))) =20 (defun calendar-redraw () - "Redraw the calendar display, if `calendar-buffer' is live." + "Redraw the calendar display, if `calendar-buffer-name' is live." (interactive) - (when (get-buffer calendar-buffer) - (with-current-buffer calendar-buffer + (when (get-buffer calendar-buffer-name) + (with-current-buffer calendar-buffer-name (let ((cursor-date (calendar-cursor-to-nearest-date))) (calendar-generate-window displayed-month displayed-year) (calendar-cursor-to-visible-date cursor-date)) @@ -1854,8 +1875,8 @@ calendar-string-spread (defun calendar-update-mode-line () "Update the calendar mode line with the current date and date style." (if (and calendar-mode-line-format - (bufferp (get-buffer calendar-buffer))) - (with-current-buffer calendar-buffer + (bufferp (get-buffer calendar-buffer-name))) + (with-current-buffer calendar-buffer-name (let ((start (- calendar-left-margin 2))) (calendar-dlet ((date (condition-case nil (calendar-cursor-to-nearest-date) @@ -1873,10 +1894,10 @@ calendar-update-mode-line (defun calendar-buffer-list () "List of all calendar-related buffers (as buffers, not strings)." (let (buffs) - (dolist (b (list calendar-hebrew-yahrzeit-buffer lunar-phases-buffer - holiday-buffer diary-fancy-buffer solar-sunrises-buff= er + (dolist (b (list calendar-hebrew-yahrzeit-buffer-name lunar-phases-buf= fer-name + holiday-buffer-name diary-fancy-buffer-name solar-sun= rises-buffer-name (get-file-buffer diary-file) - calendar-buffer calendar-other-calendars-buffer)) + calendar-buffer-name calendar-other-calendars-buffer-= name)) (and b (setq b (get-buffer b)) (push b buffs))) buffs)) @@ -2415,7 +2436,7 @@ calendar-unmark (interactive) (setq calendar-mark-holidays-flag nil calendar-mark-diary-entries-flag nil) - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (mapc #'delete-overlay (overlays-in (point-min) (point-max))))) =20 (defun calendar-date-is-visible-p (date) @@ -2527,7 +2548,7 @@ calendar-mark-visible-date MARK is a single-character string, a list of face attributes/values, or a face. MARK defaults to `diary-entry-marker'." (if (calendar-date-is-valid-p date) - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (save-excursion (calendar-cursor-to-visible-date date) (setq mark @@ -2704,7 +2725,7 @@ calendar-print-other-dates (and (setq selection (cal-menu-x-popup-menu event title (mapcar #'list others))) (call-interactively selection)) - (calendar-in-read-only-buffer calendar-other-calendars-buffer + (calendar-in-read-only-buffer calendar-other-calendars-buffer-name (calendar-set-mode-line title) (insert (mapconcat #'identity others "\n")))))) =20 diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 946cf0e7236..221c8436779 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -438,7 +438,7 @@ diary-header-line-format (defun diary-live-p () "Return non-nil if the diary is being displayed. The actual return value is a diary buffer." - (or (get-buffer diary-fancy-buffer) + (or (get-buffer diary-fancy-buffer-name) (and diary-file (find-buffer-visiting diary-file)))) =20 ;;;###cal-autoload @@ -974,7 +974,7 @@ diary-display-no-entries (not holiday-list)) (message "%s" msg) ;; holiday-list which is too wide for a message gets a buffer. - (calendar-in-read-only-buffer holiday-buffer + (calendar-in-read-only-buffer holiday-buffer-name (calendar-set-mode-line (format "Holidays for %s" diary--date-string)) (insert (mapconcat #'identity holiday-list "\n"))) @@ -1055,7 +1055,7 @@ diary-fancy-display (diary-unhide-everything)) (unless (car (diary-display-no-entries)) ; no entries ;; Prepare the fancy diary buffer. - (calendar-in-read-only-buffer diary-fancy-buffer + (calendar-in-read-only-buffer diary-fancy-buffer-name (calendar-set-mode-line "Diary Entries") (let ((holiday-list-last-month 1) (holiday-list-last-year 1) @@ -1152,7 +1152,7 @@ diary-print-entries The hooks given by the variable `diary-print-entries-hook' are called to do the actual printing." (interactive) - (let ((diary-buffer (get-buffer diary-fancy-buffer)) + (let ((diary-buffer (get-buffer diary-fancy-buffer-name)) temp-buffer heading start end) (if diary-buffer (with-current-buffer diary-buffer @@ -1235,8 +1235,8 @@ diary-mail-entries (concat "Diary entries generated " (calendar-date-string (calendar-current-date)))) (insert - (if (get-buffer diary-fancy-buffer) - (with-current-buffer diary-fancy-buffer (buffer-string)) + (if (get-buffer diary-fancy-buffer-name) + (with-current-buffer diary-fancy-buffer-name (buffer-string)) "No entries found")) (call-interactively (get mail-user-agent 'sendfunc)))) =20 @@ -1470,7 +1470,7 @@ diary-mark-sexp-entries (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) m y first-date last-date date mark file-glob-attrs sexp-start sexp entry entry-start) - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (setq m displayed-month y displayed-year)) (calendar-increment-month m y -1) @@ -1522,7 +1522,7 @@ calendar-mark-days-named "Mark all dates in the calendar window that are day DAYNAME of the week. 0 means all Sundays, 1 means all Mondays, and so on. Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK." - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (let ((prev-month displayed-month) (prev-year displayed-year) (succ-month displayed-month) @@ -1557,7 +1557,7 @@ calendar-mark-date-pattern "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. A value of 0 in any position is a wildcard. Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK." - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (let ((m displayed-month) (y displayed-year)) (calendar-increment-month m y -1) @@ -1601,7 +1601,7 @@ calendar-mark-1 The function FROMABS converts absolute dates to the appropriate date syste= m. The function TOABS carries out the inverse operation. Optional argument COLOR is passed to `calendar-mark-visible-date' as MARK." - (with-current-buffer calendar-buffer + (with-current-buffer calendar-buffer-name (if (and (not (zerop month)) (not (zerop day))) (if (not (zerop year)) ;; Fully specified date. @@ -2241,7 +2241,7 @@ diary-insert-cyclic-entry ;;; Diary mode. =20 (defun diary-redraw-calendar () - "If `calendar-buffer' is live and diary entries are marked, redraw it." + "If `calendar-buffer-name' is live and diary entries are marked, redraw = it." (and calendar-mark-diary-entries-flag (save-excursion (calendar-redraw))) diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index f30c5653c11..8fe203aa5ff 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el @@ -369,7 +369,7 @@ calendar-list-holidays (y2 displayed-year)) (if (not holiday-list) (message "Looking up holidays...none found") - (calendar-in-read-only-buffer holiday-buffer + (calendar-in-read-only-buffer holiday-buffer-name (calendar-increment-month m1 y1 -1) (calendar-increment-month m2 y2 1) (calendar-set-mode-line @@ -495,7 +495,7 @@ list-holidays (setq s (calendar-absolute-from-gregorian (list displayed-month 1 displayed-year)))) (save-current-buffer - (calendar-in-read-only-buffer holiday-buffer + (calendar-in-read-only-buffer holiday-buffer-name (calendar-set-mode-line (if (=3D y1 y2) (format "%s for %s" title y1) @@ -576,7 +576,7 @@ calendar-cursor-holidays (mapconcat 'identity holiday-list "; = ")))) (frame-width)) (message "%s" msg) - (calendar-in-read-only-buffer holiday-buffer + (calendar-in-read-only-buffer holiday-buffer-name (calendar-set-mode-line date-string) (insert (mapconcat 'identity holiday-list "\n"))) (message "Checking holidays...done")))))) diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 0db811417af..032daaf5d39 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -232,7 +232,7 @@ calendar-lunar-phases (y2 displayed-year)) (calendar-increment-month m1 y1 -1) (calendar-increment-month m2 y2 1) - (calendar-in-read-only-buffer lunar-phases-buffer + (calendar-in-read-only-buffer lunar-phases-buffer-name (calendar-set-mode-line (if (=3D y1 y2) (format "Phases of the Moon from %s to %s, %d%%-" diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index d82215a6d35..b76895cd2af 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el @@ -882,7 +882,7 @@ calendar-sunrise-sunset-month (title (format "Sunrise/sunset times for %s %d at %s" (calendar-month-name month) year (eval calendar-location-name)))) - (calendar-in-read-only-buffer solar-sunrises-buffer + (calendar-in-read-only-buffer solar-sunrises-buffer-name (calendar-set-mode-line title) (insert title ":\n\n") (dotimes (i last) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 671210f3ee8..10d183945df 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -2031,7 +2031,7 @@ todo-set-date-from-calendar (message "Put cursor on a date and type to set it.") (recursive-edit) (unwind-protect - (when (equal (buffer-name) calendar-buffer) + (when (equal (buffer-name) calendar-buffer-name) (setq todo-date-from-calendar (calendar-date-string (calendar-cursor-to-date t) t t)) (calendar-exit) diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 3db33c4d63e..e2e3c3fed3d 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -5339,7 +5339,7 @@ org-get-entries-from-diary "Get the (Emacs Calendar) diary entries for DATE." (require 'diary-lib) (declare-function diary-fancy-display "diary-lib" ()) - (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*") + (let* ((diary-fancy-buffer-name "*temporary-fancy-diary-buffer*") (diary-display-function #'diary-fancy-display) (pop-up-frames nil) (diary-list-entries-hook @@ -5353,9 +5353,9 @@ org-get-entries-from-diary (save-excursion (save-window-excursion (diary-list-entries date 1))) - (if (not (get-buffer diary-fancy-buffer)) + (if (not (get-buffer diary-fancy-buffer-name)) (setq entries nil) - (with-current-buffer diary-fancy-buffer + (with-current-buffer diary-fancy-buffer-name (setq buffer-read-only nil) (if (zerop (buffer-size)) ;; No entries @@ -5374,7 +5374,7 @@ org-get-entries-from-diary (replace-match (concat "; " (match-string 1))))) (buffer-string))))) (set-buffer-modified-p nil) - (kill-buffer diary-fancy-buffer))) + (kill-buffer diary-fancy-buffer-name))) (when entries (setq entries (org-split-string entries "\n")) (setq entries diff --git a/lisp/org/org.el b/lisp/org/org.el index 9a4f7803cf4..d9551677db0 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-name '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-name) (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-name 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-name t) (memq timestamp? '(day month year))) (org-recenter-calendar (time-to-days time)))))) =20 @@ -14995,7 +14995,7 @@ org-modify-ts-extra =20 (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-name t))) (when cwin (let ((calendar-move-hook nil)) (with-selected-window cwin @@ -15022,7 +15022,7 @@ org-goto-calendar =20 (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-name (save-match-data (calendar-cursor-to-date)))) =20 diff --git a/test/lisp/calendar/cal-julian-tests.el b/test/lisp/calendar/ca= l-julian-tests.el index e0d74e8a6cd..8db21f7b1a8 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-name)))) =20 (ert-deftest cal-julian-test-goto-date () (with-cal-julian-test --=20 2.38.2 --=-=-= Content-Type: text/plain I used 30.0.50 as the version number for the `defcustom' and `make-obsolete-variable' in the patches. This should be correct but feel free to change as needed. I opened the bug 61546 as well, which changes some stuff to `calendar-buffer' specifically. With this change, those also need to be replaced with `calendar-buffer-name', though these patches do not do so (should not be doing so, at the very least). --=-=-=--