summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-01-08 05:18:09 +0000
committerGlenn Morris <rgm@gnu.org>2008-01-08 05:18:09 +0000
commitd1050c6987122d508c57d717cc13f902f313ec45 (patch)
tree6892aab42dfc2def7ad102ec8dcd6b8dc0044278
parent9ec0afe82937c9422d0f4fa75854242bff466191 (diff)
downloademacs-d1050c6987122d508c57d717cc13f902f313ec45.tar.gz
(mouse-major-mode-menu): Suppress duplicate menus.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/mouse.el15
2 files changed, 20 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 37341b2de72..f375e101d6c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-08 Glenn Morris <rgm@gnu.org>
+
+ * diff-mode.el (diff-end-of-hunk): Don't match empty lines in
+ unified format.
+
+ * mouse.el (mouse-major-mode-menu): Suppress duplicate menus.
+
2008-01-08 Nick Roberts <nickrob@snap.net.nz>
* progmodes/gdb-ui.el (gdb-var-list-children-1): Put varnum in
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 179670c7326..27bf00ce267 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -173,11 +173,22 @@ Default to the Edit menu if the major mode doesn't define a menu."
;; default to the edit menu.
(newmap (if ancestor
(make-sparse-keymap (concat 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)))