/[emacs]/emacs/lisp/bindings.el
ViewVC logotype

Diff of /emacs/lisp/bindings.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.100 by pj, Tue Apr 16 14:55:13 2002 UTC revision 1.100.2.1 by miles, Fri Apr 4 06:20:00 2003 UTC
# Line 28  Line 28 
28  ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29  ;;; Special formatting conventions are used in this file!  ;;; Special formatting conventions are used in this file!
30  ;;;  ;;;
31  ;;; a backslash-newline is used at the beginning of a documentation string  ;;; A backslash-newline is used at the beginning of a documentation string
32  ;;; when that string should be stored in the file etc/DOCnnn, not in core.  ;;; when that string should be stored in the file etc/DOCnnn, not in core.
33  ;;;  ;;;
34  ;;; Such strings read into Lisp as numbers (during the pure-loading phase).  ;;; Such strings read into Lisp as numbers (during the pure-loading phase).
# Line 135  corresponding to the mode line clicked." Line 135  corresponding to the mode line clicked."
135    "Local keymap for the coding-system part of the mode line.")    "Local keymap for the coding-system part of the mode line.")
136    
137    
138    (defun mode-line-change-eol ()
139      "Cycle through the various possible kinds of end-of-line styles."
140      (interactive)
141      (let ((eol (coding-system-eol-type buffer-file-coding-system)))
142        (set-buffer-file-coding-system
143         (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix)))))
144    
145    (defvar mode-line-eol-desc-cache nil)
146    
147    (defun mode-line-eol-desc ()
148      (let* ((eol (coding-system-eol-type buffer-file-coding-system))
149             (mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system))
150             (desc (assq eol mode-line-eol-desc-cache)))
151        (if (and desc (eq (cadr desc) mnemonic))
152            (cddr desc)
153          (if desc (setq mode-line-eol-desc-cache nil)) ;Flush the cache if stale.
154          (setq desc
155                (propertize
156                 mnemonic
157                 'help-echo (format "%s end-of-line; mouse-3 to cycle"
158                                    (if (eq eol 0) "Unix-style LF"
159                                      (if (eq eol 1) "Dos-style CRLF"
160                                        (if (eq eol 2) "Mac-style CR"
161                                          "Undecided"))))
162                 'keymap
163                 (eval-when-compile
164                   (let ((map (make-sparse-keymap)))
165                     (define-key map [mode-line mouse-3] 'mode-line-change-eol)
166                     map))))
167          (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
168          desc)))
169    
170  (defvar mode-line-mule-info  (defvar mode-line-mule-info
171    `(""    `(""
172      (current-input-method      (current-input-method
# Line 145  corresponding to the mode line clicked." Line 177  corresponding to the mode line clicked."
177                               ".  mouse-2: disable, mouse-3: describe")                               ".  mouse-2: disable, mouse-3: describe")
178                    local-map ,mode-line-input-method-map))                    local-map ,mode-line-input-method-map))
179      ,(propertize      ,(propertize
180        "%Z"        "%z"
181        'help-echo        'help-echo
182        #'(lambda (window object point)        #'(lambda (window object point)
183            (with-current-buffer (window-buffer window)            (with-current-buffer (window-buffer window)
# Line 157  corresponding to the mode line clicked." Line 189  corresponding to the mode line clicked."
189                            " buffer; mouse-3: describe coding system")                            " buffer; mouse-3: describe coding system")
190                  (concat "Unibyte " (symbol-name buffer-file-coding-system)                  (concat "Unibyte " (symbol-name buffer-file-coding-system)
191                          " buffer")))))                          " buffer")))))
192        'local-map mode-line-coding-system-map))        'local-map mode-line-coding-system-map)
193        (:eval (mode-line-eol-desc)))
194    "Mode-line control for displaying information of multilingual environment.    "Mode-line control for displaying information of multilingual environment.
195  Normally it displays current input method (if any activated) and  Normally it displays current input method (if any activated) and
196  mnemonics of the following coding systems:  mnemonics of the following coding systems:
197    coding system for saving or writing the current buffer    coding system for saving or writing the current buffer
198    coding system for keyboard input (if Emacs is running on terminal)    coding system for keyboard input (if Emacs is running on terminal)
199    coding system for terminal output (if Emacs is running on terminal)"    coding system for terminal output (if Emacs is running on terminal)"
200  ;;; Currently not:    ;; Currently not:
201  ;;;  coding system for decoding output of buffer process (if any)    ;;  coding system for decoding output of buffer process (if any)
202  ;;;  coding system for encoding text to send to buffer process (if any)."    ;;  coding system for encoding text to send to buffer process (if any)."
203  )  )
204    
205  (make-variable-buffer-local 'mode-line-mule-info)  (make-variable-buffer-local 'mode-line-mule-info)
# Line 223  Normally nil in most modes, since there Line 256  Normally nil in most modes, since there
256  (defvar mode-line-modes nil  (defvar mode-line-modes nil
257    "Mode-line control for displaying major and minor modes.")    "Mode-line control for displaying major and minor modes.")
258    
259    (defvar mode-line-major-mode-keymap nil "\
260    Keymap to display on major mode.")
261    
262  (defvar mode-line-minor-mode-keymap nil "\  (defvar mode-line-minor-mode-keymap nil "\
263  Keymap to display on major and minor modes.")  Keymap to display on minor modes.")
264    
265    (let ((map (make-sparse-keymap)))
266      (define-key map [mode-line mouse-2] 'describe-mode)
267      (setq mode-line-major-mode-keymap map))
268    
269  ;; Menu of minor modes.  ;; Menu of minor modes.
270  (let ((map (make-sparse-keymap)))  (let ((map (make-sparse-keymap)))
271      (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
272    (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)    (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
273    (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1)    (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1)
274    (setq mode-line-minor-mode-keymap map))    (setq mode-line-minor-mode-keymap map))
# Line 238  Keymap to display on major and minor mod Line 279  Keymap to display on major and minor mod
279          ;;        "\          ;;        "\
280          ;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,          ;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
281          ;; drag-mouse-1: resize, C-mouse-2: split horizontally"          ;; drag-mouse-1: resize, C-mouse-2: split horizontally"
282          "mouse-1: select (drag to resize), mouse-2: delete others, mouse-3: delete")          "mouse-1: select (drag to resize), mouse-2: delete others, mouse-3: delete this")
283         (dashes (propertize "--" 'help-echo help-echo)))         (dashes (propertize "--" 'help-echo help-echo)))
284    (setq-default mode-line-format    (setq-default mode-line-format
285      (list      (list
# Line 248  Keymap to display on major and minor mod Line 289  Keymap to display on major and minor mod
289       'mode-line-frame-identification       'mode-line-frame-identification
290       'mode-line-buffer-identification       'mode-line-buffer-identification
291       (propertize "   " 'help-echo help-echo)       (propertize "   " 'help-echo help-echo)
292       'global-mode-string       'mode-line-position
293         '(vc-mode vc-mode)
294         (propertize "   " 'help-echo help-echo)
295       'mode-line-modes       'mode-line-modes
296       `(which-func-mode ("" which-func-format ,dashes))       `(which-func-mode ("" which-func-format ,dashes))
297       'mode-line-position       `(global-mode-string (,dashes global-mode-string))
298       (propertize "-%-" 'help-echo help-echo)))       (propertize "-%-" 'help-echo help-echo)))
299    
300    (setq-default mode-line-modes    (setq-default mode-line-modes
301      (list      (list
302       (propertize "   %[(" 'help-echo help-echo)       (propertize "%[(" 'help-echo help-echo)
303       `(:propertize ("" mode-name mode-line-process minor-mode-alist)       `(:propertize ("" mode-name)
304                     help-echo "mouse-3: minor mode menu"                     help-echo "mouse-2: help for current major mode"
305                       local-map ,mode-line-major-mode-keymap)
306         `(:propertize ("" mode-line-process))
307         `(:propertize ("" minor-mode-alist)
308                       help-echo "mouse-2: help for minor modes, mouse-3: minor mode menu"
309                     local-map ,mode-line-minor-mode-keymap)                     local-map ,mode-line-minor-mode-keymap)
310       (propertize "%n" 'help-echo "mouse-2: widen"       (propertize "%n" 'help-echo "mouse-2: widen"
311                   'local-map (make-mode-line-mouse-map                   'local-map (make-mode-line-mouse-map
# Line 266  Keymap to display on major and minor mod Line 313  Keymap to display on major and minor mod
313       (propertize ")%]--" 'help-echo help-echo)))       (propertize ")%]--" 'help-echo help-echo)))
314    
315    (setq-default mode-line-position    (setq-default mode-line-position
316      `((line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes))      `((-3 . ,(propertize "%p" 'help-echo help-echo))
317        (column-number-mode (,(propertize "C%c" 'help-echo help-echo) ,dashes))        (line-number-mode
318        (-3 . ,(propertize "%p" 'help-echo help-echo)))))         ((column-number-mode
319             (10 ,(propertize " (%l,%c)" 'help-echo help-echo))
320             (6 ,(propertize " L%l" 'help-echo help-echo))))
321           ((column-number-mode
322             (5 ,(propertize " C%c" 'help-echo help-echo))))))))
323    
324  (defvar mode-line-buffer-identification-keymap nil "\  (defvar mode-line-buffer-identification-keymap nil "\
325  Keymap for what is displayed by `mode-line-buffer-identification'.")  Keymap for what is displayed by `mode-line-buffer-identification'.")
326    
327  (defun last-buffer () "\  (defun last-buffer () "\
328  Return the last non-hidden buffer in the buffer list."  Return the last non-hidden buffer in the buffer list."
329    (let ((list (reverse (buffer-list))))    ;; This logic is more or less copied from bury-buffer,
330      (while (eq (aref (buffer-name (car list)) 0) ? )    ;; except that we reverse the buffer list.
331        (setq list (cdr list)))    (let ((list (nreverse (buffer-list (selected-frame))))
332      (car list)))          (pred (frame-parameter nil 'buffer-predicate))
333            found notsogood)
334        (while (and list (not found))
335          (unless (or (eq (aref (buffer-name (car list)) 0) ? )
336                      ;; If the selected frame has a buffer_predicate,
337                      ;; disregard buffers that don't fit the predicate.
338                      (and pred (not (funcall pred (car list)))))
339            (if (get-buffer-window (car list) 'visible)
340                (or notsogood (eq (car list) (current-buffer)))
341              (setq found (car list))))
342          (pop list))
343        (or found notsogood
344            (get-buffer "*scratch*")
345            (progn
346              (set-buffer-major-mode
347               (get-buffer-create "*scratch*"))
348              (get-buffer "*scratch*")))))
349    
350  (defun unbury-buffer () "\  (defun unbury-buffer () "\
351  Switch to the last buffer in the buffer list."  Switch to the last buffer in the buffer list."
# Line 362  Menu of mode operations in the mode line Line 429  Menu of mode operations in the mode line
429    (interactive "@e")    (interactive "@e")
430    (x-popup-menu event mode-line-mode-menu))    (x-popup-menu event mode-line-mode-menu))
431    
432    (defun mode-line-minor-mode-help (event)
433      "Describe minor mode for EVENT occured on minor modes area of the mode line."
434      (interactive "@e")
435      (let ((indicator (car (nth 4 (car (cdr event))))))
436        (describe-minor-mode-from-indicator indicator)))
437    
438  ;; Add menu of buffer operations to the buffer identification part  ;; Add menu of buffer operations to the buffer identification part
439  ;; of the mode line.or header line.  ;; of the mode line.or header line.
440  ;  ;
# Line 440  is okay.  See `mode-line-format'.") Line 513  is okay.  See `mode-line-format'.")
513           ".fasl" ".ufsl" ".fsl" ".dxl"           ".fasl" ".ufsl" ".fsl" ".dxl"
514           ;; Libtool           ;; Libtool
515           ".lo" ".la"           ".lo" ".la"
516             ;; Gettext
517             ".gmo" ".mo"
518           ;; Texinfo-related           ;; Texinfo-related
519           ".toc" ".log" ".aux"           ".toc" ".log" ".aux"
520           ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"           ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
# Line 563  language you are using." Line 638  language you are using."
638    
639  (make-variable-buffer-local 'minor-mode-overriding-map-alist)  (make-variable-buffer-local 'minor-mode-overriding-map-alist)
640    
 ;; From macros.c  
 (define-key ctl-x-map "(" 'start-kbd-macro)  
 (define-key ctl-x-map ")" 'end-kbd-macro)  
 (define-key ctl-x-map "e" 'call-last-kbd-macro)  
641  ;; From frame.c  ;; From frame.c
642  (global-set-key [switch-frame] 'handle-switch-frame)  (global-set-key [switch-frame] 'handle-switch-frame)
643  (global-set-key [delete-frame] 'handle-delete-frame)  (global-set-key [delete-frame] 'handle-delete-frame)

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.100.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26