1 ;;; modeline.el --- modeline hackery.
3 ;; Copyright (C) 1988, 1992-1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996 Ben Wing.
6 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: extensions, dumped
9 ;; This file is part of XEmacs.
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
26 ;;; Synched up with: Not in FSF.
30 ;; This file is dumped with XEmacs.
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35 ;;; General mouse modeline stuff ;;;
36 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 (defgroup modeline nil
39 "Modeline customizations."
42 (defcustom modeline-3d-p ;; added for the options menu
44 (specifier-instance modeline-shadow-thickness)))
45 (and (integerp thickness)
47 "Whether the default toolbar is globally visible. This option can be
48 customized through the options menu."
51 :set #'(lambda (var val)
53 (set-specifier modeline-shadow-thickness 2)
54 (set-specifier modeline-shadow-thickness 0))
56 (setq modeline-3d-p val))
59 (defcustom drag-divider-event-lag 150
60 "*The pause (in msecs) between divider drag events before redisplaying.
61 If this value is too small, dragging will be choppy because redisplay cannot
62 keep up. If it is too large, dragging will be choppy because of the explicit
63 redisplay delay specified."
68 (define-obsolete-variable-alias
69 'drag-modeline-event-lag
70 'drag-divider-event-lag)
72 (defcustom modeline-click-swaps-buffers nil
73 "*If non-nil, clicking on the modeline changes the current buffer.
74 Click on the left half of the modeline cycles forward through the
75 buffer list and clicking on the right half cycles backward."
79 (defcustom modeline-scrolling-method nil
80 "*If non-nil, dragging the modeline with the mouse may also scroll its
81 text horizontally (vertical motion controls window resizing and horizontal
82 motion controls modeline scrolling).
84 With a value of t, the modeline text is scrolled in the same direction as
85 the mouse motion. With a value of 'scrollbar, the modeline is considered as
86 a scrollbar for its own text, which then moves in the opposite direction."
87 :type '(choice (const :tag "none" nil)
89 (const :tag "scrollbar" scrollbar))
90 :set (lambda (sym val)
94 (set-glyph-image modeline-pointer-glyph "hand2" 'global 'x))
96 (set-glyph-image modeline-pointer-glyph "fleur" 'global 'x))
98 (set-glyph-image modeline-pointer-glyph "sb_v_double_arrow"
100 (when (featurep 'mswindows)
102 (set-glyph-image modeline-pointer-glyph
103 [mswindows-resource :resource-type cursor
104 :resource-id "SizeAll"]
107 (set-glyph-image modeline-pointer-glyph
108 [mswindows-resource :resource-type cursor
109 :resource-id "Normal"]
112 (set-glyph-image modeline-pointer-glyph
113 [mswindows-resource :resource-type cursor
114 :resource-id "SizeNS"]
115 'global 'mswindows)))))
118 (defun mouse-drag-modeline (event)
119 "Resize a window by dragging its modeline.
120 This command should be bound to a button-press event in modeline-map.
121 Holding down a mouse button and moving the mouse up and down will
122 make the clicked-on window taller or shorter.
124 See also the variable `modeline-scrolling-method'."
126 (or (button-press-event-p event)
127 (error "%s must be invoked by a mouse-press" this-command))
128 (or (event-over-modeline-p event)
129 (error "not over a modeline"))
130 ;; Give the modeline a "pressed" look. --hniksic
131 (let-specifier ((modeline-shadow-thickness
132 (- (specifier-instance modeline-shadow-thickness
133 (event-window event)))
134 (event-window event)))
136 (depress-line (event-y event))
137 (start-event-frame (event-frame event))
138 (start-event-window (event-window event))
139 (start-nwindows (count-windows t))
140 (hscroll-delta (face-width 'modeline))
141 (start-hscroll (modeline-hscroll (event-window event)))
142 (start-x-pixel (event-x-pixel event))
146 should-enlarge-minibuffer
147 event min-height minibuffer y top bot edges wconfig growth)
148 (setq minibuffer (minibuffer-window start-event-frame)
149 default-line-height (face-height 'default start-event-window)
150 min-height (+ (* window-min-height default-line-height)
151 ;; Don't let the window shrink by a
152 ;; non-multiple of the default line
153 ;; height. (enlarge-window -1) will do
154 ;; this if the difference between the
155 ;; current window height and the minimum
156 ;; window height is less than the height
157 ;; of the default font. These extra
158 ;; lost pixels of height don't come back
159 ;; if you grow the window again. This
160 ;; can make it impossible to drag back
161 ;; to the exact original size, which is
163 (% (window-pixel-height start-event-window)
164 default-line-height))
166 (if (specifier-instance has-modeline-p start-event-window)
167 (+ (face-height 'modeline start-event-window)
168 (* 2 (specifier-instance modeline-shadow-thickness
169 start-event-window)))
170 (* 2 (specifier-instance modeline-shadow-thickness
171 start-event-window))))
172 (if (not (eq (window-frame minibuffer) start-event-frame))
173 (setq minibuffer nil))
174 (if (and (null minibuffer) (one-window-p t))
175 (error "Attempt to resize sole window"))
176 ;; if this is the bottommost ordinary window, then to
177 ;; move its modeline the minibuffer must be enlarged.
178 (setq should-enlarge-minibuffer
179 (and minibuffer (window-lowest-p start-event-window)))
180 ;; loop reading events
182 (setq event (next-event event))
183 ;; requeue event and quit if this is a misc-user, eval or
185 ;; quit if this is a button press or release event, or if the event
186 ;; occurred in some other frame.
187 ;; drag if this is a mouse motion event and the time
188 ;; between this event and the last event is greater than
189 ;; drag-divider-event-lag.
190 ;; do nothing if this is any other kind of event.
191 (cond ((or (misc-user-event-p event)
192 (key-press-event-p event))
193 (setq unread-command-events (nconc unread-command-events
196 ((button-release-event-p event)
198 ;; Consider we have a mouse click neither X pos (modeline
199 ;; scroll) nore Y pos (modeline drag) have changed.
200 (and modeline-click-swaps-buffers
201 (= depress-line (event-y event))
202 (or (not modeline-scrolling-method)
204 (modeline-hscroll start-event-window)))
205 (modeline-swap-buffers event)))
206 ((button-event-p event)
208 ((not (motion-event-p event))
209 (dispatch-event event))
210 ((not (eq start-event-frame (event-frame event)))
212 ((< (abs (- (event-timestamp event) last-timestamp))
213 drag-divider-event-lag)
216 (when modeline-scrolling-method
217 (let ((delta (/ (- (event-x-pixel event) start-x-pixel)
219 (set-modeline-hscroll start-event-window
220 (if (eq modeline-scrolling-method t)
221 (- start-hscroll delta)
222 (+ start-hscroll delta)))
224 (setq last-timestamp (event-timestamp event)
225 y (event-y-pixel event)
226 edges (window-pixel-edges start-event-window)
229 ;; scale back a move that would make the
231 (cond ((< (- y top (- modeline-height)) min-height)
232 (setq y (+ top min-height (- modeline-height)))))
233 ;; compute size change needed
234 (setq growth (- y bot (/ (- modeline-height) 2))
235 wconfig (current-window-configuration))
236 ;; grow/shrink minibuffer?
237 (if should-enlarge-minibuffer
239 ;; yes. scale back shrinkage if it
240 ;; would make the minibuffer less than 1
243 ;; also flip the sign of the computed growth,
244 ;; since if we want to grow the window with the
245 ;; modeline we need to shrink the minibuffer
247 (if (and (> growth 0)
248 (< (- (window-pixel-height minibuffer)
250 default-line-height))
252 (- (window-pixel-height minibuffer)
253 default-line-height)))
254 (setq growth (- growth))))
255 ;; window grow and shrink by lines not pixels, so
256 ;; divide the pixel height by the height of the
258 (setq growth (/ growth default-line-height))
259 ;; grow/shrink the window
260 (enlarge-window growth nil (if should-enlarge-minibuffer
263 ;; if this window's growth caused another
264 ;; window to be deleted because it was too
265 ;; short, rescind the change.
267 ;; if size change caused space to be stolen
268 ;; from a window above this one, rescind the
269 ;; change, but only if we didn't grow/shrink
270 ;; the minibuffer. minibuffer size changes
271 ;; can cause all windows to shrink... no way
273 (if (or (/= start-nwindows (count-windows t))
274 (and (not should-enlarge-minibuffer)
275 (/= top (nth 1 (window-pixel-edges
276 start-event-window)))))
277 (set-window-configuration wconfig))))))))
279 ;; from Bob Weiner (bob_weiner@pts.mot.com)
280 ;; Whether this function should be called is now decided in
281 ;; mouse-drag-modeline - dverna feb. 98
282 (defun modeline-swap-buffers (event)
283 "Handle mouse clicks on modeline by switching buffers.
284 If click on left half of a frame's modeline, bury current buffer.
285 If click on right half of a frame's modeline, raise bottommost buffer.
286 Arg EVENT is the button release event that occurred on the modeline."
287 (or (event-over-modeline-p event)
288 (error "not over a modeline"))
289 (or (button-release-event-p event)
290 (error "not a button release event"))
291 (if (< (event-x event) (/ (window-width (event-window event)) 2))
292 ;; On left half of modeline, bury current buffer,
293 ;; displaying second buffer on list.
294 (mouse-bury-buffer event)
295 ;; On right half of modeline, raise and display bottommost
296 ;; buffer in buffer list.
297 (mouse-unbury-buffer event)))
299 (defconst modeline-menu
301 ["Delete Window Above" delete-window t]
302 ["Delete Other Windows" delete-other-windows t]
303 ["Split Window Above" split-window-vertically t]
304 ["Split Window Horizontally" split-window-horizontally t]
305 ["Balance Windows" balance-windows t]
308 (defun modeline-menu (event)
310 (popup-menu-and-execute-in-window
311 (cons (format "Window Commands for %S:"
312 (buffer-name (event-buffer event)))
316 (defvar modeline-map (make-sparse-keymap 'modeline-map)
317 "Keymap consulted for mouse-clicks on the modeline of a window.
318 This variable may be buffer-local; its value will be looked up in
319 the buffer of the window whose modeline was clicked upon.")
321 (define-key modeline-map 'button1 'mouse-drag-modeline)
322 ;; button2 selects the window without setting point
323 (define-key modeline-map 'button2 (lambda () (interactive "@")))
324 (define-key modeline-map 'button3 'modeline-menu)
326 (make-face 'modeline-mousable "Face for mousable portions of the modeline.")
327 (set-face-parent 'modeline-mousable 'modeline nil '(default))
328 (when (featurep 'window-system)
329 (set-face-foreground 'modeline-mousable "firebrick" nil '(default color win))
330 (set-face-font 'modeline-mousable [bold] nil '(default mono win))
331 (set-face-font 'modeline-mousable [bold] nil '(default grayscale win)))
333 (defmacro make-modeline-command-wrapper (command)
336 (save-selected-window
337 (select-window (event-window event))
338 (call-interactively ',(eval command)))))
340 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
342 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
344 (defvar minor-mode-alist nil
345 "Alist saying how to show minor modes in the modeline.
346 Each element looks like (VARIABLE STRING);
347 STRING is included in the modeline iff VARIABLE's value is non-nil.
349 Actually, STRING need not be a string; any possible modeline element
350 is okay. See `modeline-format'.")
352 ;; Used by C code (lookup-key and friends) but defined here.
353 (defvar minor-mode-map-alist nil
354 "Alist of keymaps to use for minor modes.
355 Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
356 key sequences and look up bindings iff VARIABLE's value is non-nil.
357 If two active keymaps bind the same key, the keymap appearing earlier
358 in the list takes precedence.")
360 (make-face 'modeline-mousable-minor-mode
361 "Face for mousable minor-mode strings in the modeline.")
362 (set-face-parent 'modeline-mousable-minor-mode 'modeline-mousable nil
364 (when (featurep 'window-system)
365 (set-face-foreground 'modeline-mousable-minor-mode '("green4" "forestgreen")
366 nil '(default color win)))
368 (defvar modeline-mousable-minor-mode-extent (make-extent nil nil)
369 ;; alliteration at its finest.
370 "Extent managing the mousable minor mode modeline strings.")
371 (set-extent-face modeline-mousable-minor-mode-extent
372 'modeline-mousable-minor-mode)
374 ;; This replaces the idiom
376 ;; (or (assq 'isearch-mode minor-mode-alist)
377 ;; (setq minor-mode-alist
379 ;; (append minor-mode-alist
380 ;; '((isearch-mode isearch-mode))))))
382 (defun add-minor-mode (toggle name &optional keymap after toggle-fun)
383 "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
385 TOGGLE is a symbol whose value as a variable specifies whether the
386 minor mode is active.
388 NAME is the name that should appear in the modeline. It should either
389 be a string beginning with a space, or a symbol with a similar string
392 KEYMAP is a keymap to make active when the minor mode is active.
394 AFTER is the toggling symbol used for another minor mode. If AFTER is
395 non-nil, then it is used to position the new mode in the minor-mode
398 TOGGLE-FUN specifies an interactive function that is called to toggle
399 the mode on and off; this affects what happens when button2 is pressed
400 on the mode, and when button3 is pressed somewhere in the list of
401 modes. If TOGGLE-FUN is nil and TOGGLE names an interactive function,
402 TOGGLE is used as the toggle function.
404 Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
405 (let* ((add-elt #'(lambda (elt sym)
407 (cond ((null after) ; add to front
408 (push elt (symbol-value sym)))
409 ((and (not (eq after t))
410 (setq place (memq (assq after
412 (symbol-value sym))))
413 (push elt (cdr place)))
415 (set sym (append (symbol-value sym)
420 (check-argument-type 'commandp toggle-fun)
421 (when (commandp toggle)
422 (setq toggle-fun toggle)))
423 (when (and toggle-fun name)
424 (setq toggle-keymap (make-sparse-keymap
425 (intern (concat "modeline-minor-"
428 (define-key toggle-keymap 'button2
429 ;; defeat the DUMB-ASS byte-compiler, which tries to
430 ;; expand the macro at compile time and fucks up.
431 (eval '(make-modeline-command-wrapper toggle-fun)))
432 (put toggle 'modeline-toggle-function toggle-fun))
436 (cons (let ((extent (make-extent nil nil)))
437 (set-extent-keymap extent toggle-keymap)
440 (concat "button2 turns off "
441 (if (symbolp toggle-fun)
442 (symbol-name toggle-fun)
443 (symbol-name toggle))))
445 (cons modeline-mousable-minor-mode-extent name))
447 (if (setq el (assq toggle minor-mode-alist))
448 (setcdr el (list hacked-name))
450 (list toggle hacked-name)
451 'minor-mode-alist))))
453 (if (setq el (assq toggle minor-mode-map-alist))
457 'minor-mode-map-alist)))))
459 ;; #### TODO: Add `:menu-tag' keyword to add-minor-mode. Or create a
460 ;; separate function to manage the minor mode menu.
462 ;(put 'abbrev-mode :menu-tag "Abbreviation Expansion")
463 (add-minor-mode 'abbrev-mode " Abbrev")
464 ;; only when visiting a file...
465 (add-minor-mode 'overwrite-mode 'overwrite-mode)
466 ;(put 'auto-fill-function :menu-tag "Auto Fill")
467 (add-minor-mode 'auto-fill-function " Fill" nil nil 'auto-fill-mode)
469 ;(put 'defining-kbd-macro :menu-tag "Keyboard Macro")
470 (add-minor-mode 'defining-kbd-macro " Def" nil nil
473 (if defining-kbd-macro
475 ;; #### This means to disregard the last event.
476 ;; It is needed because the last recorded
477 ;; event is usually the mouse event that
478 ;; invoked the menu item (and this function),
479 ;; and having it in the macro causes problems.
480 (zap-last-kbd-macro-event)
482 (start-kbd-macro nil))))
484 (defun modeline-minor-mode-menu (event)
485 "The menu that pops up when you press `button3' inside the
486 parentheses on the modeline."
489 (set-buffer (event-buffer event))
490 (popup-menu-and-execute-in-window
496 (let* ((toggle-sym (car x))
497 (toggle-fun (or (get toggle-sym
498 'modeline-toggle-function)
499 (and (commandp toggle-sym)
501 (menu-tag (symbol-name (if (symbolp toggle-fun)
504 ;; Here a function should
505 ;; maybe be invoked to
506 ;; beautify the symbol's
512 ;; The following two are wrong
513 ;; because of possible name
515 ;:active (get toggle-sym :active t)
516 ;:included (get toggle-sym :included t)
518 :selected (and (boundp toggle-sym)
522 (string< (aref e1 0) (aref e2 0)))))
525 (defvar modeline-minor-mode-map (make-sparse-keymap 'modeline-minor-mode-map)
526 "Keymap consulted for mouse-clicks on the minor-mode modeline list.")
527 (define-key modeline-minor-mode-map 'button3 'modeline-minor-mode-menu)
529 (defvar modeline-minor-mode-extent (make-extent nil nil)
530 "Extent covering the minor mode modeline strings.")
531 (set-extent-face modeline-minor-mode-extent 'modeline-mousable)
532 (set-extent-keymap modeline-minor-mode-extent modeline-minor-mode-map)
535 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
537 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
539 (defun modeline-buffers-menu (event)
541 (popup-menu-and-execute-in-window
542 '("Buffers Popup Menu"
543 :filter buffers-menu-filter
544 ["List All Buffers" list-buffers t]
549 (defvar modeline-buffer-id-left-map
550 (make-sparse-keymap 'modeline-buffer-id-left-map)
551 "Keymap consulted for mouse-clicks on the left half of the buffer-id string.")
553 (defvar modeline-buffer-id-right-map
554 (make-sparse-keymap 'modeline-buffer-id-right-map)
555 "Keymap consulted for mouse-clicks on the right half of the buffer-id string.")
557 (define-key modeline-buffer-id-left-map 'button2 'mouse-unbury-buffer)
558 (define-key modeline-buffer-id-right-map 'button2 'mouse-bury-buffer)
559 (define-key modeline-buffer-id-left-map 'button3 'modeline-buffers-menu)
560 (define-key modeline-buffer-id-right-map 'button3 'modeline-buffers-menu)
562 (make-face 'modeline-buffer-id
563 "Face for the buffer ID string in the modeline.")
564 (set-face-parent 'modeline-buffer-id 'modeline nil '(default))
565 (when (featurep 'window-system)
566 (set-face-foreground 'modeline-buffer-id "blue4" nil '(default color win))
567 (set-face-font 'modeline-buffer-id [bold-italic] nil '(default mono win))
568 (set-face-font 'modeline-buffer-id [bold-italic] nil '(default grayscale win)))
569 (when (featurep 'tty)
570 (set-face-font 'modeline-buffer-id [bold-italic] nil '(default tty)))
572 (defvar modeline-buffer-id-extent (make-extent nil nil)
573 "Extent covering the whole of the buffer-id string.")
574 (set-extent-face modeline-buffer-id-extent 'modeline-buffer-id)
576 (defvar modeline-buffer-id-left-extent (make-extent nil nil)
577 "Extent covering the left half of the buffer-id string.")
578 (set-extent-keymap modeline-buffer-id-left-extent
579 modeline-buffer-id-left-map)
580 (set-extent-property modeline-buffer-id-left-extent 'help-echo
581 "button2 cycles to the previous buffer")
583 (defvar modeline-buffer-id-right-extent (make-extent nil nil)
584 "Extent covering the right half of the buffer-id string.")
585 (set-extent-keymap modeline-buffer-id-right-extent
586 modeline-buffer-id-right-map)
587 (set-extent-property modeline-buffer-id-right-extent 'help-echo
588 "button2 cycles to the next buffer")
590 (defconst modeline-buffer-identification
591 (list (cons modeline-buffer-id-left-extent "XEmacs%N:")
592 ; this used to be "XEmacs:"
593 (cons modeline-buffer-id-right-extent " %17b"))
594 "Modeline control for identifying the buffer being displayed.
597 (list (cons modeline-buffer-id-left-extent \"XEmacs%N:\")
598 (cons modeline-buffer-id-right-extent \" %17b\")))
600 Major modes that edit things other than ordinary files may change this
601 (e.g. Info, Dired,...).")
602 (make-variable-buffer-local 'modeline-buffer-identification)
604 ;; These are for the sake of minor mode menu. #### All of this is
605 ;; kind of dirty. `add-minor-mode' started out as a simple substitute
606 ;; for (or (assq ...) ...) FSF stuff, but now is used for all kind of
607 ;; stuff. There should perhaps be a separate function to add toggles
608 ;; to the minor-mode-menu.
609 (add-minor-mode 'line-number-mode "")
610 (add-minor-mode 'column-number-mode "")
612 (defconst modeline-process nil
613 "Modeline control for displaying info on process status.
614 Normally nil in most modes, since there is no process to display.")
615 (make-variable-buffer-local 'modeline-process)
617 (defvar modeline-modified-map (make-sparse-keymap 'modeline-modified-map)
618 "Keymap consulted for mouse-clicks on the modeline-modified string.")
619 (define-key modeline-modified-map 'button2
620 (make-modeline-command-wrapper 'modeline-toggle-read-only))
622 (defvar modeline-modified-extent (make-extent nil nil)
623 "Extent covering the modeline-modified string.")
624 (set-extent-face modeline-modified-extent 'modeline-mousable)
625 (set-extent-keymap modeline-modified-extent modeline-modified-map)
626 (set-extent-property modeline-modified-extent 'help-echo
627 "button2 toggles the buffer's read-only status")
629 (defconst modeline-modified '("--%1*%1+-")
630 "Modeline control for displaying whether current buffer is modified.")
631 (make-variable-buffer-local 'modeline-modified)
633 (defvar modeline-narrowed-map (make-sparse-keymap 'modeline-narrowed-map)
634 "Keymap consulted for mouse-clicks on the modeline-narrowed string.")
635 (define-key modeline-narrowed-map 'button2
636 (make-modeline-command-wrapper 'widen))
638 (defvar modeline-narrowed-extent (make-extent nil nil)
639 "Extent covering the modeline-narrowed string.")
640 (set-extent-face modeline-narrowed-extent 'modeline-mousable)
641 (set-extent-keymap modeline-narrowed-extent modeline-narrowed-map)
642 (set-extent-property modeline-narrowed-extent 'help-echo
643 "button2 widens the buffer")
649 (cons modeline-modified-extent 'modeline-modified)
650 (cons modeline-buffer-id-extent 'modeline-buffer-identification)
654 (cons modeline-minor-mode-extent
655 (list "" 'mode-name 'minor-mode-alist))
656 (cons modeline-narrowed-extent "%n")
659 (list 'line-number-mode "L%l--")
660 (list 'column-number-mode "C%c--")
664 ;;; Added for XEmacs 20.3. Provide wrapper for vc since it may not always be
665 ;;; present, and its symbols are not visible this early in the dump if it
668 (defun modeline-toggle-read-only ()
669 "Change whether this buffer is visiting its file read-only.
670 With arg, set read-only iff arg is positive.
671 This function is designed to be called when the read-only indicator on the
672 modeline is clicked. It will call `vc-toggle-read-only' if available,
673 otherwise it will call the usual `toggle-read-only'."
675 (if (fboundp 'vc-toggle-read-only)
676 (vc-toggle-read-only)
679 ;;; modeline.el ends here