diff options
| author | Glenn Morris | 2008-01-08 05:13:06 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-01-08 05:13:06 +0000 |
| commit | 0595c9f92fc6fe05951d567e2aa9976e78e72843 (patch) | |
| tree | e4d27a7074019bf52a85faba77329365a84322fd | |
| parent | 15d621675c8103771d86d0668342b75d1f71b2b0 (diff) | |
| download | emacs-0595c9f92fc6fe05951d567e2aa9976e78e72843.tar.gz emacs-0595c9f92fc6fe05951d567e2aa9976e78e72843.zip | |
(mouse-major-mode-menu): Suppress duplicate menus.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/mouse.el | 15 |
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 @@ | |||
| 1 | 2008-01-05 Ralf Angeli <angeli@caeruleus.net> | 1 | 2008-01-08 Glenn Morris <rgm@gnu.org> |
| 2 | |||
| 3 | * mouse.el (mouse-major-mode-menu): Suppress duplicate menus. | ||
| 4 | |||
| 5 | 2008-01-08 Ralf Angeli <angeli@caeruleus.net> | ||
| 2 | 6 | ||
| 3 | * textmodes/reftex-toc.el (reftex-make-separate-toc-frame): | 7 | * textmodes/reftex-toc.el (reftex-make-separate-toc-frame): |
| 4 | Simplify selection of frame focusing function. | 8 | 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." | |||
| 194 | (newmap (if ancestor | 194 | (newmap (if ancestor |
| 195 | (make-sparse-keymap (concat (format-mode-line mode-name) | 195 | (make-sparse-keymap (concat (format-mode-line mode-name) |
| 196 | " Mode")) | 196 | " Mode")) |
| 197 | menu-bar-edit-menu))) | 197 | menu-bar-edit-menu)) |
| 198 | uniq) | ||
| 198 | (if ancestor | 199 | (if ancestor |
| 199 | ;; Make our menu inherit from the desired keymap which we want | 200 | ;; Make our menu inherit from the desired keymap which we want |
| 200 | ;; to display as the menu now. | 201 | ;; to display as the menu now. |
| 201 | (set-keymap-parent newmap ancestor)) | 202 | ;; Sometimes keymaps contain duplicate menu code, leading to |
| 203 | ;; duplicates in the popped-up menu. Avoid this by simply | ||
| 204 | ;; taking the first of any identically-named menus. | ||
| 205 | ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00469.html | ||
| 206 | (set-keymap-parent newmap | ||
| 207 | (progn | ||
| 208 | (dolist (e ancestor) | ||
| 209 | (unless (and (listp e) | ||
| 210 | (assoc (car e) uniq)) | ||
| 211 | (setq uniq (append uniq (list e))))) | ||
| 212 | uniq))) | ||
| 202 | (popup-menu newmap event prefix))) | 213 | (popup-menu newmap event prefix))) |
| 203 | 214 | ||
| 204 | 215 | ||