]> git.eshelyaron.com Git - emacs.git/commitdiff
Separate out the holiday lists into its own function
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 27 Apr 2022 12:57:57 +0000 (14:57 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 27 Apr 2022 12:58:53 +0000 (14:58 +0200)
* lisp/calendar/holidays.el (holiday-lists): Separated out into
its own function so that it can be altered (bug#55140).
(list-holidays): Use it.

lisp/calendar/holidays.el
lisp/ldefs-boot.el

index 2afa667a56c712b98acc3cf5ffc61dd2ca60d119..ca7166c371a2d307cbc6bdc97c50555876e26d26 100644 (file)
@@ -400,6 +400,36 @@ This function is suitable for execution in an init file."
            (displayed-year (calendar-extract-year date)))
       (calendar-list-holidays))))
 
+(defun holiday-lists ()
+  "Return a list of all holiday lists.
+This is used by `list-holidays', and you can customize the return
+value by using `add-function'."
+  (delq
+   nil
+   (list
+    (cons "All" calendar-holidays)
+    (cons "Equinoxes/Solstices"
+          (list (list 'solar-equinoxes-solstices)))
+    (if holiday-general-holidays
+        (cons "General" holiday-general-holidays))
+    (if holiday-local-holidays
+        (cons "Local" holiday-local-holidays))
+    (if holiday-other-holidays
+        (cons "Other" holiday-other-holidays))
+    (if holiday-christian-holidays
+        (cons "Christian" holiday-christian-holidays))
+    (if holiday-hebrew-holidays
+        (cons "Hebrew" holiday-hebrew-holidays))
+    (if holiday-islamic-holidays
+        (cons "Islamic" holiday-islamic-holidays))
+    (if holiday-bahai-holidays
+        (cons "Bahá’í" holiday-bahai-holidays))
+    (if holiday-oriental-holidays
+        (cons "Oriental" holiday-oriental-holidays))
+    (if holiday-solar-holidays
+        (cons "Solar" holiday-solar-holidays))
+    (cons "Ask" nil))))
+
 ;; rms: "Emacs commands to display a list of something generally start
 ;; with `list-'.  Please make `list-holidays' the principal name."
 ;;;###autoload
@@ -421,7 +451,11 @@ documentation of `calendar-holidays' for a list of the variables
 that control the choices, as well as a description of the format
 of a holiday list.
 
-The optional LABEL is used to label the buffer created."
+The optional LABEL is used to label the buffer created.
+
+The list of holiday lists is computed by the `holiday-lists', and
+you can alter the results by redefining that function, or use
+`add-function' to all values."
   (interactive
    (let* ((start-year (calendar-read-sexp
                        "Starting year of holidays (>0)"
@@ -433,30 +467,7 @@ The optional LABEL is used to label the buffer created."
                      start-year
                      start-year))
           (completion-ignore-case t)
-          (lists
-           (list
-            (cons "All" calendar-holidays)
-            (cons "Equinoxes/Solstices"
-                  (list (list 'solar-equinoxes-solstices)))
-            (if holiday-general-holidays
-                (cons "General" holiday-general-holidays))
-            (if holiday-local-holidays
-                (cons "Local" holiday-local-holidays))
-            (if holiday-other-holidays
-                (cons "Other" holiday-other-holidays))
-            (if holiday-christian-holidays
-                (cons "Christian" holiday-christian-holidays))
-            (if holiday-hebrew-holidays
-                (cons "Hebrew" holiday-hebrew-holidays))
-            (if holiday-islamic-holidays
-                (cons "Islamic" holiday-islamic-holidays))
-            (if holiday-bahai-holidays
-                (cons "Bahá’í" holiday-bahai-holidays))
-            (if holiday-oriental-holidays
-                (cons "Oriental" holiday-oriental-holidays))
-            (if holiday-solar-holidays
-                (cons "Solar" holiday-solar-holidays))
-            (cons "Ask" nil)))
+          (lists (holiday-lists))
           (choice (capitalize
                    (completing-read "List (TAB for choices): " lists nil t)))
           (which (if (string-equal choice "Ask")
index 93e8e14d1f05fe53087b389f1860c46ca2b44304..41a2b920b5fec31dd0c2eef8e3820327f5b5bd8a 100644 (file)
@@ -16110,19 +16110,22 @@ If this produces no string either, return nil." nil nil)
 
 (autoload 'display-local-help "help-at-pt" "\
 Display local help in the echo area.
-This displays a short help message, namely the string produced by
-the `kbd-help' property at point.  If `kbd-help' does not produce
-a string, but the `help-echo' property does, then that string is
-printed instead.
+This command, by default, displays a short help message, namely
+the string produced by the `kbd-help' property at point.  If
+`kbd-help' does not produce a string, but the `help-echo'
+property does, then that string is printed instead.
 
 The string is passed through `substitute-command-keys' before it
 is displayed.
 
-A numeric argument ARG prevents display of a message in case
-there is no help.  While ARG can be used interactively, it is
-mainly meant for use from Lisp.
+If INHIBIT-WARNING is non-nil, this prevents display of a message
+in case there is no help.
 
-\(fn &optional ARG)" t nil)
+If DESCRIBE-BUTTON in non-nil (interactively, the prefix arg), and
+there's a button/widget at point, pop a buffer describing that
+button/widget instead.
+
+\(fn &optional INHIBIT-WARNING DESCRIBE-BUTTON)" t nil)
 
 (autoload 'help-at-pt-cancel-timer "help-at-pt" "\
 Cancel any timer set by `help-at-pt-set-timer'.
@@ -17359,6 +17362,10 @@ of a holiday list.
 
 The optional LABEL is used to label the buffer created.
 
+The list of holiday lists is computed by the `holiday-lists', and
+you can alter the results by redefining that function, or use
+`add-function' to all values.
+
 \(fn Y1 &optional Y2 L LABEL)" t nil)
 
 (defalias 'holiday-list 'list-holidays)
@@ -32771,6 +32778,14 @@ Major-mode for writing SRecode macros.
 
 (register-definition-prefixes "srecode/table" '("object-sort-list" "srecode-"))
 
+;;;***
+\f
+;;;### (autoloads nil "string-edit" "textmodes/string-edit.el" (0
+;;;;;;  0 0 0))
+;;; Generated autoloads from textmodes/string-edit.el
+
+(register-definition-prefixes "string-edit" '("read-string-from-buffer" "string-edit-"))
+
 ;;;***
 \f
 ;;;### (autoloads nil "strokes" "strokes.el" (0 0 0 0))