# HG changeset patch # User Dave Love # Date 932420953 0 # Node ID 00d2eba70774b09d91995ff6301e51eb3e0fa88a # Parent 1e276451494fa73001362c5c21133580610476c9 (mouse-major-mode-menu): Default to menu-bar-edit-menu for modes which don't define menus. diff -r 1e276451494f -r 00d2eba70774 lisp/mouse.el --- a/lisp/mouse.el Mon Jul 19 21:46:22 1999 +0000 +++ b/lisp/mouse.el Mon Jul 19 21:49:13 1999 +0000 @@ -45,25 +45,31 @@ ;; Provide a mode-specific menu on a mouse button. (defun mouse-major-mode-menu (event prefix) - "Pop up a mode-specific menu of mouse commands." + "Pop up a mode-specific menu of mouse commands. +Default to the Edit menu if the major mode doesn't define a menu." ;; Switch to the window clicked on, because otherwise ;; the mode's commands may not make sense. (interactive "@e\nP") ;; Let the mode update its menus first. (run-hooks 'activate-menubar-hook) - (let (;; This is where mouse-major-mode-menu-prefix - ;; returns the prefix we should use (after menu-bar). - ;; It is either nil or (SOME-SYMBOL). - (mouse-major-mode-menu-prefix nil) - ;; Make a keymap in which our last command leads to a menu - (newmap (make-sparse-keymap (concat mode-name " Mode"))) - result) - ;; Make our menu inherit from the desired keymap - ;; which we want to display as the menu now. - (set-keymap-parent newmap - (mouse-major-mode-menu-1 - (and (current-local-map) - (lookup-key (current-local-map) [menu-bar])))) + (let* (;; This is where mouse-major-mode-menu-prefix + ;; returns the prefix we should use (after menu-bar). + ;; It is either nil or (SOME-SYMBOL). + (mouse-major-mode-menu-prefix nil) + ;; Keymap from which to inherit; may be null. + (ancestor (mouse-major-mode-menu-1 + (and (current-local-map) + (lookup-key (current-local-map) [menu-bar])))) + ;; Make a keymap in which our last command leads to a menu or + ;; default to the edit menu. + (newmap (if ancestor + (make-sparse-keymap (concat mode-name " Mode")) + menu-bar-edit-menu)) + result) + (if ancestor + ;; Make our menu inherit from the desired keymap which we want + ;; to display as the menu now. + (set-keymap-parent newmap ancestor)) (setq result (x-popup-menu t (list newmap))) (if result (let ((command (key-binding