summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-01-08 05:13:06 +0000
committerGlenn Morris <rgm@gnu.org>2008-01-08 05:13:06 +0000
commit0595c9f92fc6fe05951d567e2aa9976e78e72843 (patch)
treee4d27a7074019bf52a85faba77329365a84322fd
parent15d621675c8103771d86d0668342b75d1f71b2b0 (diff)
downloademacs-0595c9f92fc6fe05951d567e2aa9976e78e72843.tar.gz
(mouse-major-mode-menu): Suppress duplicate menus.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/mouse.el15
2 files changed, 18 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dc7dd5a4179..21205e3f8b1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,8 @@
-2008-01-05 Ralf Angeli <angeli@caeruleus.net>
+2008-01-08 Glenn Morris <rgm@gnu.org>
+
+ * mouse.el (mouse-major-mode-menu): Suppress duplicate menus.
+
+2008-01-08 Ralf Angeli <angeli@caeruleus.net>
* textmodes/reftex-toc.el (reftex-make-separate-toc-frame):
Simplify selection of frame focusing function.
diff --git a/lisp/mouse.el b/lisp/mouse.el
index ec0849f7d06..40debbd532c 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -194,11 +194,22 @@ Default to the Edit menu if the major mode doesn't define a menu."
(newmap (if ancestor
(make-sparse-keymap (concat (format-mode-line mode-name)
" Mode"))
- menu-bar-edit-menu)))
+ menu-bar-edit-menu))
+ uniq)
(if ancestor
;; Make our menu inherit from the desired keymap which we want
;; to display as the menu now.
- (set-keymap-parent newmap ancestor))
+ ;; Sometimes keymaps contain duplicate menu code, leading to
+ ;; duplicates in the popped-up menu. Avoid this by simply
+ ;; taking the first of any identically-named menus.
+ ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00469.html
+ (set-keymap-parent newmap
+ (progn
+ (dolist (e ancestor)
+ (unless (and (listp e)
+ (assoc (car e) uniq))
+ (setq uniq (append uniq (list e)))))
+ uniq)))
(popup-menu newmap event prefix)))