From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: show minor-mode menu when you click its mode-line lighter
Date: Thu, 27 Sep 2007 15:21:47 -0700 [thread overview]
Message-ID: <DHEEKFAFJEFOJHLCFPFDGEGJCBAA.drew.adams@oracle.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
Attached is a patch that makes a `mouse-1' click on a minor-mode lighter in
the mode line raise its menu-bar menu, if any, as a popup.
This is analogous to what `mouse-1' does when you click the major-mode
lighter. Each minor-mode lighter brings up its own menu. If a minor mode has
no menu-bar menu, then `mouse-1' displays a message stating that.
Currently, `mouse-1' does nothing here, so this is an addition.
Example: Minor mode Icicles has lighter "Icy" in the mode line, and it has a
menu-bar menu `Icicles'. Whether or not the menu-bar is showing, if you
click the lighter "Icy" then the `Icicles' menu pops up.
[-- Attachment #2: bindings-2007-09-27.patch --]
[-- Type: application/octet-stream, Size: 7930 bytes --]
*** bindings-CVS-2007-09-27.el Thu Sep 27 14:43:48 2007
--- bindings-patched-2007-09-27.el Thu Sep 27 15:07:04 2007
***************
*** 289,294 ****
--- 289,295 ----
(defvar mode-line-minor-mode-keymap
(let ((map (make-sparse-keymap)))
+ (define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu)
(define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
(define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
(define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1)
***************
*** 304,346 ****
"mouse-1: select (drag to resize), mouse-2 = C-x 1, mouse-3 = C-x 0")
(dashes (propertize "--" 'help-echo help-echo))
(standard-mode-line-format
! (list
! "%e"
! (propertize "-" 'help-echo help-echo)
! 'mode-line-mule-info
! 'mode-line-client
! 'mode-line-modified
! 'mode-line-remote
! 'mode-line-frame-identification
! 'mode-line-buffer-identification
! (propertize " " 'help-echo help-echo)
! 'mode-line-position
! '(vc-mode vc-mode)
! (propertize " " 'help-echo help-echo)
! 'mode-line-modes
`(which-func-mode ("" which-func-format ,dashes))
`(global-mode-string (,dashes global-mode-string))
(propertize "-%-" 'help-echo help-echo)))
(standard-mode-line-modes
! (list
! (propertize "%[(" 'help-echo help-echo)
`(:propertize ("" mode-name)
! help-echo "mouse-1: major mode, mouse-2: major mode help, mouse-3: toggle minor modes"
mouse-face mode-line-highlight
local-map ,mode-line-major-mode-keymap)
'("" mode-line-process)
`(:propertize ("" minor-mode-alist)
mouse-face mode-line-highlight
! help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes"
local-map ,mode-line-minor-mode-keymap)
(propertize "%n" 'help-echo "mouse-2: widen"
'mouse-face 'mode-line-highlight
'local-map (make-mode-line-mouse-map
'mouse-2 #'mode-line-widen))
(propertize ")%]--" 'help-echo help-echo)))
!
! (standard-mode-line-position
! `((-3 ,(propertize "%p" 'help-echo help-echo))
(size-indication-mode
(8 ,(propertize " of %I" 'help-echo help-echo)))
(line-number-mode
--- 305,338 ----
"mouse-1: select (drag to resize), mouse-2 = C-x 1, mouse-3 = C-x 0")
(dashes (propertize "--" 'help-echo help-echo))
(standard-mode-line-format
! (list "%e"
! (propertize "-" 'help-echo help-echo) 'mode-line-mule-info
! 'mode-line-client 'mode-line-modified 'mode-line-remote
! 'mode-line-frame-identification 'mode-line-buffer-identification
! (propertize " " 'help-echo help-echo) 'mode-line-position '(vc-mode vc-mode)
! (propertize " " 'help-echo help-echo) 'mode-line-modes
`(which-func-mode ("" which-func-format ,dashes))
`(global-mode-string (,dashes global-mode-string))
(propertize "-%-" 'help-echo help-echo)))
(standard-mode-line-modes
! (list (propertize "%[(" 'help-echo help-echo)
`(:propertize ("" mode-name)
! help-echo "mouse-1: major-mode menu, mouse-2: major-mode help, \
! mouse-3: toggle minor modes"
mouse-face mode-line-highlight
local-map ,mode-line-major-mode-keymap)
'("" mode-line-process)
`(:propertize ("" minor-mode-alist)
mouse-face mode-line-highlight
! help-echo "mouse-1: minor-mode menu, mouse-2: minor-mode help, \
! mouse-3: toggle minor modes"
local-map ,mode-line-minor-mode-keymap)
(propertize "%n" 'help-echo "mouse-2: widen"
'mouse-face 'mode-line-highlight
'local-map (make-mode-line-mouse-map
'mouse-2 #'mode-line-widen))
(propertize ")%]--" 'help-echo help-echo)))
! (standard-mode-line-position `((-3 ,(propertize "%p" 'help-echo help-echo))
(size-indication-mode
(8 ,(propertize " of %I" 'help-echo help-echo)))
(line-number-mode
***************
*** 349,366 ****
(6 ,(propertize " L%l" 'help-echo help-echo))))
((column-number-mode
(5 ,(propertize " C%c" 'help-echo help-echo))))))))
-
(setq-default mode-line-format standard-mode-line-format)
! (put 'mode-line-format 'standard-value
! (list `(quote ,standard-mode-line-format)))
(setq-default mode-line-modes standard-mode-line-modes)
! (put 'mode-line-modes 'standard-value
! (list `(quote ,standard-mode-line-modes)))
(setq-default mode-line-position standard-mode-line-position)
! (put 'mode-line-position 'standard-value
! (list `(quote ,standard-mode-line-position))))
(defvar mode-line-buffer-identification-keymap
;; Add menu of buffer operations to the buffer identification part
--- 341,354 ----
(6 ,(propertize " L%l" 'help-echo help-echo))))
((column-number-mode
(5 ,(propertize " C%c" 'help-echo help-echo))))))))
(setq-default mode-line-format standard-mode-line-format)
! (put 'mode-line-format 'standard-value (list `(quote ,standard-mode-line-format)))
(setq-default mode-line-modes standard-mode-line-modes)
! (put 'mode-line-modes 'standard-value (list `(quote ,standard-mode-line-modes)))
(setq-default mode-line-position standard-mode-line-position)
! (put 'mode-line-position 'standard-value (list `(quote ,standard-mode-line-position))))
(defvar mode-line-buffer-identification-keymap
;; Add menu of buffer operations to the buffer identification part
***************
*** 492,499 ****
(interactive "@e")
(x-popup-menu event mode-line-mode-menu))
(defun mode-line-minor-mode-help (event)
! "Describe minor mode for EVENT occurred on minor modes area of the mode line."
(interactive "@e")
(let ((indicator (car (nth 4 (car (cdr event))))))
(describe-minor-mode-from-indicator indicator)))
--- 480,507 ----
(interactive "@e")
(x-popup-menu event mode-line-mode-menu))
+ (defun mouse-minor-mode-menu (event)
+ "Show minor-mode menu for EVENT on minor modes area of the mode line."
+ (interactive "@e")
+ (let ((indicator (car (nth 4 (car (cdr event))))))
+ (minor-mode-menu-from-indicator indicator)))
+
+ (defun minor-mode-menu-from-indicator (indicator) ; " Icy"
+ "Show menu, if any, for minor mode specified by INDICATOR.
+ Interactively, INDICATOR is read using completion."
+ (interactive (list (completing-read "Minor mode indicator: "
+ (describe-minor-mode-completion-table-for-indicator))))
+ (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
+ (if minor-mode
+ (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
+ (menu (and (keymapp map) (lookup-key map [menu-bar]))))
+ (if menu
+ (popup-menu menu)
+ (message "No menu for minor mode `%s'" minor-mode)))
+ (error "Cannot find minor mode for `%s'" indicator))))
+
(defun mode-line-minor-mode-help (event)
! "Describe minor mode for EVENT on minor modes area of the mode line."
(interactive "@e")
(let ((indicator (car (nth 4 (car (cdr event))))))
(describe-minor-mode-from-indicator indicator)))
Diff finished. Thu Sep 27 15:07:29 2007
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next reply other threads:[~2007-09-27 22:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-27 22:21 Drew Adams [this message]
2007-09-28 19:04 ` show minor-mode menu when you click its mode-line lighter Richard Stallman
2007-10-02 21:18 ` Drew Adams
2007-10-03 18:37 ` Richard Stallman
2007-10-03 23:17 ` Michaël Cadilhac
2007-10-04 16:59 ` Drew Adams
2007-10-04 17:27 ` Richard Stallman
2007-10-04 18:55 ` Dan Nicolaescu
2007-10-08 18:03 ` Richard Stallman
2007-10-08 18:10 ` Glenn Morris
2007-10-08 15:35 ` Michaël Cadilhac
2007-10-08 16:46 ` Drew Adams
2007-10-09 1:14 ` Richard Stallman
2007-10-09 2:39 ` Drew Adams
2007-10-10 13:01 ` Richard Stallman
2007-10-18 4:10 ` Glenn Morris
2007-10-09 1:14 ` Richard Stallman
2007-10-09 16:48 ` Davis Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DHEEKFAFJEFOJHLCFPFDGEGJCBAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.