# HG changeset patch # User Gerd Moellmann # Date 973529022 0 # Node ID a3294ec7a0325d14d50455b75a00868859eaf2f6 # Parent 7ea177b4933aa8cdcfa9b7330e2733a882674bd8 (mode-line-toggle-read-only) (mode-line-toggle-modified, mode-line-widen) (mode-line-abbrev-mode, mode-line-auto-fill-mode): New functions. (make-mode-line-mouse2-map): Rewritten. (mode-line-modified, mode-line-format, minor-mode-alist): Use new functions so that C-h k can show something with a doc string. diff -r 7ea177b4933a -r a3294ec7a032 lisp/bindings.el --- a/lisp/bindings.el Mon Nov 06 15:53:05 2000 +0000 +++ b/lisp/bindings.el Mon Nov 06 16:43:42 2000 +0000 @@ -52,16 +52,55 @@ This is defined to run function F with no args in the buffer corresponding to the mode line clicked." (let ((map (make-sparse-keymap))) - (define-key map [mode-line mouse-2] - `(lambda (e) - (interactive "e") - (save-selected-window - (select-window - (posn-window (event-start e))) - (,f) - (force-mode-line-update)))) + (define-key map [mode-line mouse-2] f) map)) + +(defun mode-line-toggle-read-only (event) + "Like `toggle-read-only', for the mode-line." + (interactive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (toggle-read-only) + (force-mode-line-update))) + + +(defun mode-line-toggle-modified (event) + "Toggle the buffer-modified flag from the mode-line." + (interacive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (set-buffer-modified-p (not (buffer-modified-p))) + (force-mode-line-update))) + + +(defun mode-line-widen (event) + "Widen a buffer from the mode-line." + (interacive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (widen) + (force-mode-line-update))) + + +(defun mode-line-abbrev-mode (event) + "Turn off `abbrev-mode' from the mode-line." + (interacive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (abbrev-mode) + (force-mode-line-update))) + + +(defun mode-line-auto-fill-mode (event) + "Turn off `auto-fill-mode' from the mode-line." + (interacive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (auto-fill-mode) + (force-mode-line-update))) + + (defvar mode-line-input-method-map (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-2] @@ -143,7 +182,8 @@ (if buffer-read-only "R" "Not r"))))) - 'local-map (purecopy (make-mode-line-mouse2-map #'toggle-read-only))) + 'local-map (purecopy (make-mode-line-mouse2-map + #'mode-linetoggle-read-only))) (propertize "%1+" 'help-echo (purecopy (lambda (window object point) @@ -154,10 +194,7 @@ "M" "Not m"))))) 'local-map (purecopy (make-mode-line-mouse2-map - (lambda () - (interactive) - (set-buffer-modified-p - (not (buffer-modified-p)))))))) + #'mode-line-toggle-modified)))) "Mode-line control for displaying whether current buffer is modified.") (make-variable-buffer-local 'mode-line-modified) @@ -182,7 +219,7 @@ (propertize " %[(" 'help-echo help-echo) '(:eval (mode-line-mode-name)) 'mode-line-process 'minor-mode-alist (propertize "%n" 'help-echo "mouse-2: widen" - 'local-map (make-mode-line-mouse2-map #'widen)) + 'local-map (make-mode-line-mouse2-map #'mode-line-widen)) (propertize ")%]--" 'help-echo help-echo) `(which-func-mode ("" which-func-format ,dashes)) `(line-number-mode ("L%l" ,dashes)) @@ -205,14 +242,14 @@ 'help-echo (purecopy "mouse-2: turn off Abbrev mode") 'local-map (purecopy (make-mode-line-mouse2-map - #'abbrev-mode)))) + #'mode-line-abbrev-mode)))) '(overwrite-mode overwrite-mode) (list 'auto-fill-function (propertize " Fill" 'help-echo (purecopy "mouse-2: turn off Autofill mode") 'local-map (purecopy (make-mode-line-mouse2-map - #'auto-fill-mode)))) + #'mode-line-auto-fill-mode)))) ;; not really a minor mode... '(defining-kbd-macro " Def")))