1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-28 19:42:02 +00:00

(make-mode-line-mouse-map): Renamed from

make-mode-line-mouse2-map.  Take additional arg MOUSE.
(mode-line-modified): Use mouse-3 instead of mouse-2.
(mode-line-buffer-identification-keymap): Bind keys differently.
(propertized-buffer-identification): Adapt help-echo to new
bindings.
This commit is contained in:
Gerd Moellmann 2001-08-09 14:06:54 +00:00
parent a4afe04e52
commit 1ebfdece8e

View File

@ -47,12 +47,12 @@
;;; Code: ;;; Code:
(defun make-mode-line-mouse2-map (f) "\ (defun make-mode-line-mouse-map (mouse function) "\
Return a keymap with single entry for mouse-2 on mode line. Return a keymap with single entry for mouse key MOUSE on the mode line.
This is defined to run function F with no args in the buffer MOUSE is defined to run function FUNCTION with no args in the buffer
corresponding to the mode line clicked." corresponding to the mode line clicked."
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-2] f) (define-key map (vector 'mode-line mouse) function)
map)) map))
@ -179,25 +179,26 @@ Normally nil in most modes, since there is no process to display.")
(list (propertize (list (propertize
"%1*" "%1*"
'help-echo (purecopy (lambda (window object point) 'help-echo (purecopy (lambda (window object point)
(format "%sead-only: mouse-2 toggles" (format "%sead-only: mouse-3 toggles"
(save-selected-window (save-selected-window
(select-window window) (select-window window)
(if buffer-read-only (if buffer-read-only
"R" "R"
"Not r"))))) "Not r")))))
'local-map (purecopy (make-mode-line-mouse2-map 'local-map (purecopy (make-mode-line-mouse-map
'mouse-3
#'mode-line-toggle-read-only))) #'mode-line-toggle-read-only)))
(propertize (propertize
"%1+" "%1+"
'help-echo (purecopy (lambda (window object point) 'help-echo (purecopy (lambda (window object point)
(format "%sodified: mouse-2 toggles" (format "%sodified: mouse-3 toggles"
(save-selected-window (save-selected-window
(select-window window) (select-window window)
(if (buffer-modified-p) (if (buffer-modified-p)
"M" "M"
"Not m"))))) "Not m")))))
'local-map (purecopy (make-mode-line-mouse2-map 'local-map (purecopy (make-mode-line-mouse-map
#'mode-line-toggle-modified)))) 'mouse-3 #'mode-line-toggle-modified))))
"Mode-line control for displaying whether current buffer is modified.") "Mode-line control for displaying whether current buffer is modified.")
(make-variable-buffer-local 'mode-line-modified) (make-variable-buffer-local 'mode-line-modified)
@ -222,7 +223,8 @@ Normally nil in most modes, since there is no process to display.")
(propertize " %[(" 'help-echo help-echo) (propertize " %[(" 'help-echo help-echo)
'(:eval (mode-line-mode-name)) 'mode-line-process 'minor-mode-alist '(:eval (mode-line-mode-name)) 'mode-line-process 'minor-mode-alist
(propertize "%n" 'help-echo "mouse-2: widen" (propertize "%n" 'help-echo "mouse-2: widen"
'local-map (make-mode-line-mouse2-map #'mode-line-widen)) 'local-map (make-mode-line-mouse-map
'mouse-2 #'mode-line-widen))
(propertize ")%]--" 'help-echo help-echo) (propertize ")%]--" 'help-echo help-echo)
`(which-func-mode ("" which-func-format ,dashes)) `(which-func-mode ("" which-func-format ,dashes))
`(line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes)) `(line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes))
@ -244,14 +246,16 @@ is okay. See `mode-line-format'.")
(propertize " Abbrev" (propertize " Abbrev"
'help-echo (purecopy 'help-echo (purecopy
"mouse-2: turn off Abbrev mode") "mouse-2: turn off Abbrev mode")
'local-map (purecopy (make-mode-line-mouse2-map 'local-map (purecopy (make-mode-line-mouse-map
'mouse-2
#'mode-line-abbrev-mode)))) #'mode-line-abbrev-mode))))
'(overwrite-mode overwrite-mode) '(overwrite-mode overwrite-mode)
(list 'auto-fill-function (list 'auto-fill-function
(propertize " Fill" (propertize " Fill"
'help-echo (purecopy 'help-echo (purecopy
"mouse-2: turn off Autofill mode") "mouse-2: turn off Autofill mode")
'local-map (purecopy (make-mode-line-mouse2-map 'local-map (purecopy (make-mode-line-mouse-map
'mouse-2
#'mode-line-auto-fill-mode)))) #'mode-line-auto-fill-mode))))
;; not really a minor mode... ;; not really a minor mode...
'(defining-kbd-macro " Def"))) '(defining-kbd-macro " Def")))
@ -355,16 +359,13 @@ Return a string to display in the mode line for the current mode name."
(x-popup-menu event mode-line-mode-menu)) (x-popup-menu event mode-line-mode-menu))
;; Add menu of buffer operations to the buffer identification part ;; Add menu of buffer operations to the buffer identification part
;; of the mode line. ;; of the mode line.or header line.
;
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-1] 'mode-line-other-buffer) (define-key map [mode-line mouse-1] 'mode-line-unbury-buffer)
(define-key map [header-line mouse-1] 'mode-line-other-buffer) (define-key map [header-line mouse-1] 'mode-line-unbury-buffer)
(define-key map [mode-line M-mouse-2] 'mode-line-unbury-buffer) (define-key map [mode-line mouse-3] 'bury-buffer)
(define-key map [header-line M-mouse-2] 'mode-line-unbury-buffer) (define-key map [header-line mouse-3] 'bury-buffer)
(define-key map [mode-line mouse-2] 'bury-buffer)
(define-key map [header-line mouse-2] 'bury-buffer)
(define-key map [mode-line down-mouse-3] 'mouse-buffer-menu)
(define-key map [header-line down-mouse-3] 'mouse-buffer-menu)
(setq mode-line-buffer-identification-keymap map)) (setq mode-line-buffer-identification-keymap map))
(defun propertized-buffer-identification (fmt) (defun propertized-buffer-identification (fmt)
@ -373,8 +374,8 @@ FMT is a format specifier such as \"%12b\". This function adds
text properties for face, help-echo, and local-map to it." text properties for face, help-echo, and local-map to it."
(list (propertize fmt (list (propertize fmt
'face '(:weight bold) 'face '(:weight bold)
'help-echo (purecopy "mouse-1: other \ 'help-echo
buffer, mouse-2: prev, M-mouse-2: next, mouse-3: buffer menu") (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
'local-map mode-line-buffer-identification-keymap))) 'local-map mode-line-buffer-identification-keymap)))
(setq-default mode-line-buffer-identification (setq-default mode-line-buffer-identification