Merge from emacs--devo--0
[bpt/emacs.git] / lisp / bindings.el
index e9abbc9..1bc31e0 100644 (file)
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -170,6 +170,12 @@ corresponding to the mode line clicked."
       (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
       desc)))
 
+(defvar mode-line-client
+  `(""
+    (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
+                help-echo "Emacsclient frame"))
+  "Mode-line control for identifying Emacsclient frames.")
+
 (defvar mode-line-mule-info
   `(""
     (current-input-method
@@ -209,7 +215,7 @@ mnemonics of the following coding systems:
 
 (make-variable-buffer-local 'mode-line-mule-info)
 
-(defvar mode-line-frame-identification '("-%F  ")
+(defvar mode-line-frame-identification '(window-system "  " "-%F  ")
   "Mode-line control to describe the current frame.")
 
 (defvar mode-line-process nil "\
@@ -248,6 +254,22 @@ Normally nil in most modes, since there is no process to display.")
 
 (make-variable-buffer-local 'mode-line-modified)
 
+(defvar mode-line-remote
+  (list (propertize
+        "%1@"
+        'help-echo (purecopy (lambda (window object point)
+                               (format "%s"
+                                       (save-selected-window
+                                         (select-window window)
+                                         (concat 
+                                         (if (file-remote-p default-directory)
+                                             "Remote: "
+                                           "Local: ")
+                                         default-directory)))))))
+  "Mode-line flag to show if default-directory for current buffer is remote.")
+
+(make-variable-buffer-local 'mode-line-remote)
+
 ;; Actual initialization is below.
 (defvar mode-line-position nil
   "Mode-line control for displaying the position in the buffer.
@@ -267,6 +289,7 @@ Keymap to display on major mode.")
 
 (defvar mode-line-minor-mode-keymap
   (let ((map (make-sparse-keymap)))
+    (define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu)
     (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
     (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
     (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1)
@@ -286,7 +309,9 @@ Keymap to display on minor modes.")
         "%e"
         (propertize "-" 'help-echo help-echo)
         'mode-line-mule-info
+        'mode-line-client
         'mode-line-modified
+        'mode-line-remote
         'mode-line-frame-identification
         'mode-line-buffer-identification
         (propertize "   " 'help-echo help-echo)
@@ -307,13 +332,14 @@ Keymap to display on minor modes.")
         '("" mode-line-process)
         `(:propertize ("" minor-mode-alist)
                       mouse-face mode-line-highlight
-                      help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes"
+                      help-echo "mouse-1: minor mode, mouse-2: minor mode help, mouse-3: toggle minor modes"
                       local-map ,mode-line-minor-mode-keymap)
         (propertize "%n" 'help-echo "mouse-2: widen"
                     'mouse-face 'mode-line-highlight
                     'local-map (make-mode-line-mouse-map
                                 'mouse-2 #'mode-line-widen))
         (propertize ")%]--" 'help-echo help-echo)))
+
        (standard-mode-line-position
        `((-3 ,(propertize "%p" 'help-echo help-echo))
          (size-indication-mode
@@ -468,7 +494,7 @@ Menu of mode operations in the mode line.")
   (x-popup-menu event mode-line-mode-menu))
 
 (defun mode-line-minor-mode-help (event)
-  "Describe minor mode for EVENT occurred on minor modes area of the mode line."
+  "Describe minor mode for EVENT on minor modes area of the mode line."
   (interactive "@e")
   (let ((indicator (car (nth 4 (car (cdr event))))))
     (describe-minor-mode-from-indicator indicator)))
@@ -476,7 +502,7 @@ Menu of mode operations in the mode line.")
 (defvar minor-mode-alist nil "\
 Alist saying how to show minor modes in the mode line.
 Each element looks like (VARIABLE STRING);
-STRING is included in the mode line iff VARIABLE's value is non-nil.
+STRING is included in the mode line if VARIABLE's value is non-nil.
 
 Actually, STRING need not be a string; any possible mode-line element
 is okay.  See `mode-line-format'.")
@@ -511,7 +537,7 @@ is okay.  See `mode-line-format'.")
        '(".elc" ".lof"
         ".glo" ".idx" ".lot"
         ;; TeX-related
-        ".dvi" ".fmt" ".tfm" ".pdf"
+        ".fmt" ".tfm"
         ;; Java compiled
         ".class"
         ;; CLISP
@@ -626,6 +652,10 @@ language you are using."
 (define-key global-map "\e\e\e" 'keyboard-escape-quit)
 (define-key global-map "\C-g" 'keyboard-quit)
 
+;; Used to be in termdev.el: when using several terminals, make C-z
+;; suspend only the relevant terminal.
+(substitute-key-definition 'suspend-emacs 'suspend-frame global-map)
+
 (define-key global-map "\C-j" 'newline-and-indent)
 (define-key global-map "\C-m" 'newline)
 (define-key global-map "\C-o" 'open-line)
@@ -1007,7 +1037,6 @@ language you are using."
 (define-key ctl-x-map "rf" 'frame-configuration-to-register)
 
 (define-key esc-map "q" 'fill-paragraph)
-;; (define-key esc-map "g" 'fill-region)
 (define-key ctl-x-map "." 'set-fill-prefix)
 \f
 (define-key esc-map "{" 'backward-paragraph)