* net/tramp.el (tramp-open-shell): New defun.
[bpt/emacs.git] / lisp / bindings.el
index 568d8de..4eab37e 100644 (file)
@@ -1,7 +1,7 @@
 ;;; bindings.el --- define standard key bindings and some variables
 
 ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 1999,
-;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -62,24 +62,6 @@ corresponding to the mode line clicked."
     (force-mode-line-update)))
 
 
-(defun mode-line-abbrev-mode (event)
-  "Turn off `abbrev-mode' from the mode-line."
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (abbrev-mode)
-    (force-mode-line-update)))
-
-
-(defun mode-line-auto-fill-mode (event)
-  "Turn off `auto-fill-mode' from the mode-line."
-  (interactive "e")
-  (save-selected-window
-    (select-window (posn-window (event-start event)))
-    (auto-fill-mode)
-    (force-mode-line-update)))
-
-
 (defvar mode-line-input-method-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line mouse-2]
@@ -151,7 +133,7 @@ corresponding to the mode line clicked."
 (defvar mode-line-client
   `(""
     (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
-                help-echo "emacsclient frame"))
+                help-echo ,(purecopy "emacsclient frame")))
   "Mode-line control for identifying emacsclient frames.")
 ;;;###autoload
 (put 'mode-line-client 'risky-local-variable t)
@@ -161,11 +143,11 @@ corresponding to the mode line clicked."
     (current-input-method
      (:propertize ("" current-input-method-title)
                  help-echo (concat
-                            "Current input method: "
+                            ,(purecopy "Current input method: ")
                             current-input-method
-                            "\n\
+                            ,(purecopy "\n\
 mouse-2: Disable input method\n\
-mouse-3: Describe current input method")
+mouse-3: Describe current input method"))
                  local-map ,mode-line-input-method-map
                  mouse-face mode-line-highlight))
     ,(propertize
@@ -315,11 +297,11 @@ Keymap to display on minor modes.")
        (menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
     (define-key menu-map [line-number-mode]
       `(menu-item ,(purecopy "Display Line Numbers") line-number-mode
-                 :help "Toggle displaying line numbers in the mode-line"
+                 :help ,(purecopy "Toggle displaying line numbers in the mode-line")
                  :button (:toggle . line-number-mode)))
     (define-key menu-map [column-number-mode]
       `(menu-item ,(purecopy "Display Column Numbers") column-number-mode
-                 :help "Toggle displaying column numbers in the mode-line"
+                 :help ,(purecopy "Toggle displaying column numbers in the mode-line")
                  :button (:toggle . column-number-mode)))
     (define-key map [mode-line down-mouse-1] menu-map)
     map) "\
@@ -671,24 +653,6 @@ is okay.  See `mode-line-format'.")
 
 (define-key esc-map "\t" 'complete-symbol)
 
-(defun complete-symbol (arg) "\
-Perform tags completion on the text around point.
-Completes to the set of names listed in the current tags table.
-The string to complete is chosen in the same way as the default
-for \\[find-tag] (which see).
-
-With a prefix argument, this command does completion within
-the collection of symbols listed in the index of the manual for the
-language you are using."
-  (interactive "P")
-  (if arg
-      (info-complete-symbol)
-    (if (fboundp 'complete-tag)
-       (complete-tag)
-      ;; Don't autoload etags if we have no tags table.
-      (error "%s" (substitute-command-keys
-             "No tags table loaded; use \\[visit-tags-table] to load one")))))
-
 ;; Reduce total amount of space we must allocate during this function
 ;; that we will not need to keep permanently.
 (garbage-collect)
@@ -714,6 +678,63 @@ language you are using."
 ;but they are not assigned to keys there.
 (put 'narrow-to-region 'disabled t)
 
+;; Moving with arrows in bidi-sensitive direction.
+(defun right-char (&optional n)
+  "Move point N characters to the right (to the left if N is negative).
+On reaching beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-char]
+and \\[backward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-char n)
+    (backward-char n)))
+
+(defun left-char ( &optional n)
+  "Move point N characters to the left (to the right if N is negative).
+On reaching beginning or end of buffer, stop and signal error.
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-char]
+and \\[forward-char], which see."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-char n)
+    (forward-char n)))
+
+(defun right-word (&optional n)
+  "Move point N words to the right (to the left if N is negative).
+
+Depending on the bidirectional context, this may move either forward
+or backward in the buffer.  This is in contrast with \\[forward-word]
+and \\[backward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (forward-word n)
+    (backward-word n)))
+
+(defun left-word (&optional n)
+  "Move point N words to the left (to the right if N is negative).
+
+Depending on the bidirectional context, this may move either backward
+or forward in the buffer.  This is in contrast with \\[backward-word]
+and \\[forward-word], which see.
+
+Value is normally t.
+If an edge of the buffer or a field boundary is reached, point is left there
+there and the function returns nil.  Field boundaries are not noticed
+if `inhibit-field-text-motion' is non-nil."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (backward-word n)
+    (forward-word n)))
+
 (defvar narrow-map (make-sparse-keymap)
   "Keymap for narrowing commands.")
 (define-key ctl-x-map "n" narrow-map)
@@ -801,6 +822,9 @@ language you are using."
     (setq i (1+ i))))
 (define-key global-map [?\C-\M--] 'negative-argument)
 
+(define-key global-map "\177" 'delete-backward-char)
+(define-key global-map "\C-d" 'delete-forward-char)
+
 (define-key global-map "\C-k" 'kill-line)
 (define-key global-map "\C-w" 'kill-region)
 (define-key esc-map "w" 'kill-ring-save)
@@ -864,12 +888,12 @@ language you are using."
 (define-key global-map [C-home]                'beginning-of-buffer)
 (define-key global-map [M-home]                'beginning-of-buffer-other-window)
 (define-key esc-map    [home]          'beginning-of-buffer-other-window)
-(define-key global-map [left]          'backward-char)
+(define-key global-map [left]          'left-char)
 (define-key global-map [up]            'previous-line)
-(define-key global-map [right]         'forward-char)
+(define-key global-map [right]         'right-char)
 (define-key global-map [down]          'next-line)
-(define-key global-map [prior]         'scroll-down)
-(define-key global-map [next]          'scroll-up)
+(define-key global-map [prior]         'scroll-down-command)
+(define-key global-map [next]          'scroll-up-command)
 (define-key global-map [C-up]          'backward-paragraph)
 (define-key global-map [C-down]                'forward-paragraph)
 (define-key global-map [C-prior]       'scroll-right)
@@ -1066,8 +1090,8 @@ language you are using."
 (global-set-key [M-left]   'backward-word)
 (define-key esc-map [left] 'backward-word)
 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
-(global-set-key [C-right]  'forward-word)
-(global-set-key [C-left]   'backward-word)
+(global-set-key [C-right]  'right-word)
+(global-set-key [C-left]   'left-word)
 ;; This is not quite compatible, but at least is analogous
 (global-set-key [C-delete] 'kill-word)
 (global-set-key [C-backspace] 'backward-kill-word)