]> code.delx.au - gnu-emacs/blobdiff - lisp/bindings.el
(locate): Remove dot at the end of error argument.
[gnu-emacs] / lisp / bindings.el
index 606a620e2da5cbece75bc1802f132d225007d20a..1c7915e17ce8bb98bb7feb4fb8cc5c51cfabcc92 100644 (file)
@@ -168,7 +168,7 @@ mnemonics of the following coding systems:
   coding system for saving or writing the current buffer
   coding system for keyboard input (if Emacs is running on terminal)
   coding system for terminal output (if Emacs is running on terminal)"
-;; Currently not:
+;;; Currently not:
 ;;;  coding system for decoding output of buffer process (if any)
 ;;;  coding system for encoding text to send to buffer process (if any)."
 )
@@ -183,7 +183,8 @@ Major modes that edit things other than ordinary files may change this
 
 (make-variable-buffer-local 'mode-line-buffer-identification)
 
-(defvar mode-line-frame-identification '("-%F  "))
+(defvar mode-line-frame-identification '("-%F  ")
+  "Mode-line control to describe the current frame.")
 
 (defvar mode-line-process nil "\
 Mode-line control for displaying info on process status.
@@ -219,15 +220,22 @@ Normally nil in most modes, since there is no process to display.")
 
 (make-variable-buffer-local 'mode-line-modified)
 
-(setq-default mode-line-format
-  (let* ((help-echo
-         ;; The multi-line message doesn't work terribly well on the
-         ;; bottom mode line...  Better ideas?
-;;;      "\
-;;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
-;;; drag-mouse-1: resize, C-mouse-2: split horizontally"
-         "mouse-1: select window, mouse-2: delete others, mouse-3: delete ...")
-        (dashes (propertize "--" 'help-echo help-echo)))
+;; Actual initialization is below.
+(defvar mode-line-position nil
+  "Mode-line control for displaying line number, column number and fraction.")
+
+(defvar mode-line-modes nil
+  "Mode-line control for displaying major and minor modes.")
+
+(let* ((help-echo
+       ;; The multi-line message doesn't work terribly well on the
+       ;; bottom mode line...  Better ideas?
+       ;;        "\
+       ;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
+       ;; drag-mouse-1: resize, C-mouse-2: split horizontally"
+       "mouse-1: select (drag to resize), mouse-2: delete others, mouse-3: delete")
+       (dashes (propertize "--" 'help-echo help-echo)))
+  (setq-default mode-line-format
     (list
      (propertize "-" 'help-echo help-echo)
      'mode-line-mule-info
@@ -236,17 +244,24 @@ Normally nil in most modes, since there is no process to display.")
      'mode-line-buffer-identification
      (propertize "   " 'help-echo help-echo)
      'global-mode-string
+     'mode-line-modes
+     `(which-func-mode ("" which-func-format ,dashes))
+     'mode-line-position
+     (propertize "-%-" 'help-echo help-echo)))
+
+  (setq-default mode-line-modes
+    (list
      (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-mouse-map
                             'mouse-2 #'mode-line-widen))
-     (propertize ")%]--" 'help-echo help-echo)
-     `(which-func-mode ("" which-func-format ,dashes))
-     `(line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes))
-     `(column-number-mode (,(propertize "C%c" 'help-echo help-echo) ,dashes))
-     `(-3 . ,(propertize "%p" 'help-echo help-echo))
-     (propertize "-%-" 'help-echo help-echo))))
+     (propertize ")%]--" 'help-echo help-echo)))
+
+  (setq-default mode-line-position
+    `((line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes))
+      (column-number-mode (,(propertize "C%c" 'help-echo help-echo) ,dashes))
+      (-3 . ,(propertize "%p" 'help-echo help-echo)))))
 
 (defvar mode-line-buffer-identification-keymap nil "\
 Keymap for what is displayed by `mode-line-buffer-identification'.")
@@ -257,18 +272,27 @@ Keymap for what is displayed by `mode-line-mode-name'.")
 (defvar mode-line-mode-menu-keymap nil "\
 Keymap for mode operations menu in the mode line.")
 
+(defun last-buffer () "\
+Return the last non-hidden buffer in the buffer list."
+  (let ((list (reverse (buffer-list))))
+    (while (eq (aref (buffer-name (car list)) 0) ? )
+      (setq list (cdr list)))
+    (car list)))
+
+(defun unbury-buffer () "\
+Switch to the last buffer in the buffer list."
+  (interactive)
+  (switch-to-buffer (last-buffer)))
+
 (defun mode-line-unbury-buffer (event) "\
-Switch to the last buffer in the buffer list that is not hidden."
+Call `unbury-buffer' in this window."
   (interactive "e")
   (save-selected-window
     (select-window (posn-window (event-start event)))
-    (let ((list (reverse (buffer-list))))
-      (while (eq (aref (buffer-name (car list)) 0) ? )
-       (setq list (cdr list)))
-      (switch-to-buffer (car list)))))
+    (unbury-buffer)))
 
 (defun mode-line-bury-buffer (event) "\
-Like bury-buffer, but temporarily select EVENT's window."
+Like `bury-buffer', but temporarily select EVENT's window."
   (interactive "e")
   (save-selected-window
     (select-window (posn-window (event-start event)))
@@ -294,21 +318,26 @@ Menu of mode operations in the mode line.")
 
 (defun mode-line-mode-name () "\
 Return a string to display in the mode line for the current mode name."
-  (let (length (result mode-name))
-    (let ((local-map (get-text-property 0 'local-map result))
-         (help-echo (get-text-property 0 'help-echo result)))
-      (setq result (copy-sequence result))
+  (when (stringp mode-name)
+    (let ((local-map (get-text-property 0 'local-map mode-name))
+         (help-echo (get-text-property 0 'help-echo mode-name)))
+      ;; For correctness, we shouldn't modify mode-name.  But adding some
+      ;; text-properties to those mode-name strings can't hurt, really, and
+      ;; furthermore, by doing it in-place, we make sure that we don't need to
+      ;; do the work over and over and over and ....  -stef
+      (unless (and local-map help-echo)
+       (setq mode-name (copy-sequence mode-name)))
       ;; Add `local-map' property if there isn't already one.
-      (when (and (null local-map)
-                (null (next-single-property-change 0 'local-map result)))
-       (put-text-property 0 (length result)
-                          'local-map mode-line-minor-mode-keymap result))
-      ;; Add `help-echo' property if there isn't already one.
-      (when (and (null help-echo)
-                (null (next-single-property-change 0 'help-echo result)))
-       (put-text-property 0 (length result)
-                          'help-echo "mouse-3: minor mode menu" result)))
-    result))
+      (unless (or local-map
+                 (next-single-property-change 0 'local-map mode-name))
+       (put-text-property 0 (length mode-name)
+                          'local-map mode-line-minor-mode-keymap mode-name)
+       ;; Add `help-echo' property if there isn't already one.
+       (unless (or help-echo
+                   (next-single-property-change 0 'help-echo mode-name))
+         (put-text-property 0 (length mode-name) 'help-echo
+                            "mouse-3: minor mode menu" mode-name)))))
+  mode-name)
 
 (defmacro bound-and-true-p (var)
   "Return the value of symbol VAR if it is bound, else nil."
@@ -421,15 +450,15 @@ is okay.  See `mode-line-format'.")
 ;; making it more likely you will get a unique match.
 (setq completion-ignored-extensions
       (append
-       (cond ((or (eq system-type 'ms-dos) (eq system-type 'windows-nt))
-             '(".o" "~" ".bin" ".bak" ".obj" ".map"
-               ".a" ".ln" ".blg" ".bbl"))
+       (cond ((memq system-type '(ms-dos windows-nt))
+             '(".o" "~" ".bin" ".bak" ".obj" ".map" ".ico" ".pif" ".lnk"
+               ".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386"))
             ((eq system-type 'vax-vms)
              '(".obj" ".exe" ".bin" ".lbin" ".sbin"
                ".brn" ".rnt" ".lni" ".lis"
                ".olb" ".tlb" ".mlb" ".hlb"))
             (t
-             '(".o" "~" ".bin" ".lbin"
+             '(".o" "~" ".bin" ".lbin" ".so"
                ".a" ".ln" ".blg" ".bbl")))
        '(".elc" ".lof"
         ".glo" ".idx" ".lot"
@@ -450,6 +479,14 @@ is okay.  See `mode-line-format'.")
         ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
         ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs")))
 
+;; Suffixes used for executables.
+(setq exec-suffixes
+      (cond
+       ((memq system-type '(ms-dos windows-nt))
+       '(".exe" ".com" ".bat" ".cmd" ".btm" ""))
+       (t
+       '(""))))
+
 ;; Packages should add to this list appropriately when they are
 ;; loaded, rather than listing everything here.
 (setq debug-ignored-errors
@@ -520,9 +557,10 @@ is okay.  See `mode-line-format'.")
 (make-variable-buffer-local 'indent-tabs-mode)
 
 ;; We have base64 and md5 functions built in now.
-(add-to-list 'features 'base64)
-(add-to-list 'features 'md5)
-(add-to-list 'features 'overlay)
+(provide 'base64)
+(provide 'md5)
+(provide 'overlay '(display syntax-table field))
+(provide 'text-properties '(display syntax-table field point-entered))
 
 (define-key esc-map "\t" 'complete-symbol)
 
@@ -559,6 +597,17 @@ language you are using."
 
 (make-variable-buffer-local 'minor-mode-overriding-map-alist)
 
+;; 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)
+;; From frame.c
+(global-set-key [switch-frame] 'handle-switch-frame)
+(global-set-key [delete-frame] 'handle-delete-frame)
+(global-set-key [iconify-frame] 'ignore-event)
+(global-set-key [make-frame-visible] 'ignore-event)
+
+
 ;These commands are defined in editfns.c
 ;but they are not assigned to keys there.
 (put 'narrow-to-region 'disabled t)
@@ -935,9 +984,9 @@ language you are using."
 
 (define-key ctl-x-map "z" 'repeat)
 
-;;; Don't look for autoload cookies in this file.
-;;; Local Variables:
-;;; no-update-autoloads: t
-;;; End:
+;; Don't look for autoload cookies in this file.
+;; Local Variables:
+;; no-update-autoloads: t
+;; End:
 
 ;;; bindings.el ends here