]> code.delx.au - gnu-emacs/blobdiff - lisp/bindings.el
(ps-mule-begin-job): Fix for the case that only ENCODING is set in a font-spec (bug...
[gnu-emacs] / lisp / bindings.el
index e6ccbac6eabb7ce7ea2c2173ca2290a047fc6f94..3ce21a578d593705759881b3b4e3c136f77a2b76 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
@@ -151,7 +151,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 +161,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
@@ -294,7 +294,7 @@ Menu of mode operations in the mode line.")
 (defvar mode-line-major-mode-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line down-mouse-1]
-      '(menu-item "Menu Bar" ignore
+      `(menu-item ,(purecopy "Menu Bar") ignore
         :filter (lambda (_) (mouse-menu-major-mode-map))))
     (define-key map [mode-line mouse-2] 'describe-mode)
     (define-key map [mode-line down-mouse-3] mode-line-mode-menu)
@@ -315,11 +315,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) "\
@@ -593,11 +593,14 @@ is okay.  See `mode-line-format'.")
 (setq completion-ignored-extensions
       (append
        (cond ((memq system-type '(ms-dos windows-nt))
+             (mapcar 'purecopy
              '(".o" "~" ".bin" ".bak" ".obj" ".map" ".ico" ".pif" ".lnk"
-               ".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386"))
+               ".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386")))
             (t
+             (mapcar 'purecopy
              '(".o" "~" ".bin" ".lbin" ".so"
-               ".a" ".ln" ".blg" ".bbl")))
+               ".a" ".ln" ".blg" ".bbl"))))
+       (mapcar 'purecopy
        '(".elc" ".lof"
         ".glo" ".idx" ".lot"
         ;; VCS metadata directories
@@ -624,7 +627,7 @@ is okay.  See `mode-line-format'.")
         ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
         ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs"
         ;; Python byte-compiled
-        ".pyc" ".pyo")))
+        ".pyc" ".pyo"))))
 
 ;; Suffixes used for executables.
 (setq exec-suffixes
@@ -637,24 +640,24 @@ is okay.  See `mode-line-format'.")
 ;; Packages should add to this list appropriately when they are
 ;; loaded, rather than listing everything here.
 (setq debug-ignored-errors
-      '(beginning-of-line beginning-of-buffer end-of-line
+      `(beginning-of-line beginning-of-buffer end-of-line
        end-of-buffer end-of-file buffer-read-only
        file-supersession
-       "^Previous command was not a yank$"
-       "^Minibuffer window is not active$"
-       "^No previous history search regexp$"
-       "^No later matching history item$"
-       "^No earlier matching history item$"
-       "^End of history; no default available$"
-       "^End of defaults; no next item$"
-       "^Beginning of history; no preceding item$"
-       "^No recursive edit is in progress$"
-       "^Changes to be undone are outside visible portion of buffer$"
-       "^No undo information in this buffer$"
-       "^No further undo information"
-       "^Save not confirmed$"
-       "^Recover-file cancelled\\.$"
-       "^Cannot switch buffers in a dedicated window$"
+       ,(purecopy "^Previous command was not a yank$")
+       ,(purecopy "^Minibuffer window is not active$")
+       ,(purecopy "^No previous history search regexp$")
+       ,(purecopy "^No later matching history item$")
+       ,(purecopy "^No earlier matching history item$")
+       ,(purecopy "^End of history; no default available$")
+       ,(purecopy "^End of defaults; no next item$")
+       ,(purecopy "^Beginning of history; no preceding item$")
+       ,(purecopy "^No recursive edit is in progress$")
+       ,(purecopy "^Changes to be undone are outside visible portion of buffer$")
+       ,(purecopy "^No undo information in this buffer$")
+       ,(purecopy "^No further undo information")
+       ,(purecopy "^Save not confirmed$")
+       ,(purecopy "^Recover-file cancelled\\.$")
+       ,(purecopy "^Cannot switch buffers in a dedicated window$")
         ))
 
 
@@ -668,23 +671,29 @@ 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).
+(defun complete-symbol (arg)
+  "Perform tags completion on the text around point.
+If a tags table is loaded, call `complete-tag'.
+Otherwise, if Semantic is active, call `semantic-ia-complete-symbol'.
 
 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")))))
+  (cond (arg
+        (info-complete-symbol))
+       ((or tags-table-list tags-file-name)
+        (complete-tag))
+       ((and (fboundp 'semantic-ia-complete-symbol)
+             (fboundp 'semantic-active-p)
+             (semantic-active-p))
+        (semantic-ia-complete-symbol))
+        (completion-at-point-functions (completion-at-point))
+       (t
+        (error "%s"
+               (substitute-command-keys
+                "No completions available; use \\[visit-tags-table] \
+or \\[semantic-mode]")))))
 
 ;; Reduce total amount of space we must allocate during this function
 ;; that we will not need to keep permanently.
@@ -970,6 +979,9 @@ language you are using."
 
 ;; X11R6 distinguishes these keys from the non-kp keys.
 ;; Make them behave like the non-kp keys unless otherwise bound.
+;; FIXME: rather than list such mappings for every modifier-combination,
+;;   we should come up with a way to do it generically, something like
+;;   (define-key function-key-map [*-kp-home] [*-home])
 (define-key function-key-map [kp-home] [home])
 (define-key function-key-map [kp-left] [left])
 (define-key function-key-map [kp-up] [up])
@@ -1020,6 +1032,14 @@ language you are using."
 (define-key function-key-map [C-S-kp-8] [C-S-up])
 (define-key function-key-map [C-S-kp-9] [C-S-prior])
 
+;; Hitting C-SPC on text terminals, usually sends the ascii code 0 (aka C-@),
+;; so we can't distinguish those two keys, but usually we consider C-SPC
+;; (rather than C-@) as the "canonical" binding.
+(define-key function-key-map [?\C-@] [?\C-\s])
+;; Many keyboards don't have a `backtab' key, so by convention the user
+;; can use S-tab instead to access that binding.
+(define-key function-key-map [S-tab] [backtab])
+
 (define-key global-map [mouse-movement] 'ignore)
 
 (define-key global-map "\C-t" 'transpose-chars)