0
|
1 ;;; modeline.el --- modeline hackery.
|
|
2
|
|
3 ;; Copyright (C) 1988, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
5
|
|
6 ;; This file is part of XEmacs.
|
|
7
|
|
8 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
9 ;; under the terms of the GNU General Public License as published by
|
|
10 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
11 ;; any later version.
|
|
12
|
|
13 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16 ;; General Public License for more details.
|
|
17
|
|
18 ;; You should have received a copy of the GNU General Public License
|
16
|
19 ;; along with XEmacs; see the file COPYING. If not, write to the
|
70
|
20 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
16
|
21 ;; Boston, MA 02111-1307, USA.
|
0
|
22
|
|
23 ;;; Synched up with: Not in FSF.
|
|
24
|
|
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
26 ;;; General mouse modeline stuff ;;;
|
|
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
28
|
120
|
29 (defgroup modeline nil
|
|
30 "Modeline customizations"
|
|
31 :group 'environment)
|
0
|
32
|
120
|
33 (defcustom drag-modeline-event-lag 150
|
|
34 "*The pause (in msecs) between drag modeline events before redisplaying.
|
|
35 If this value is too small, dragging will be choppy because redisplay cannot
|
|
36 keep up. If it is too large, dragging will be choppy because of the explicit
|
|
37 redisplay delay specified."
|
|
38 :type 'integer
|
|
39 :group 'modeline)
|
|
40
|
|
41 (defcustom modeline-click-swaps-buffers nil
|
0
|
42 "*If non-nil, clicking on the modeline changes the current buffer.
|
|
43 Click on the left half of the modeline cycles forward through the
|
120
|
44 buffer list and clicking on the right half cycles backward."
|
|
45 :type 'boolean
|
|
46 :group 'modeline)
|
0
|
47
|
|
48 (defun mouse-drag-modeline (event)
|
149
|
49 "Resize a window by dragging its modeline.
|
|
50 This command should be bound to a button-press event in modeline-map.
|
|
51 Holding down a mouse button and moving the mouse up and down will
|
|
52 make the clicked-on window taller or shorter."
|
0
|
53 (interactive "e")
|
|
54 (or (button-press-event-p event)
|
|
55 (error "%s must be invoked by a mouse-press" this-command))
|
|
56 (or (event-over-modeline-p event)
|
|
57 (error "not over a modeline"))
|
149
|
58 (let ((done nil)
|
|
59 (depress-line (event-y event))
|
|
60 (start-event-frame (event-frame event))
|
|
61 (start-event-window (event-window event))
|
|
62 (start-nwindows (count-windows t))
|
|
63 (last-timestamp 0)
|
|
64 default-line-height
|
|
65 modeline-height
|
|
66 should-enlarge-minibuffer
|
|
67 event min-height minibuffer y top bot edges wconfig growth)
|
|
68 (setq minibuffer (minibuffer-window start-event-frame)
|
|
69 default-line-height (face-height 'default start-event-window)
|
|
70 min-height (* window-min-height default-line-height)
|
|
71 modeline-height
|
|
72 (if (specifier-instance has-modeline-p start-event-window)
|
|
73 (+ (face-height 'modeline start-event-window)
|
|
74 (* 2 (specifier-instance modeline-shadow-thickness
|
|
75 start-event-window)))
|
|
76 (* 2 (specifier-instance modeline-shadow-thickness
|
|
77 start-event-window))))
|
|
78 (if (not (eq (window-frame minibuffer) start-event-frame))
|
|
79 (setq minibuffer nil))
|
|
80 (if (and (null minibuffer) (one-window-p t))
|
|
81 (error "Attempt to resize sole window"))
|
|
82 ;; if this is the bottommost ordinary window, then to
|
|
83 ;; move its modeline the minibuffer must be enlarged.
|
|
84 (setq should-enlarge-minibuffer
|
|
85 (and minibuffer (window-lowest-p start-event-window)))
|
|
86 ;; loop reading events
|
|
87 (while (not done)
|
0
|
88 (setq event (next-event event))
|
149
|
89 ;; requeue event and quit if this is a misc-user, eval or
|
|
90 ;; keypress event.
|
|
91 ;; quit if this is a button press or release event, or if the event
|
|
92 ;; occurred in some other frame.
|
|
93 ;; drag if this is a mouse motion event and the time
|
|
94 ;; between this event and the last event is greater than
|
|
95 ;; drag-modeline-event-lag.
|
|
96 ;; do nothing if this is any other kind of event.
|
|
97 (cond ((or (misc-user-event-p event)
|
|
98 (key-press-event-p event)
|
|
99 (eval-event-p event))
|
|
100 (setq unread-command-events (nconc unread-command-events
|
|
101 (list event))
|
|
102 done t))
|
0
|
103 ((button-release-event-p event)
|
149
|
104 (setq done t)
|
0
|
105 (if modeline-click-swaps-buffers
|
|
106 (mouse-release-modeline event depress-line)))
|
149
|
107 ((button-event-p event)
|
|
108 (setq done t))
|
|
109 ((timeout-event-p event)
|
|
110 nil)
|
|
111 ((not (motion-event-p event))
|
|
112 (dispatch-event event))
|
|
113 ((not (eq start-event-frame (event-frame event)))
|
|
114 (setq done t))
|
|
115 ((< (abs (- (event-timestamp event) last-timestamp))
|
|
116 drag-modeline-event-lag)
|
|
117 nil)
|
0
|
118 (t
|
149
|
119 (setq last-timestamp (event-timestamp event)
|
|
120 y (event-y-pixel event)
|
|
121 edges (window-pixel-edges start-event-window)
|
|
122 top (nth 1 edges)
|
|
123 bot (nth 3 edges))
|
|
124 ;; scale back a move that would make the
|
|
125 ;; window too short.
|
|
126 (cond ((< (- y top (- modeline-height)) min-height)
|
|
127 (setq y (+ top min-height (- modeline-height)))))
|
|
128 ;; compute size change needed
|
|
129 (setq growth (- y bot (/ (- modeline-height) 2))
|
|
130 wconfig (current-window-configuration))
|
|
131 ;; grow/shrink minibuffer?
|
|
132 (if should-enlarge-minibuffer
|
|
133 (progn
|
|
134 ;; yes. scale back shrinkage if it
|
|
135 ;; would make the minibuffer less than 1
|
|
136 ;; line tall.
|
|
137 ;;
|
|
138 ;; also flip the sign of the computed growth,
|
|
139 ;; since if we want to grow the window with the
|
|
140 ;; modeline we need to shrink the minibuffer
|
|
141 ;; and vice versa.
|
|
142 (if (and (> growth 0)
|
|
143 (< (- (window-pixel-height minibuffer)
|
|
144 growth)
|
|
145 default-line-height))
|
|
146 (setq growth
|
|
147 (- (window-pixel-height minibuffer)
|
|
148 default-line-height)))
|
|
149 (setq growth (- growth))))
|
|
150 ;; window grow and shrink by lines not pixels, so
|
|
151 ;; divide the pixel height by the height of the
|
|
152 ;; default face.
|
|
153 (setq growth (/ growth default-line-height))
|
|
154 ;; grow/shrink the window
|
|
155 (enlarge-window growth nil (if should-enlarge-minibuffer
|
|
156 minibuffer
|
|
157 start-event-window))
|
|
158 ;; if this window's growth caused another
|
|
159 ;; window to be deleted because it was too
|
|
160 ;; short, rescind the change.
|
|
161 ;;
|
|
162 ;; if size change caused space to be stolen
|
|
163 ;; from a window above this one, rescind the
|
|
164 ;; change, but only if we didn't grow/shrink
|
|
165 ;; the minibuffer. minibuffer size changes
|
|
166 ;; can cause all windows to shrink... no way
|
|
167 ;; around it.
|
|
168 (if (or (/= start-nwindows (count-windows t))
|
|
169 (and (not should-enlarge-minibuffer)
|
|
170 (/= top (nth 1 (window-pixel-edges
|
|
171 start-event-window)))))
|
|
172 (set-window-configuration wconfig)))))))
|
0
|
173
|
|
174 ;; from Bob Weiner (bob_weiner@pts.mot.com)
|
|
175 (defun mouse-release-modeline (event line-num)
|
|
176 "Handle modeline click EVENT on LINE-NUM by switching buffers.
|
|
177 If click on left half of a frame's modeline, bury current buffer.
|
|
178 If click on right half of a frame's modeline, raise bottommost buffer.
|
|
179 Args are: EVENT, the mouse release event, and LINE-NUM, the line number
|
|
180 within the frame at which the mouse was first depressed."
|
|
181 (if (= line-num (event-y event))
|
|
182 ;; Button press and release are at same line, treat this as
|
|
183 ;; a click and switch buffers.
|
|
184 (if (< (event-x event) (/ (window-width (event-window event)) 2))
|
|
185 ;; On left half of modeline, bury current buffer,
|
|
186 ;; displaying second buffer on list.
|
|
187 (mouse-bury-buffer event)
|
|
188 ;; On right half of modeline, raise and display bottommost
|
|
189 ;; buffer in buffer list.
|
|
190 (mouse-unbury-buffer event))))
|
|
191
|
|
192 (defconst modeline-menu
|
|
193 '("Window Commands"
|
|
194 ["Delete Window Above" delete-window t]
|
|
195 ["Delete Other Windows" delete-other-windows t]
|
|
196 ["Split Window Above" split-window-vertically t]
|
|
197 ["Split Window Horizontally" split-window-horizontally t]
|
|
198 ["Balance Windows" balance-windows t]
|
|
199 ))
|
|
200
|
|
201 (defun modeline-menu (event)
|
|
202 (interactive "e")
|
|
203 (popup-menu-and-execute-in-window
|
|
204 (cons (format "Window Commands for %S:"
|
|
205 (buffer-name (event-buffer event)))
|
|
206 (cdr modeline-menu))
|
|
207 event))
|
|
208
|
|
209 (defvar modeline-map (make-sparse-keymap 'modeline-map)
|
|
210 "Keymap consulted for mouse-clicks on the modeline of a window.
|
|
211 This variable may be buffer-local; its value will be looked up in
|
|
212 the buffer of the window whose modeline was clicked upon.")
|
|
213
|
|
214 (define-key modeline-map 'button1 'mouse-drag-modeline)
|
|
215 ;; button2 selects the window without setting point
|
|
216 (define-key modeline-map 'button2 (lambda () (interactive "@")))
|
|
217 (define-key modeline-map 'button3 'modeline-menu)
|
|
218
|
|
219 (make-face 'modeline-mousable "Face for mousable portions of the modeline.")
|
|
220
|
|
221 (defmacro make-modeline-command-wrapper (command)
|
|
222 `#'(lambda (event)
|
|
223 (interactive "e")
|
|
224 (save-selected-window
|
|
225 (select-window (event-window event))
|
|
226 (call-interactively ',(eval command)))))
|
|
227
|
|
228 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
229 ;;; Minor modes ;;;
|
|
230 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
231
|
|
232 (defvar minor-mode-alist nil
|
|
233 "Alist saying how to show minor modes in the modeline.
|
|
234 Each element looks like (VARIABLE STRING);
|
|
235 STRING is included in the modeline iff VARIABLE's value is non-nil.
|
|
236
|
|
237 Actually, STRING need not be a string; any possible modeline element
|
|
238 is okay. See `modeline-format'.")
|
|
239
|
|
240 ;; Used by C code (lookup-key and friends) but defined here.
|
|
241 (defvar minor-mode-map-alist nil
|
|
242 "Alist of keymaps to use for minor modes.
|
|
243 Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
|
|
244 key sequences and look up bindings iff VARIABLE's value is non-nil.
|
|
245 If two active keymaps bind the same key, the keymap appearing earlier
|
|
246 in the list takes precedence.")
|
|
247
|
|
248 (make-face 'modeline-mousable-minor-mode
|
|
249 "Face for mousable minor-mode strings in the modeline.")
|
|
250
|
|
251 (defvar modeline-mousable-minor-mode-extent (make-extent nil nil)
|
|
252 ;; alliteration at its finest.
|
|
253 "Extent managing the mousable minor mode modeline strings.")
|
|
254 (set-extent-face modeline-mousable-minor-mode-extent
|
|
255 'modeline-mousable-minor-mode)
|
|
256
|
|
257 ;; This replaces the idiom
|
|
258 ;;
|
|
259 ;; (or (assq 'isearch-mode minor-mode-alist)
|
|
260 ;; (setq minor-mode-alist
|
|
261 ;; (purecopy
|
|
262 ;; (append minor-mode-alist
|
|
263 ;; '((isearch-mode isearch-mode))))))
|
|
264
|
|
265 (defun add-minor-mode (toggle name &optional keymap after toggle-fun)
|
|
266 "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
|
|
267 TOGGLE is a symbol whose value as a variable specifies whether the
|
|
268 minor mode is active. NAME is the name that should appear in the
|
|
269 modeline (it should be a string beginning with a space). KEYMAP is a
|
|
270 keymap to make active when the minor mode is active. AFTER is the
|
|
271 toggling symbol used for another minor mode. If AFTER is non-nil,
|
|
272 then it is used to position the new mode in the minor-mode alists.
|
|
273 TOGGLE-FUN specifies an interactive function that is called to toggle
|
|
274 the mode on and off; this affects what happens when button2 is pressed
|
|
275 on the mode, and when button3 is pressed somewhere in the list of
|
|
276 modes. If TOGGLE-FUN is nil and TOGGLE names an interactive function,
|
|
277 TOGGLE is used as the toggle function.
|
|
278
|
|
279 Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
|
|
280 (let (el place
|
|
281 (add-elt #'(lambda (elt sym)
|
|
282 (cond ((null after) ; add to front
|
|
283 (set sym (cons elt (symbol-value sym))))
|
|
284 ((and (not (eq after t))
|
|
285 (setq place (memq (assq after
|
|
286 (symbol-value sym))
|
|
287 (symbol-value sym))))
|
|
288 (setq elt (cons elt (cdr place)))
|
|
289 (setcdr place elt))
|
|
290 (t
|
|
291 (set sym (append (symbol-value sym) (list elt))))
|
|
292 )
|
|
293 (symbol-value sym)))
|
|
294 toggle-keymap)
|
|
295 (if toggle-fun
|
|
296 (if (not (commandp toggle-fun))
|
|
297 (error "not an interactive function: %S" toggle-fun))
|
|
298 (if (commandp toggle)
|
|
299 (setq toggle-fun toggle)))
|
|
300 (if (and toggle-fun name)
|
|
301 (progn
|
|
302 (setq toggle-keymap (make-sparse-keymap
|
|
303 (intern (concat "modeline-minor-"
|
|
304 (symbol-name toggle)
|
|
305 "-map"))))
|
|
306 (define-key toggle-keymap 'button2
|
|
307 ;; defeat the DUMB-ASS byte-compiler, which tries to
|
|
308 ;; expand the macro at compile time and fucks up.
|
|
309 (eval '(make-modeline-command-wrapper toggle-fun)))
|
|
310 (put toggle 'modeline-toggle-function toggle-fun)))
|
|
311 (and name
|
|
312 (let ((hacked-name
|
|
313 (if toggle-keymap
|
|
314 (cons (let ((extent (make-extent nil nil)))
|
|
315 (set-extent-keymap extent toggle-keymap)
|
|
316 (set-extent-property
|
|
317 extent 'help-echo
|
|
318 (concat "button2 turns off "
|
|
319 (if (symbolp toggle-fun)
|
|
320 (symbol-name toggle-fun)
|
|
321 (symbol-name toggle))))
|
|
322 extent)
|
|
323 (cons
|
|
324 modeline-mousable-minor-mode-extent
|
|
325 name))
|
|
326 name)))
|
|
327 (if (setq el (assq toggle minor-mode-alist))
|
|
328 (setcdr el (list hacked-name))
|
|
329 (funcall add-elt
|
|
330 (list toggle hacked-name)
|
|
331 'minor-mode-alist))))
|
|
332 (and keymap
|
|
333 (if (setq el (assq toggle minor-mode-map-alist))
|
|
334 (setcdr el keymap)
|
|
335 (funcall add-elt
|
|
336 (cons toggle keymap)
|
|
337 'minor-mode-map-alist)))
|
|
338 ))
|
|
339
|
|
340 (add-minor-mode 'abbrev-mode " Abbrev")
|
|
341 (add-minor-mode 'overwrite-mode 'overwrite-mode)
|
|
342 (add-minor-mode 'auto-fill-function " Fill" nil nil 'auto-fill-mode)
|
|
343 ;; not really a minor mode...
|
|
344 (add-minor-mode 'defining-kbd-macro " Def")
|
|
345
|
|
346 (defun modeline-minor-mode-menu (event)
|
|
347 (interactive "e")
|
110
|
348 (save-excursion
|
|
349 (set-buffer (event-buffer event))
|
|
350 (popup-menu-and-execute-in-window
|
|
351 (cons (format "Minor Mode Commands for %S:"
|
|
352 (buffer-name (event-buffer event)))
|
|
353 (apply 'nconc
|
|
354 (mapcar
|
|
355 #'(lambda (x)
|
|
356 (let* ((toggle-sym (car x))
|
|
357 (toggle-fun
|
|
358 (or (get toggle-sym
|
|
359 'modeline-toggle-function)
|
|
360 (and (fboundp toggle-sym)
|
|
361 (commandp toggle-sym)
|
|
362 toggle-sym))))
|
|
363 (if (not toggle-fun) nil
|
|
364 (list (vector
|
|
365 (concat (if (and (boundp toggle-sym)
|
|
366 (symbol-value toggle-sym))
|
|
367 "turn off " "turn on ")
|
|
368 (if (symbolp toggle-fun)
|
|
369 (symbol-name toggle-fun)
|
|
370 (symbol-name toggle-sym)))
|
|
371
|
|
372 toggle-fun
|
|
373 t)))))
|
|
374 minor-mode-alist)))
|
|
375 event)))
|
0
|
376
|
|
377 (defvar modeline-minor-mode-map (make-sparse-keymap 'modeline-minor-mode-map)
|
|
378 "Keymap consulted for mouse-clicks on the minor-mode modeline list.")
|
|
379 (define-key modeline-minor-mode-map 'button3 'modeline-minor-mode-menu)
|
|
380
|
|
381 (defvar modeline-minor-mode-extent (make-extent nil nil)
|
|
382 "Extent covering the minor mode modeline strings.")
|
|
383 (set-extent-face modeline-minor-mode-extent 'modeline-mousable)
|
|
384 (set-extent-keymap modeline-minor-mode-extent modeline-minor-mode-map)
|
|
385
|
|
386
|
|
387 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
388 ;;; Other ;;;
|
|
389 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
390
|
|
391 (defun modeline-buffers-menu (event)
|
|
392 (interactive "e")
|
|
393 (popup-menu-and-execute-in-window
|
|
394 '("Buffers Popup Menu"
|
|
395 :filter buffers-menu-filter
|
|
396 ["List All Buffers" list-buffers t]
|
|
397 "--"
|
|
398 )
|
|
399 event))
|
|
400
|
|
401 (defvar modeline-buffer-id-left-map
|
|
402 (make-sparse-keymap 'modeline-buffer-id-left-map)
|
|
403 "Keymap consulted for mouse-clicks on the left half of the buffer-id string.")
|
|
404
|
|
405 (defvar modeline-buffer-id-right-map
|
|
406 (make-sparse-keymap 'modeline-buffer-id-right-map)
|
|
407 "Keymap consulted for mouse-clicks on the right half of the buffer-id string.")
|
|
408
|
|
409 (define-key modeline-buffer-id-left-map 'button2 'mouse-unbury-buffer)
|
|
410 (define-key modeline-buffer-id-right-map 'button2 'mouse-bury-buffer)
|
|
411 (define-key modeline-buffer-id-left-map 'button3 'modeline-buffers-menu)
|
|
412 (define-key modeline-buffer-id-right-map 'button3 'modeline-buffers-menu)
|
|
413
|
|
414 (make-face 'modeline-buffer-id
|
|
415 "Face for the buffer ID string in the modeline.")
|
|
416
|
|
417 (defvar modeline-buffer-id-extent (make-extent nil nil)
|
|
418 "Extent covering the whole of the buffer-id string.")
|
|
419 (set-extent-face modeline-buffer-id-extent 'modeline-buffer-id)
|
|
420
|
|
421 (defvar modeline-buffer-id-left-extent (make-extent nil nil)
|
|
422 "Extent covering the left half of the buffer-id string.")
|
|
423 (set-extent-keymap modeline-buffer-id-left-extent
|
|
424 modeline-buffer-id-left-map)
|
|
425 (set-extent-property modeline-buffer-id-left-extent 'help-echo
|
|
426 "button2 cycles to the previous buffer")
|
|
427
|
|
428 (defvar modeline-buffer-id-right-extent (make-extent nil nil)
|
|
429 "Extent covering the right half of the buffer-id string.")
|
|
430 (set-extent-keymap modeline-buffer-id-right-extent
|
|
431 modeline-buffer-id-right-map)
|
|
432 (set-extent-property modeline-buffer-id-right-extent 'help-echo
|
|
433 "button2 cycles to the next buffer")
|
|
434
|
|
435 (defconst modeline-buffer-identification
|
149
|
436 (list (cons modeline-buffer-id-left-extent (purecopy "XEmacs%N:"))
|
|
437 ; this used to be "XEmacs:"
|
0
|
438 (cons modeline-buffer-id-right-extent (purecopy " %17b")))
|
|
439 "Modeline control for identifying the buffer being displayed.
|
|
440 Its default value is \"XEmacs: %17b\" (NOT!). Major modes that edit things
|
|
441 other than ordinary files may change this (e.g. Info, Dired,...)")
|
|
442 (make-variable-buffer-local 'modeline-buffer-identification)
|
|
443
|
|
444 (defconst modeline-process nil
|
|
445 "Modeline control for displaying info on process status.
|
|
446 Normally nil in most modes, since there is no process to display.")
|
|
447 (make-variable-buffer-local 'modeline-process)
|
|
448
|
|
449 (defvar modeline-modified-map (make-sparse-keymap 'modeline-modified-map)
|
|
450 "Keymap consulted for mouse-clicks on the modeline-modified string.")
|
|
451 (define-key modeline-modified-map 'button2
|
98
|
452 (make-modeline-command-wrapper 'vc-toggle-read-only))
|
0
|
453
|
|
454 (defvar modeline-modified-extent (make-extent nil nil)
|
|
455 "Extent covering the modeline-modified string.")
|
|
456 (set-extent-face modeline-modified-extent 'modeline-mousable)
|
|
457 (set-extent-keymap modeline-modified-extent modeline-modified-map)
|
|
458 (set-extent-property modeline-modified-extent 'help-echo
|
|
459 "button2 toggles the buffer's read-only status")
|
|
460
|
|
461 (defconst modeline-modified (purecopy '("--%1*%1+-"))
|
|
462 "Modeline control for displaying whether current buffer is modified.")
|
|
463 (make-variable-buffer-local 'modeline-modified)
|
|
464
|
|
465 (defvar modeline-narrowed-map (make-sparse-keymap 'modeline-narrowed-map)
|
|
466 "Keymap consulted for mouse-clicks on the modeline-narrowed string.")
|
|
467 (define-key modeline-narrowed-map 'button2
|
|
468 (make-modeline-command-wrapper 'widen))
|
|
469
|
|
470 (defvar modeline-narrowed-extent (make-extent nil nil)
|
|
471 "Extent covering the modeline-narrowed string.")
|
|
472 (set-extent-face modeline-narrowed-extent 'modeline-mousable)
|
|
473 (set-extent-keymap modeline-narrowed-extent modeline-narrowed-map)
|
|
474 (set-extent-property modeline-narrowed-extent 'help-echo
|
|
475 "button2 widens the buffer")
|
|
476
|
70
|
477 (setq-default
|
|
478 modeline-format
|
|
479 (list
|
|
480 (purecopy "")
|
|
481 (cons modeline-modified-extent 'modeline-modified)
|
|
482 (cons modeline-buffer-id-extent 'modeline-buffer-identification)
|
|
483 (purecopy " ")
|
|
484 'global-mode-string
|
|
485 (purecopy " %[(")
|
|
486 (cons modeline-minor-mode-extent (list "" 'mode-name 'minor-mode-alist))
|
|
487 (cons modeline-narrowed-extent "%n")
|
|
488 'modeline-process
|
|
489 (purecopy ")%]----")
|
|
490 (purecopy '(line-number-mode "L%l--"))
|
|
491 (purecopy '(column-number-mode "C%c--"))
|
|
492 (purecopy '(-3 . "%p"))
|
|
493 (purecopy "-%-")))
|