1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-26 19:18:50 +00:00

(mode-line-column-line-number-mode-map): New variable.

(standard-mode-line-position): Use it to add a menu for toggling
column number and line number display.
This commit is contained in:
Dan Nicolaescu 2008-03-03 08:30:18 +00:00
parent 73f838adaf
commit 10a55ba03d
2 changed files with 39 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2008-03-03 Dan Nicolaescu <dann@ics.uci.edu>
* bindings.el (mode-line-column-line-number-mode-map): New variable.
(standard-mode-line-position): Use it to add a menu for toggling
column number and line number display.
2008-03-03 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/bytecomp.el (byte-compile-maybe-guarded):

View File

@ -299,6 +299,21 @@ Keymap to display on major mode.")
map) "\
Keymap to display on minor modes.")
(defvar mode-line-column-line-number-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
(define-key menu-map [line-number-mode]
`(menu-item ,(purecopy "Display Line Numbers") line-number-mode
:help "Toggle displaying line numbers in the mode-line"
:button (:toggle . line-number-mode)))
(define-key menu-map [column-number-mode]
`(menu-item ,(purecopy "Display Column Numbers") column-number-mode
:help "Toggle displaying column numbers in the mode-line"
:button (:toggle . column-number-mode)))
(define-key map [mode-line down-mouse-1] menu-map)
map) "\
Keymap to display on column and line numbers.")
(let* ((help-echo
;; The multi-line message doesn't work terribly well on the
;; bottom mode line... Better ideas?
@ -352,27 +367,37 @@ mouse-3: Toggle minor modes"
(propertize ")%]--" 'help-echo help-echo)))
(standard-mode-line-position
`((-3 ,(propertize "%p" 'help-echo help-echo))
`((-3 ,(propertize
"%p"
'local-map mode-line-column-line-number-mode-map
;; XXX needs better description
'help-echo "Size indication mode\n\
mouse-1: Display Line and Column Mode Menu"))
(size-indication-mode
(8 ,(propertize
" of %I"
'local-map mode-line-column-line-number-mode-map
;; XXX needs better description
'help-echo (format "Size indication mode\n%s" help-echo))))
'help-echo "Size indication mode\n\
mouse-1: Display Line and Column Mode Menu")))
(line-number-mode
((column-number-mode
(10 ,(propertize
" (%l,%c)"
'help-echo
(format "Line number and Column number\n%s" help-echo)))
'local-map mode-line-column-line-number-mode-map
'help-echo "Line number and Column number\n\
mouse-1: Display Line and Column Mode Menu"))
(6 ,(propertize
" L%l"
'help-echo
(format "Line number\n%s" help-echo)))))
'local-map mode-line-column-line-number-mode-map
'help-echo "Line Number\n\
mouse-1: Display Line and Column Mode Menu"))))
((column-number-mode
(5 ,(propertize
" C%c"
'help-echo
(format "Column number\n%s" help-echo)))))))))
'local-map mode-line-column-line-number-mode-map
'help-echo "Column number\n\
mouse-1: Display Line and Column Mode Menu"))))))))
(setq-default mode-line-format standard-mode-line-format)
(put 'mode-line-format 'standard-value