]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix easy menu separator in oldXMenu
authorManuel Giraud <manuel@ledu-giraud.fr>
Fri, 18 Nov 2022 21:58:19 +0000 (22:58 +0100)
committerStefan Kangas <stefankangas@gmail.com>
Thu, 24 Nov 2022 23:53:16 +0000 (00:53 +0100)
* lisp/emacs-lisp/easymenu.el (easy-menu-convert-item-1): Replace a
string of dash with a menu separator as the doc says.  (Bug#59370)

lisp/emacs-lisp/easymenu.el

index 41e3a197af4717d8ca26a9a35d9c0ee469489c94..2a45c1ab1ccb1e74fadfe31cee3063b25e4c7725 100644 (file)
@@ -390,10 +390,13 @@ ITEM defines an item as in `easy-menu-define'."
     (let ((key (easy-menu-intern name)))
       (cons key
             (and (not remove)
-                 (cons 'menu-item
-                       (cons label
-                             (and name
-                                  (cons command prop)))))))))
+                 (if (and (stringp label)
+                          (seq-every-p (lambda (c) (char-equal c ?-)) label))
+                     menu-bar-separator
+                   (cons 'menu-item
+                         (cons label
+                               (and name
+                                    (cons command prop))))))))))
 
 (defun easy-menu-define-key (menu key item &optional before)
   "Add binding in MENU for KEY => ITEM.  Similar to `define-key-after'.