From: Saroj Thirumalai Date: Wed, 23 Jun 2021 20:17:03 +0000 (+0300) Subject: * lisp/printing.el (pr-global-menubar): Fix duplicate menu problem. X-Git-Tag: emacs-28.0.90~2048 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7be75f17e79b547dc03e26e3980d4ce75bfa668d;p=emacs.git * lisp/printing.el (pr-global-menubar): Fix duplicate menu problem. In Emacs 27.1 Print menu items were moved to a submenu of the File menu. The Printing package (lisp/printing.el) replaces the Print menu (via the function: pr-global-menubar). The latter needs to be updated to reflect the changes; otherwise, a second Print (sub)menu is created at the end of the File menu. Copyright-paperwork-exempt: yes --- diff --git a/lisp/printing.el b/lisp/printing.el index 5c7da96551f..e7aab901d53 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -1081,24 +1081,15 @@ Used by `pr-menu-bind' and `pr-update-menus'.") "Specify Printing menu-bar entry.") (defun pr-global-menubar (menu-spec) - (let ((menu-file '("menu-bar" "file"))) - (cond - (pr-menu-print-item - (easy-menu-add-item global-map menu-file - (easy-menu-create-menu "Print" menu-spec) - "print-buffer") - (dolist (item '("print-buffer" "print-region" - "ps-print-buffer-faces" "ps-print-region-faces" - "ps-print-buffer" "ps-print-region")) - (easy-menu-remove-item global-map menu-file item)) - (setq pr-menu-print-item nil - pr-menu-bar (vector 'menu-bar - (easy-menu-intern (nth 1 menu-file)) - (easy-menu-intern "Print")))) - (t - (easy-menu-add-item global-map menu-file - (easy-menu-create-menu "Print" menu-spec))) - ))) + (let ((menu-file '("menu-bar" "file")) + (submenu-path [menu-bar file Print]) + (submenu (easy-menu-create-menu "Print" menu-spec))) + (cond (pr-menu-print-item + (easy-menu-add-item global-map menu-file submenu "Print") + (easy-menu-remove-item global-map menu-file "print") + (setq pr-menu-print-item nil + pr-menu-bar submenu-path)) + (t (easy-menu-add-item global-map menu-file submenu))))) (defun pr-menu-position (entry index horizontal) (let ((pos (cdr (mouse-pixel-position))))