emacs-31 76c8065bf63: VC-Annotate menu: Fix inserting "Span NN.NN days" entries

Sean Whitton <[email protected]> Wed, 22 Jul 2026 10:40:51 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 76c8065bf63f843f56449f3d3e3cf0b8d2e9e849
Author: Sean Whitton <[email protected]>
Commit: Sean Whitton <[email protected]>

    VC-Annotate menu: Fix inserting "Span NN.NN days" entries
    
    * lisp/vc/vc-annotate.el (vc-annotate-mode-menu): Generate
    entries based on vc-annotate-color-map using a :filter function,
    instead of using whatever value that variable happened to have
    at load time.
---
 lisp/vc/vc-annotate.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 83b5185a4b4..9b5c9df210b 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -277,22 +277,25 @@ cover the range from the oldest annotation to the newest."
 			 (- current newest))
 	       (format "Spanned to %.1f days old" (- current oldest))))))
 
-;; Menu -- Using easymenu.el
 (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
-  "VC Annotate Display Menu."
+  "Menu for VC-Annotate buffers."
   `("VC-Annotate"
+    :filter ,(lambda (items)
+               (let ((o-i-m (vc-annotate-oldest-in-map
+                             (default-value 'vc-annotate-color-map))))
+                 `(,(car items)
+                   ,@(mapcar (lambda (element)
+                               (let ((days (* element o-i-m)))
+                                 `[,(format "Span %.1f days" days)
+                                   (vc-annotate-display-select nil ,days)
+                                   :style toggle :selected
+                                   (eql vc-annotate-display-mode ,days) ]))
+                             vc-annotate-menu-elements)
+                   . ,(cddr items))))
     ["By Color Map Range" (unless (null vc-annotate-display-mode)
                  (setq vc-annotate-display-mode nil)
                  (vc-annotate-display-select))
      :style toggle :selected (null vc-annotate-display-mode)]
-    ,@(let ((oldest-in-map (vc-annotate-oldest-in-map vc-annotate-color-map)))
-        (mapcar (lambda (element)
-                  (let ((days (* element oldest-in-map)))
-                    `[,(format "Span %.1f days" days)
-                      (vc-annotate-display-select nil ,days)
-                      :style toggle :selected
-                      (eql vc-annotate-display-mode ,days) ]))
-                vc-annotate-menu-elements))
     ["Span ..."
      (vc-annotate-display-select
       nil (float (string-to-number (read-string "Span how many days? "))))]