* desktop.el (desktop-read): Use user-emacs-directory if desktop-path is nil.
[emacs.git] / lisp / bindings.el
blobb92d5e9a1ee36cac511693b1cd5e50020c5788e9
1 ;;; bindings.el --- define standard key bindings and some variables
3 ;; Copyright (C) 1985-1987, 1992-1996, 1999-2012
4 ;; Free Software Foundation, Inc.
6 ;; Maintainer: FSF
7 ;; Keywords: internal
8 ;; Package: emacs
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;;; Code:
29 (defun make-mode-line-mouse-map (mouse function) "\
30 Return a keymap with single entry for mouse key MOUSE on the mode line.
31 MOUSE is defined to run function FUNCTION with no args in the buffer
32 corresponding to the mode line clicked."
33 (let ((map (make-sparse-keymap)))
34 (define-key map (vector 'mode-line mouse) function)
35 map))
38 (defun mode-line-toggle-read-only (event)
39 "Like `toggle-read-only', for the mode-line."
40 (interactive "e")
41 (save-selected-window
42 (select-window (posn-window (event-start event)))
43 (with-no-warnings (toggle-read-only))
44 (force-mode-line-update)))
46 (defun mode-line-toggle-modified (event)
47 "Toggle the buffer-modified flag from the mode-line."
48 (interactive "e")
49 (save-selected-window
50 (select-window (posn-window (event-start event)))
51 (set-buffer-modified-p (not (buffer-modified-p)))
52 (force-mode-line-update)))
54 (defun mode-line-widen (event)
55 "Widen a buffer from the mode-line."
56 (interactive "e")
57 (save-selected-window
58 (select-window (posn-window (event-start event)))
59 (widen)
60 (force-mode-line-update)))
62 (defvar mode-line-input-method-map
63 (let ((map (make-sparse-keymap)))
64 (define-key map [mode-line mouse-2]
65 (lambda (e)
66 (interactive "e")
67 (save-selected-window
68 (select-window
69 (posn-window (event-start e)))
70 (toggle-input-method)
71 (force-mode-line-update))))
72 (define-key map [mode-line mouse-3]
73 (lambda (e)
74 (interactive "e")
75 (save-selected-window
76 (select-window
77 (posn-window (event-start e)))
78 (describe-current-input-method))))
79 (purecopy map)))
81 (defvar mode-line-coding-system-map
82 (let ((map (make-sparse-keymap)))
83 (define-key map [mode-line mouse-1]
84 (lambda (e)
85 (interactive "e")
86 (save-selected-window
87 (select-window (posn-window (event-start e)))
88 (when (and enable-multibyte-characters
89 buffer-file-coding-system)
90 (describe-coding-system buffer-file-coding-system)))))
91 (define-key map [mode-line mouse-3]
92 (lambda (e)
93 (interactive "e")
94 (save-selected-window
95 (select-window (posn-window (event-start e)))
96 (call-interactively 'set-buffer-file-coding-system))))
97 (purecopy map))
98 "Local keymap for the coding-system part of the mode line.")
100 (defun mode-line-change-eol (event)
101 "Cycle through the various possible kinds of end-of-line styles."
102 (interactive "e")
103 (with-selected-window (posn-window (event-start event))
104 (let ((eol (coding-system-eol-type buffer-file-coding-system)))
105 (set-buffer-file-coding-system
106 (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix))))))
108 (defvar mode-line-eol-desc-cache nil)
110 (defun mode-line-eol-desc ()
111 (let* ((eol (coding-system-eol-type buffer-file-coding-system))
112 (mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system))
113 (desc (assoc eol mode-line-eol-desc-cache)))
114 (if (and desc (eq (cadr desc) mnemonic))
115 (cddr desc)
116 (if desc (setq mode-line-eol-desc-cache nil)) ;Flush the cache if stale.
117 (setq desc
118 (propertize
119 mnemonic
120 'help-echo (format "End-of-line style: %s\nmouse-1: Cycle"
121 (if (eq eol 0) "Unix-style LF"
122 (if (eq eol 1) "DOS-style CRLF"
123 (if (eq eol 2) "Mac-style CR"
124 "Undecided"))))
125 'keymap
126 (eval-when-compile
127 (let ((map (make-sparse-keymap)))
128 (define-key map [mode-line mouse-1] 'mode-line-change-eol)
129 map))
130 'mouse-face 'mode-line-highlight))
131 (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
132 desc)))
135 ;;; Mode line contents
137 (defcustom mode-line-default-help-echo
138 "mouse-1: Select (drag to resize)\n\
139 mouse-2: Make current window occupy the whole frame\n\
140 mouse-3: Remove current window from display"
141 "Default help text for the mode line.
142 If the value is a string, it specifies the tooltip or echo area
143 message to display when the mouse is moved over the mode line.
144 If the text at the mouse position has a `help-echo' text
145 property, that overrides this variable."
146 :type '(choice (const :tag "No help" :value nil) string)
147 :version "24.2"
148 :group 'mode-line)
150 (defvar mode-line-front-space '(:eval (if (display-graphic-p) " " "-"))
151 "Mode line construct to put at the front of the mode line.
152 By default, this construct is displayed right at the beginning of
153 the mode line, except that if there is a memory-full message, it
154 is displayed first.")
155 (put 'mode-line-front-space 'risky-local-variable t)
157 (defun mode-line-mule-info-help-echo (window _object _point)
158 "Return help text specifying WINDOW's buffer coding system."
159 (with-current-buffer (window-buffer window)
160 (if buffer-file-coding-system
161 (format "Buffer coding system (%s): %s
162 mouse-1: Describe coding system
163 mouse-3: Set coding system"
164 (if enable-multibyte-characters "multi-byte" "unibyte")
165 (symbol-name buffer-file-coding-system))
166 "Buffer coding system: none specified")))
168 (defvar mode-line-mule-info
169 `(""
170 (current-input-method
171 (:propertize ("" current-input-method-title)
172 help-echo (concat
173 ,(purecopy "Current input method: ")
174 current-input-method
175 ,(purecopy "\n\
176 mouse-2: Disable input method\n\
177 mouse-3: Describe current input method"))
178 local-map ,mode-line-input-method-map
179 mouse-face mode-line-highlight))
180 ,(propertize
181 "%z"
182 'help-echo 'mode-line-mule-info-help-echo
183 'mouse-face 'mode-line-highlight
184 'local-map mode-line-coding-system-map)
185 (:eval (mode-line-eol-desc)))
186 "Mode line construct to report the multilingual environment.
187 Normally it displays current input method (if any activated) and
188 mnemonics of the following coding systems:
189 coding system for saving or writing the current buffer
190 coding system for keyboard input (on a text terminal)
191 coding system for terminal output (on a text terminal)")
192 ;;;###autoload
193 (put 'mode-line-mule-info 'risky-local-variable t)
194 (make-variable-buffer-local 'mode-line-mule-info)
196 (defvar mode-line-client
197 `(""
198 (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
199 help-echo ,(purecopy "emacsclient frame")))
200 "Mode line construct for identifying emacsclient frames.")
201 ;;;###autoload
202 (put 'mode-line-client 'risky-local-variable t)
204 (defun mode-line-read-only-help-echo (window _object _point)
205 "Return help text specifying WINDOW's buffer read-only status."
206 (format "Buffer is %s\nmouse-1: Toggle"
207 (if (buffer-local-value 'buffer-read-only (window-buffer window))
208 "read-only"
209 "writable")))
211 (defun mode-line-modified-help-echo (window _object _point)
212 "Return help text specifying WINDOW's buffer modification status."
213 (format "Buffer is %smodified\nmouse-1: Toggle modification state"
214 (if (buffer-modified-p (window-buffer window)) "" "not ")))
216 (defvar mode-line-modified
217 (list (propertize
218 "%1*"
219 'help-echo 'mode-line-read-only-help-echo
220 'local-map (purecopy (make-mode-line-mouse-map
221 'mouse-1
222 #'mode-line-toggle-read-only))
223 'mouse-face 'mode-line-highlight)
224 (propertize
225 "%1+"
226 'help-echo 'mode-line-modified-help-echo
227 'local-map (purecopy (make-mode-line-mouse-map
228 'mouse-1 #'mode-line-toggle-modified))
229 'mouse-face 'mode-line-highlight))
230 "Mode line construct for displaying whether current buffer is modified.")
231 ;;;###autoload
232 (put 'mode-line-modified 'risky-local-variable t)
233 (make-variable-buffer-local 'mode-line-modified)
235 (defvar mode-line-remote
236 (list (propertize
237 "%1@"
238 'mouse-face 'mode-line-highlight
239 'help-echo (purecopy (lambda (window _object _point)
240 (format "%s"
241 (save-selected-window
242 (select-window window)
243 (concat
244 (if (file-remote-p default-directory)
245 "Current directory is remote: "
246 "Current directory is local: ")
247 default-directory)))))))
248 "Mode line construct to indicate a remote buffer.")
249 ;;;###autoload
250 (put 'mode-line-remote 'risky-local-variable t)
251 (make-variable-buffer-local 'mode-line-remote)
253 ;; MSDOS frames have window-system, but want the Fn identification.
254 (defun mode-line-frame-control ()
255 "Compute mode line construct for frame identification.
256 Value is used for `mode-line-frame-identification', which see."
257 (if (or (null window-system)
258 (eq window-system 'pc))
259 "-%F "
260 " "))
262 ;; We need to defer the call to mode-line-frame-control to the time
263 ;; the mode line is actually displayed.
264 (defvar mode-line-frame-identification '(:eval (mode-line-frame-control))
265 "Mode line construct to describe the current frame.")
266 ;;;###autoload
267 (put 'mode-line-frame-identification 'risky-local-variable t)
269 (defvar mode-line-process nil
270 "Mode line construct for displaying info on process status.
271 Normally nil in most modes, since there is no process to display.")
272 ;;;###autoload
273 (put 'mode-line-process 'risky-local-variable t)
274 (make-variable-buffer-local 'mode-line-process)
276 (defvar mode-line-mode-menu (make-sparse-keymap "Minor Modes") "\
277 Menu of mode operations in the mode line.")
279 (defvar mode-line-major-mode-keymap
280 (let ((map (make-sparse-keymap)))
281 (define-key map [mode-line down-mouse-1]
282 `(menu-item ,(purecopy "Menu Bar") ignore
283 :filter (lambda (_) (mouse-menu-major-mode-map))))
284 (define-key map [mode-line mouse-2] 'describe-mode)
285 (define-key map [mode-line down-mouse-3] mode-line-mode-menu)
286 map) "\
287 Keymap to display on major mode.")
289 (defvar mode-line-minor-mode-keymap
290 (let ((map (make-sparse-keymap)))
291 (define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu)
292 (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
293 (define-key map [mode-line down-mouse-3] mode-line-mode-menu)
294 (define-key map [header-line down-mouse-3] mode-line-mode-menu)
295 map) "\
296 Keymap to display on minor modes.")
298 (defvar mode-line-modes
299 (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out"))
300 (list (propertize "%[" 'help-echo recursive-edit-help-echo)
302 `(:propertize ("" mode-name)
303 help-echo "Major mode\n\
304 mouse-1: Display major mode menu\n\
305 mouse-2: Show help for major mode\n\
306 mouse-3: Toggle minor modes"
307 mouse-face mode-line-highlight
308 local-map ,mode-line-major-mode-keymap)
309 '("" mode-line-process)
310 `(:propertize ("" minor-mode-alist)
311 mouse-face mode-line-highlight
312 help-echo "Minor mode\n\
313 mouse-1: Display minor mode menu\n\
314 mouse-2: Show help for minor mode\n\
315 mouse-3: Toggle minor modes"
316 local-map ,mode-line-minor-mode-keymap)
317 (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
318 'mouse-face 'mode-line-highlight
319 'local-map (make-mode-line-mouse-map
320 'mouse-2 #'mode-line-widen))
322 (propertize "%]" 'help-echo recursive-edit-help-echo)
323 " "))
324 "Mode line construct for displaying major and minor modes.")
325 (put 'mode-line-modes 'risky-local-variable t)
327 (defvar mode-line-column-line-number-mode-map
328 (let ((map (make-sparse-keymap))
329 (menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
330 (define-key menu-map [line-number-mode]
331 `(menu-item ,(purecopy "Display Line Numbers") line-number-mode
332 :help ,(purecopy "Toggle displaying line numbers in the mode-line")
333 :button (:toggle . line-number-mode)))
334 (define-key menu-map [column-number-mode]
335 `(menu-item ,(purecopy "Display Column Numbers") column-number-mode
336 :help ,(purecopy "Toggle displaying column numbers in the mode-line")
337 :button (:toggle . column-number-mode)))
338 (define-key map [mode-line down-mouse-1] menu-map)
339 map) "\
340 Keymap to display on column and line numbers.")
342 (defvar mode-line-position
343 `((-3 ,(propertize
344 "%p"
345 'local-map mode-line-column-line-number-mode-map
346 'mouse-face 'mode-line-highlight
347 ;; XXX needs better description
348 'help-echo "Size indication mode\n\
349 mouse-1: Display Line and Column Mode Menu"))
350 (size-indication-mode
351 (8 ,(propertize
352 " of %I"
353 'local-map mode-line-column-line-number-mode-map
354 'mouse-face 'mode-line-highlight
355 ;; XXX needs better description
356 'help-echo "Size indication mode\n\
357 mouse-1: Display Line and Column Mode Menu")))
358 (line-number-mode
359 ((column-number-mode
360 (10 ,(propertize
361 " (%l,%c)"
362 'local-map mode-line-column-line-number-mode-map
363 'mouse-face 'mode-line-highlight
364 'help-echo "Line number and Column number\n\
365 mouse-1: Display Line and Column Mode Menu"))
366 (6 ,(propertize
367 " L%l"
368 'local-map mode-line-column-line-number-mode-map
369 'mouse-face 'mode-line-highlight
370 'help-echo "Line Number\n\
371 mouse-1: Display Line and Column Mode Menu"))))
372 ((column-number-mode
373 (5 ,(propertize
374 " C%c"
375 'local-map mode-line-column-line-number-mode-map
376 'mouse-face 'mode-line-highlight
377 'help-echo "Column number\n\
378 mouse-1: Display Line and Column Mode Menu"))))))
379 "Mode line construct for displaying the position in the buffer.
380 Normally displays the buffer percentage and, optionally, the
381 buffer size, the line number and the column number.")
382 (put 'mode-line-position 'risky-local-variable t)
384 (defvar mode-line-buffer-identification-keymap
385 ;; Add menu of buffer operations to the buffer identification part
386 ;; of the mode line.or header line.
387 (let ((map (make-sparse-keymap)))
388 ;; Bind down- events so that the global keymap won't ``shine
389 ;; through''.
390 (define-key map [mode-line mouse-1] 'mode-line-previous-buffer)
391 (define-key map [header-line down-mouse-1] 'ignore)
392 (define-key map [header-line mouse-1] 'mode-line-previous-buffer)
393 (define-key map [mode-line mouse-3] 'mode-line-next-buffer)
394 (define-key map [header-line down-mouse-3] 'ignore)
395 (define-key map [header-line mouse-3] 'mode-line-next-buffer)
396 map) "\
397 Keymap for what is displayed by `mode-line-buffer-identification'.")
399 (defun propertized-buffer-identification (fmt)
400 "Return a list suitable for `mode-line-buffer-identification'.
401 FMT is a format specifier such as \"%12b\". This function adds
402 text properties for face, help-echo, and local-map to it."
403 (list (propertize fmt
404 'face 'mode-line-buffer-id
405 'help-echo
406 (purecopy "Buffer name
407 mouse-1: Previous buffer\nmouse-3: Next buffer")
408 'mouse-face 'mode-line-highlight
409 'local-map mode-line-buffer-identification-keymap)))
411 (defvar mode-line-buffer-identification
412 (propertized-buffer-identification "%12b")
413 "Mode line construct for identifying the buffer being displayed.
414 Its default value is (\"%12b\") with some text properties added.
415 Major modes that edit things other than ordinary files may change this
416 \(e.g. Info, Dired,...)")
417 ;;;###autoload
418 (put 'mode-line-buffer-identification 'risky-local-variable t)
419 (make-variable-buffer-local 'mode-line-buffer-identification)
421 (defvar mode-line-misc-info
422 '((which-func-mode ("" which-func-format " "))
423 (global-mode-string ("" global-mode-string " ")))
424 "Mode line construct for miscellaneous information.
425 By default, this shows the information specified by
426 `which-func-mode' and `global-mode-string'.")
427 (put 'mode-line-misc-info 'risky-local-variable t)
429 (defvar mode-line-end-spaces '(:eval (unless (display-graphic-p) "-%-"))
430 "Mode line construct to put at the end of the mode line.")
431 (put 'mode-line-end-spaces 'risky-local-variable t)
433 ;; Default value of the top-level `mode-line-format' variable:
434 (let ((standard-mode-line-format
435 (list "%e"
436 'mode-line-front-space
437 'mode-line-mule-info
438 'mode-line-client
439 'mode-line-modified
440 'mode-line-remote
441 'mode-line-frame-identification
442 'mode-line-buffer-identification
444 'mode-line-position
445 '(vc-mode vc-mode)
447 'mode-line-modes
448 'mode-line-misc-info
449 'mode-line-end-spaces)))
450 (setq-default mode-line-format standard-mode-line-format)
451 (put 'mode-line-format 'standard-value
452 (list `(quote ,standard-mode-line-format))))
455 (defun mode-line-unbury-buffer (event) "\
456 Call `unbury-buffer' in this window."
457 (interactive "e")
458 (save-selected-window
459 (select-window (posn-window (event-start event)))
460 (unbury-buffer)))
462 (defun mode-line-bury-buffer (event) "\
463 Like `bury-buffer', but temporarily select EVENT's window."
464 (interactive "e")
465 (save-selected-window
466 (select-window (posn-window (event-start event)))
467 (bury-buffer)))
469 (defun mode-line-other-buffer () "\
470 Switch to the most recently selected buffer other than the current one."
471 (interactive)
472 (switch-to-buffer (other-buffer) nil t))
474 (defun mode-line-next-buffer (event)
475 "Like `next-buffer', but temporarily select EVENT's window."
476 (interactive "e")
477 (save-selected-window
478 (select-window (posn-window (event-start event)))
479 (next-buffer)))
481 (defun mode-line-previous-buffer (event)
482 "Like `previous-buffer', but temporarily select EVENT's window."
483 (interactive "e")
484 (save-selected-window
485 (select-window (posn-window (event-start event)))
486 (previous-buffer)))
488 (defmacro bound-and-true-p (var)
489 "Return the value of symbol VAR if it is bound, else nil."
490 `(and (boundp (quote ,var)) ,var))
492 ;; Use mode-line-mode-menu for local minor-modes only.
493 ;; Global ones can go on the menubar (Options --> Show/Hide).
494 (define-key mode-line-mode-menu [overwrite-mode]
495 `(menu-item ,(purecopy "Overwrite (Ovwrt)") overwrite-mode
496 :help ,(purecopy "Overwrite mode: typed characters replace existing text")
497 :button (:toggle . overwrite-mode)))
498 (define-key mode-line-mode-menu [outline-minor-mode]
499 `(menu-item ,(purecopy "Outline (Outl)") outline-minor-mode
500 ;; XXX: This needs a good, brief description.
501 :help ,(purecopy "")
502 :button (:toggle . (bound-and-true-p outline-minor-mode))))
503 (define-key mode-line-mode-menu [highlight-changes-mode]
504 `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode
505 :help ,(purecopy "Show changes in the buffer in a distinctive color")
506 :button (:toggle . (bound-and-true-p highlight-changes-mode))))
507 (define-key mode-line-mode-menu [hide-ifdef-mode]
508 `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode
509 :help ,(purecopy "Show/Hide code within #ifdef constructs")
510 :button (:toggle . (bound-and-true-p hide-ifdef-mode))))
511 (define-key mode-line-mode-menu [glasses-mode]
512 `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode
513 :help ,(purecopy "Insert virtual separators to make long identifiers easy to read")
514 :button (:toggle . (bound-and-true-p glasses-mode))))
515 (define-key mode-line-mode-menu [font-lock-mode]
516 `(menu-item ,(purecopy "Font Lock") font-lock-mode
517 :help ,(purecopy "Syntax coloring")
518 :button (:toggle . font-lock-mode)))
519 (define-key mode-line-mode-menu [flyspell-mode]
520 `(menu-item ,(purecopy "Flyspell (Fly)") flyspell-mode
521 :help ,(purecopy "Spell checking on the fly")
522 :button (:toggle . (bound-and-true-p flyspell-mode))))
523 (define-key mode-line-mode-menu [auto-revert-tail-mode]
524 `(menu-item ,(purecopy "Auto revert tail (Tail)") auto-revert-tail-mode
525 :help ,(purecopy "Revert the tail of the buffer when buffer grows")
526 :enable (buffer-file-name)
527 :button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
528 (define-key mode-line-mode-menu [auto-revert-mode]
529 `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode
530 :help ,(purecopy "Revert the buffer when the file on disk changes")
531 :button (:toggle . (bound-and-true-p auto-revert-mode))))
532 (define-key mode-line-mode-menu [auto-fill-mode]
533 `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
534 :help ,(purecopy "Automatically insert new lines")
535 :button (:toggle . auto-fill-function)))
536 (define-key mode-line-mode-menu [abbrev-mode]
537 `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode
538 :help ,(purecopy "Automatically expand abbreviations")
539 :button (:toggle . abbrev-mode)))
541 (defun mode-line-minor-mode-help (event)
542 "Describe minor mode for EVENT on minor modes area of the mode line."
543 (interactive "@e")
544 (let ((indicator (car (nth 4 (car (cdr event))))))
545 (describe-minor-mode-from-indicator indicator)))
547 (defvar minor-mode-alist nil "\
548 Alist saying how to show minor modes in the mode line.
549 Each element looks like (VARIABLE STRING);
550 STRING is included in the mode line if VARIABLE's value is non-nil.
552 Actually, STRING need not be a string; any mode-line construct is
553 okay. See `mode-line-format'.")
554 ;;;###autoload
555 (put 'minor-mode-alist 'risky-local-variable t)
556 ;; Don't use purecopy here--some people want to change these strings.
557 (setq minor-mode-alist
558 '((abbrev-mode " Abbrev")
559 (overwrite-mode overwrite-mode)
560 (auto-fill-function " Fill")
561 ;; not really a minor mode...
562 (defining-kbd-macro " Def")))
564 ;; These variables are used by autoloadable packages.
565 ;; They are defined here so that they do not get overridden
566 ;; by the loading of those packages.
568 ;; Names in directory that end in one of these
569 ;; are ignored in completion,
570 ;; making it more likely you will get a unique match.
571 (setq completion-ignored-extensions
572 (append
573 (cond ((memq system-type '(ms-dos windows-nt))
574 (mapcar 'purecopy
575 '(".o" "~" ".bin" ".bak" ".obj" ".map" ".ico" ".pif" ".lnk"
576 ".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386")))
578 (mapcar 'purecopy
579 '(".o" "~" ".bin" ".lbin" ".so"
580 ".a" ".ln" ".blg" ".bbl"))))
581 (mapcar 'purecopy
582 '(".elc" ".lof"
583 ".glo" ".idx" ".lot"
584 ;; VCS metadata directories
585 ".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/"
586 ;; TeX-related
587 ".fmt" ".tfm"
588 ;; Java compiled
589 ".class"
590 ;; CLISP
591 ".fas" ".lib" ".mem"
592 ;; CMUCL
593 ".x86f" ".sparcf"
594 ;; OpenMCL / Clozure CL
595 ".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl"
596 ".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl"
597 ".sx32fsl" ".wx64fsl" ".wx32fsl"
598 ;; Other CL implementations (Allegro, LispWorks)
599 ".fasl" ".ufsl" ".fsl" ".dxl"
600 ;; Libtool
601 ".lo" ".la"
602 ;; Gettext
603 ".gmo" ".mo"
604 ;; Texinfo-related
605 ;; This used to contain .log, but that's commonly used for log
606 ;; files you do want to see, not just TeX stuff. -- fx
607 ".toc" ".aux"
608 ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
609 ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs"
610 ;; Python byte-compiled
611 ".pyc" ".pyo"))))
613 ;; Suffixes used for executables.
614 (setq exec-suffixes
615 (cond
616 ((memq system-type '(ms-dos windows-nt))
617 '(".exe" ".com" ".bat" ".cmd" ".btm" ""))
619 '(""))))
621 ;; Packages should add to this list appropriately when they are
622 ;; loaded, rather than listing everything here.
623 (setq debug-ignored-errors
624 ;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line,
625 ;; end-of-buffer, end-of-file, buffer-read-only, and
626 ;; file-supersession should all be user-errors!
627 `(beginning-of-line beginning-of-buffer end-of-line
628 end-of-buffer end-of-file buffer-read-only
629 file-supersession
630 user-error ;; That's the main one!
634 (make-variable-buffer-local 'indent-tabs-mode)
636 ;; We have base64, md5 and sha1 functions built in now.
637 (provide 'base64)
638 (provide 'md5)
639 (provide 'sha1)
640 (provide 'overlay '(display syntax-table field))
641 (provide 'text-properties '(display syntax-table field point-entered))
643 (define-key esc-map "\t" 'complete-symbol)
645 (defun complete-symbol (arg)
646 "Perform completion on the text around point.
647 The completion method is determined by `completion-at-point-functions'.
649 With a prefix argument, this command does completion within
650 the collection of symbols listed in the index of the manual for the
651 language you are using."
652 (interactive "P")
653 (if arg (info-complete-symbol) (completion-at-point)))
655 ;; Reduce total amount of space we must allocate during this function
656 ;; that we will not need to keep permanently.
657 (garbage-collect)
660 (setq help-event-list '(help f1))
662 (make-variable-buffer-local 'minor-mode-overriding-map-alist)
664 ;; From frame.c
665 (global-set-key [switch-frame] 'handle-switch-frame)
666 (global-set-key [select-window] 'handle-select-window)
668 ;; FIXME: Do those 3 events really ever reach the global-map ?
669 ;; It seems that they can't because they're handled via
670 ;; special-event-map which is used at very low-level. -stef
671 (global-set-key [delete-frame] 'handle-delete-frame)
672 (global-set-key [iconify-frame] 'ignore-event)
673 (global-set-key [make-frame-visible] 'ignore-event)
676 ;These commands are defined in editfns.c
677 ;but they are not assigned to keys there.
678 (put 'narrow-to-region 'disabled t)
680 ;; Moving with arrows in bidi-sensitive direction.
681 (defun right-char (&optional n)
682 "Move point N characters to the right (to the left if N is negative).
683 On reaching beginning or end of buffer, stop and signal error.
685 Depending on the bidirectional context, this may move either forward
686 or backward in the buffer. This is in contrast with \\[forward-char]
687 and \\[backward-char], which see."
688 (interactive "^p")
689 (if (eq (current-bidi-paragraph-direction) 'left-to-right)
690 (forward-char n)
691 (backward-char n)))
693 (defun left-char ( &optional n)
694 "Move point N characters to the left (to the right if N is negative).
695 On reaching beginning or end of buffer, stop and signal error.
697 Depending on the bidirectional context, this may move either backward
698 or forward in the buffer. This is in contrast with \\[backward-char]
699 and \\[forward-char], which see."
700 (interactive "^p")
701 (if (eq (current-bidi-paragraph-direction) 'left-to-right)
702 (backward-char n)
703 (forward-char n)))
705 (defun right-word (&optional n)
706 "Move point N words to the right (to the left if N is negative).
708 Depending on the bidirectional context, this may move either forward
709 or backward in the buffer. This is in contrast with \\[forward-word]
710 and \\[backward-word], which see.
712 Value is normally t.
713 If an edge of the buffer or a field boundary is reached, point is left there
714 there and the function returns nil. Field boundaries are not noticed
715 if `inhibit-field-text-motion' is non-nil."
716 (interactive "^p")
717 (if (eq (current-bidi-paragraph-direction) 'left-to-right)
718 (forward-word n)
719 (backward-word n)))
721 (defun left-word (&optional n)
722 "Move point N words to the left (to the right if N is negative).
724 Depending on the bidirectional context, this may move either backward
725 or forward in the buffer. This is in contrast with \\[backward-word]
726 and \\[forward-word], which see.
728 Value is normally t.
729 If an edge of the buffer or a field boundary is reached, point is left there
730 there and the function returns nil. Field boundaries are not noticed
731 if `inhibit-field-text-motion' is non-nil."
732 (interactive "^p")
733 (if (eq (current-bidi-paragraph-direction) 'left-to-right)
734 (backward-word n)
735 (forward-word n)))
737 (defvar narrow-map (make-sparse-keymap)
738 "Keymap for narrowing commands.")
739 (define-key ctl-x-map "n" narrow-map)
741 (define-key narrow-map "n" 'narrow-to-region)
742 (define-key narrow-map "w" 'widen)
744 ;; Quitting
745 (define-key global-map "\e\e\e" 'keyboard-escape-quit)
746 (define-key global-map "\C-g" 'keyboard-quit)
748 ;; Used to be in termdev.el: when using several terminals, make C-z
749 ;; suspend only the relevant terminal.
750 (substitute-key-definition 'suspend-emacs 'suspend-frame global-map)
752 (define-key global-map "\C-j" 'newline-and-indent)
753 (define-key global-map "\C-m" 'newline)
754 (define-key global-map "\C-o" 'open-line)
755 (define-key esc-map "\C-o" 'split-line)
756 (define-key global-map "\C-q" 'quoted-insert)
757 (define-key esc-map "^" 'delete-indentation)
758 (define-key esc-map "\\" 'delete-horizontal-space)
759 (define-key esc-map "m" 'back-to-indentation)
760 (define-key ctl-x-map "\C-o" 'delete-blank-lines)
761 (define-key esc-map " " 'just-one-space)
762 (define-key esc-map "z" 'zap-to-char)
763 (define-key esc-map "=" 'count-words-region)
764 (define-key ctl-x-map "=" 'what-cursor-position)
765 (define-key esc-map ":" 'eval-expression)
766 ;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
767 (define-key esc-map "\M-:" 'eval-expression)
768 ;; Changed from C-x ESC so that function keys work following C-x.
769 (define-key ctl-x-map "\e\e" 'repeat-complex-command)
770 ;; New binding analogous to M-:.
771 (define-key ctl-x-map "\M-:" 'repeat-complex-command)
772 (define-key ctl-x-map "u" 'undo)
773 (put 'undo :advertised-binding [?\C-x ?u])
774 ;; Many people are used to typing C-/ on X terminals and getting C-_.
775 (define-key global-map [?\C-/] 'undo)
776 (define-key global-map "\C-_" 'undo)
777 ;; Richard said that we should not use C-x <uppercase letter> and I have
778 ;; no idea whereas to bind it. Any suggestion welcome. -stef
779 ;; (define-key ctl-x-map "U" 'undo-only)
781 (define-key esc-map "!" 'shell-command)
782 (define-key esc-map "|" 'shell-command-on-region)
783 (define-key esc-map "&" 'async-shell-command)
785 (define-key ctl-x-map [right] 'next-buffer)
786 (define-key ctl-x-map [C-right] 'next-buffer)
787 (define-key global-map [XF86Forward] 'next-buffer)
788 (define-key ctl-x-map [left] 'previous-buffer)
789 (define-key ctl-x-map [C-left] 'previous-buffer)
790 (define-key global-map [XF86Back] 'previous-buffer)
792 (let ((map minibuffer-local-map))
793 (define-key map "\en" 'next-history-element)
794 (define-key map [next] 'next-history-element)
795 (define-key map [down] 'next-history-element)
796 (define-key map [XF86Forward] 'next-history-element)
797 (define-key map "\ep" 'previous-history-element)
798 (define-key map [prior] 'previous-history-element)
799 (define-key map [up] 'previous-history-element)
800 (define-key map [XF86Back] 'previous-history-element)
801 (define-key map "\es" 'next-matching-history-element)
802 (define-key map "\er" 'previous-matching-history-element)
803 ;; Override the global binding (which calls indent-relative via
804 ;; indent-for-tab-command). The alignment that indent-relative tries to
805 ;; do doesn't make much sense here since the prompt messes it up.
806 (define-key map "\t" 'self-insert-command)
807 (define-key map [C-tab] 'file-cache-minibuffer-complete))
809 (define-key global-map "\C-u" 'universal-argument)
810 (let ((i ?0))
811 (while (<= i ?9)
812 (define-key esc-map (char-to-string i) 'digit-argument)
813 (setq i (1+ i))))
814 (define-key esc-map "-" 'negative-argument)
815 ;; Define control-digits.
816 (let ((i ?0))
817 (while (<= i ?9)
818 (define-key global-map (read (format "[?\\C-%c]" i)) 'digit-argument)
819 (setq i (1+ i))))
820 (define-key global-map [?\C--] 'negative-argument)
821 ;; Define control-meta-digits.
822 (let ((i ?0))
823 (while (<= i ?9)
824 (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
825 (setq i (1+ i))))
826 (define-key global-map [?\C-\M--] 'negative-argument)
828 ;; Update tutorial--default-keys if you change these.
829 (define-key global-map "\177" 'delete-backward-char)
830 (define-key global-map "\C-d" 'delete-char)
832 (define-key global-map "\C-k" 'kill-line)
833 (define-key global-map "\C-w" 'kill-region)
834 (define-key esc-map "w" 'kill-ring-save)
835 (define-key esc-map "\C-w" 'append-next-kill)
836 (define-key global-map "\C-y" 'yank)
837 (define-key esc-map "y" 'yank-pop)
839 ;; (define-key ctl-x-map "a" 'append-to-buffer)
841 (define-key global-map "\C-@" 'set-mark-command)
842 ;; Many people are used to typing C-SPC and getting C-@.
843 (define-key global-map [?\C- ] 'set-mark-command)
844 (put 'set-mark-command :advertised-binding [?\C- ])
846 (define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
847 (define-key ctl-x-map "\C-@" 'pop-global-mark)
848 (define-key ctl-x-map [?\C- ] 'pop-global-mark)
850 (define-key global-map "\C-n" 'next-line)
851 (define-key global-map "\C-p" 'previous-line)
852 (define-key ctl-x-map "\C-n" 'set-goal-column)
853 (define-key global-map "\C-a" 'move-beginning-of-line)
854 (define-key global-map "\C-e" 'move-end-of-line)
856 (define-key ctl-x-map "`" 'next-error)
858 (defvar goto-map (make-sparse-keymap)
859 "Keymap for navigation commands.")
860 (define-key esc-map "g" goto-map)
862 (define-key goto-map "c" 'goto-char)
863 (define-key goto-map "g" 'goto-line)
864 (define-key goto-map "\M-g" 'goto-line)
865 (define-key goto-map "n" 'next-error)
866 (define-key goto-map "\M-n" 'next-error)
867 (define-key goto-map "p" 'previous-error)
868 (define-key goto-map "\M-p" 'previous-error)
870 (defvar search-map (make-sparse-keymap)
871 "Keymap for search related commands.")
872 (define-key esc-map "s" search-map)
874 (define-key search-map "o" 'occur)
875 (define-key search-map "hr" 'highlight-regexp)
876 (define-key search-map "hp" 'highlight-phrase)
877 (define-key search-map "hl" 'highlight-lines-matching-regexp)
878 (define-key search-map "hu" 'unhighlight-regexp)
879 (define-key search-map "hf" 'hi-lock-find-patterns)
880 (define-key search-map "hw" 'hi-lock-write-interactive-patterns)
882 ;;(defun function-key-error ()
883 ;; (interactive)
884 ;; (error "That function key is not bound to anything"))
886 (define-key global-map [menu] 'execute-extended-command)
887 (define-key global-map [find] 'search-forward)
889 ;; Don't do this. We define <delete> in function-key-map instead.
890 ;(define-key global-map [delete] 'backward-delete-char)
892 ;; natural bindings for terminal keycaps --- defined in X keysym order
893 (define-key global-map [C-S-backspace] 'kill-whole-line)
894 (define-key global-map [home] 'move-beginning-of-line)
895 (define-key global-map [C-home] 'beginning-of-buffer)
896 (define-key global-map [M-home] 'beginning-of-buffer-other-window)
897 (define-key esc-map [home] 'beginning-of-buffer-other-window)
898 (define-key global-map [left] 'left-char)
899 (define-key global-map [up] 'previous-line)
900 (define-key global-map [right] 'right-char)
901 (define-key global-map [down] 'next-line)
902 (define-key global-map [prior] 'scroll-down-command)
903 (define-key global-map [next] 'scroll-up-command)
904 (define-key global-map [C-up] 'backward-paragraph)
905 (define-key global-map [C-down] 'forward-paragraph)
906 (define-key global-map [C-prior] 'scroll-right)
907 (put 'scroll-left 'disabled t)
908 (define-key global-map [C-next] 'scroll-left)
909 (define-key global-map [M-next] 'scroll-other-window)
910 (define-key esc-map [next] 'scroll-other-window)
911 (define-key global-map [M-prior] 'scroll-other-window-down)
912 (define-key esc-map [prior] 'scroll-other-window-down)
913 (define-key esc-map [?\C-\S-v] 'scroll-other-window-down)
914 (define-key global-map [end] 'move-end-of-line)
915 (define-key global-map [C-end] 'end-of-buffer)
916 (define-key global-map [M-end] 'end-of-buffer-other-window)
917 (define-key esc-map [end] 'end-of-buffer-other-window)
918 (define-key global-map [begin] 'beginning-of-buffer)
919 (define-key global-map [M-begin] 'beginning-of-buffer-other-window)
920 (define-key esc-map [begin] 'beginning-of-buffer-other-window)
921 ;; (define-key global-map [select] 'function-key-error)
922 ;; (define-key global-map [print] 'function-key-error)
923 (define-key global-map [execute] 'execute-extended-command)
924 (define-key global-map [insert] 'overwrite-mode)
925 (define-key global-map [C-insert] 'kill-ring-save)
926 (define-key global-map [S-insert] 'yank)
927 ;; `insertchar' is what term.c produces. Should we change term.c
928 ;; to produce `insert' instead?
929 (define-key global-map [insertchar] 'overwrite-mode)
930 (define-key global-map [C-insertchar] 'kill-ring-save)
931 (define-key global-map [S-insertchar] 'yank)
932 (define-key global-map [undo] 'undo)
933 (define-key global-map [redo] 'repeat-complex-command)
934 (define-key global-map [again] 'repeat-complex-command) ; Sun keyboard
935 (define-key global-map [open] 'find-file) ; Sun
936 ;; The following wouldn't work to interrupt running code since C-g is
937 ;; treated specially in the event loop.
938 ;; (define-key global-map [stop] 'keyboard-quit) ; Sun
939 ;; (define-key global-map [clearline] 'function-key-error)
940 (define-key global-map [insertline] 'open-line)
941 (define-key global-map [deleteline] 'kill-line)
942 (define-key global-map [deletechar] 'delete-forward-char)
943 ;; (define-key global-map [backtab] 'function-key-error)
944 ;; (define-key global-map [f1] 'function-key-error)
945 ;; (define-key global-map [f2] 'function-key-error)
946 ;; (define-key global-map [f3] 'function-key-error)
947 ;; (define-key global-map [f4] 'function-key-error)
948 ;; (define-key global-map [f5] 'function-key-error)
949 ;; (define-key global-map [f6] 'function-key-error)
950 ;; (define-key global-map [f7] 'function-key-error)
951 ;; (define-key global-map [f8] 'function-key-error)
952 ;; (define-key global-map [f9] 'function-key-error)
953 ;; (define-key global-map [f10] 'function-key-error)
954 ;; (define-key global-map [f11] 'function-key-error)
955 ;; (define-key global-map [f12] 'function-key-error)
956 ;; (define-key global-map [f13] 'function-key-error)
957 ;; (define-key global-map [f14] 'function-key-error)
958 ;; (define-key global-map [f15] 'function-key-error)
959 ;; (define-key global-map [f16] 'function-key-error)
960 ;; (define-key global-map [f17] 'function-key-error)
961 ;; (define-key global-map [f18] 'function-key-error)
962 ;; (define-key global-map [f19] 'function-key-error)
963 ;; (define-key global-map [f20] 'function-key-error)
964 ;; (define-key global-map [f21] 'function-key-error)
965 ;; (define-key global-map [f22] 'function-key-error)
966 ;; (define-key global-map [f23] 'function-key-error)
967 ;; (define-key global-map [f24] 'function-key-error)
968 ;; (define-key global-map [f25] 'function-key-error)
969 ;; (define-key global-map [f26] 'function-key-error)
970 ;; (define-key global-map [f27] 'function-key-error)
971 ;; (define-key global-map [f28] 'function-key-error)
972 ;; (define-key global-map [f29] 'function-key-error)
973 ;; (define-key global-map [f30] 'function-key-error)
974 ;; (define-key global-map [f31] 'function-key-error)
975 ;; (define-key global-map [f32] 'function-key-error)
976 ;; (define-key global-map [f33] 'function-key-error)
977 ;; (define-key global-map [f34] 'function-key-error)
978 ;; (define-key global-map [f35] 'function-key-error)
979 ;; (define-key global-map [kp-backtab] 'function-key-error)
980 ;; (define-key global-map [kp-space] 'function-key-error)
981 ;; (define-key global-map [kp-tab] 'function-key-error)
982 ;; (define-key global-map [kp-enter] 'function-key-error)
983 ;; (define-key global-map [kp-f1] 'function-key-error)
984 ;; (define-key global-map [kp-f2] 'function-key-error)
985 ;; (define-key global-map [kp-f3] 'function-key-error)
986 ;; (define-key global-map [kp-f4] 'function-key-error)
987 ;; (define-key global-map [kp-multiply] 'function-key-error)
988 ;; (define-key global-map [kp-add] 'function-key-error)
989 ;; (define-key global-map [kp-separator] 'function-key-error)
990 ;; (define-key global-map [kp-subtract] 'function-key-error)
991 ;; (define-key global-map [kp-decimal] 'function-key-error)
992 ;; (define-key global-map [kp-divide] 'function-key-error)
993 ;; (define-key global-map [kp-0] 'function-key-error)
994 ;; (define-key global-map [kp-1] 'function-key-error)
995 ;; (define-key global-map [kp-2] 'function-key-error)
996 ;; (define-key global-map [kp-3] 'function-key-error)
997 ;; (define-key global-map [kp-4] 'function-key-error)
998 ;; (define-key global-map [kp-5] 'recenter)
999 ;; (define-key global-map [kp-6] 'function-key-error)
1000 ;; (define-key global-map [kp-7] 'function-key-error)
1001 ;; (define-key global-map [kp-8] 'function-key-error)
1002 ;; (define-key global-map [kp-9] 'function-key-error)
1003 ;; (define-key global-map [kp-equal] 'function-key-error)
1005 ;; X11R6 distinguishes these keys from the non-kp keys.
1006 ;; Make them behave like the non-kp keys unless otherwise bound.
1007 ;; FIXME: rather than list such mappings for every modifier-combination,
1008 ;; we should come up with a way to do it generically, something like
1009 ;; (define-key function-key-map [*-kp-home] [*-home])
1010 (define-key function-key-map [kp-home] [home])
1011 (define-key function-key-map [kp-left] [left])
1012 (define-key function-key-map [kp-up] [up])
1013 (define-key function-key-map [kp-right] [right])
1014 (define-key function-key-map [kp-down] [down])
1015 (define-key function-key-map [kp-prior] [prior])
1016 (define-key function-key-map [kp-next] [next])
1017 (define-key function-key-map [M-kp-next] [M-next])
1018 (define-key function-key-map [kp-end] [end])
1019 (define-key function-key-map [kp-begin] [begin])
1020 (define-key function-key-map [kp-insert] [insert])
1021 (define-key function-key-map [backspace] [?\C-?])
1022 (define-key function-key-map [delete] [?\C-?])
1023 (define-key function-key-map [kp-delete] [?\C-?])
1024 (define-key function-key-map [S-kp-end] [S-end])
1025 (define-key function-key-map [S-kp-down] [S-down])
1026 (define-key function-key-map [S-kp-next] [S-next])
1027 (define-key function-key-map [S-kp-left] [S-left])
1028 (define-key function-key-map [S-kp-right] [S-right])
1029 (define-key function-key-map [S-kp-home] [S-home])
1030 (define-key function-key-map [S-kp-up] [S-up])
1031 (define-key function-key-map [S-kp-prior] [S-prior])
1032 (define-key function-key-map [C-S-kp-end] [C-S-end])
1033 (define-key function-key-map [C-S-kp-down] [C-S-down])
1034 (define-key function-key-map [C-S-kp-next] [C-S-next])
1035 (define-key function-key-map [C-S-kp-left] [C-S-left])
1036 (define-key function-key-map [C-S-kp-right] [C-S-right])
1037 (define-key function-key-map [C-S-kp-home] [C-S-home])
1038 (define-key function-key-map [C-S-kp-up] [C-S-up])
1039 (define-key function-key-map [C-S-kp-prior] [C-S-prior])
1040 ;; Don't bind shifted keypad numeric keys, they reportedly
1041 ;; interfere with the feature of some keyboards to produce
1042 ;; numbers when NumLock is off.
1043 ;(define-key function-key-map [S-kp-1] [S-end])
1044 ;(define-key function-key-map [S-kp-2] [S-down])
1045 ;(define-key function-key-map [S-kp-3] [S-next])
1046 ;(define-key function-key-map [S-kp-4] [S-left])
1047 ;(define-key function-key-map [S-kp-6] [S-right])
1048 ;(define-key function-key-map [S-kp-7] [S-home])
1049 ;(define-key function-key-map [S-kp-8] [S-up])
1050 ;(define-key function-key-map [S-kp-9] [S-prior])
1051 (define-key function-key-map [C-S-kp-1] [C-S-end])
1052 (define-key function-key-map [C-S-kp-2] [C-S-down])
1053 (define-key function-key-map [C-S-kp-3] [C-S-next])
1054 (define-key function-key-map [C-S-kp-4] [C-S-left])
1055 (define-key function-key-map [C-S-kp-6] [C-S-right])
1056 (define-key function-key-map [C-S-kp-7] [C-S-home])
1057 (define-key function-key-map [C-S-kp-8] [C-S-up])
1058 (define-key function-key-map [C-S-kp-9] [C-S-prior])
1060 ;; Hitting C-SPC on text terminals, usually sends the ascii code 0 (aka C-@),
1061 ;; so we can't distinguish those two keys, but usually we consider C-SPC
1062 ;; (rather than C-@) as the "canonical" binding.
1063 (define-key function-key-map [?\C-@] [?\C-\s])
1064 ;; Many keyboards don't have a `backtab' key, so by convention the user
1065 ;; can use S-tab instead to access that binding.
1066 (define-key function-key-map [S-tab] [backtab])
1068 (define-key global-map [mouse-movement] 'ignore)
1070 (define-key global-map "\C-t" 'transpose-chars)
1071 (define-key esc-map "t" 'transpose-words)
1072 (define-key esc-map "\C-t" 'transpose-sexps)
1073 (define-key ctl-x-map "\C-t" 'transpose-lines)
1075 (define-key esc-map ";" 'comment-dwim)
1076 (define-key esc-map "j" 'indent-new-comment-line)
1077 (define-key esc-map "\C-j" 'indent-new-comment-line)
1078 (define-key ctl-x-map ";" 'comment-set-column)
1079 (define-key ctl-x-map "f" 'set-fill-column)
1080 (define-key ctl-x-map "$" 'set-selective-display)
1082 (define-key esc-map "@" 'mark-word)
1083 (define-key esc-map "f" 'forward-word)
1084 (define-key esc-map "b" 'backward-word)
1085 (define-key esc-map "d" 'kill-word)
1086 (define-key esc-map "\177" 'backward-kill-word)
1088 (define-key esc-map "<" 'beginning-of-buffer)
1089 (define-key esc-map ">" 'end-of-buffer)
1090 (define-key ctl-x-map "h" 'mark-whole-buffer)
1091 (define-key esc-map "\\" 'delete-horizontal-space)
1093 (defalias 'mode-specific-command-prefix (make-sparse-keymap))
1094 (defvar mode-specific-map (symbol-function 'mode-specific-command-prefix)
1095 "Keymap for characters following C-c.")
1096 (define-key global-map "\C-c" 'mode-specific-command-prefix)
1098 (global-set-key [M-right] 'right-word)
1099 (define-key esc-map [right] 'forward-word)
1100 (global-set-key [M-left] 'left-word)
1101 (define-key esc-map [left] 'backward-word)
1102 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
1103 (global-set-key [C-right] 'right-word)
1104 (global-set-key [C-left] 'left-word)
1105 ;; This is not quite compatible, but at least is analogous
1106 (global-set-key [C-delete] 'kill-word)
1107 (global-set-key [C-backspace] 'backward-kill-word)
1108 ;; This is "move to the clipboard", or as close as we come.
1109 (global-set-key [S-delete] 'kill-region)
1111 (global-set-key [C-M-left] 'backward-sexp)
1112 (define-key esc-map [C-left] 'backward-sexp)
1113 (global-set-key [C-M-right] 'forward-sexp)
1114 (define-key esc-map [C-right] 'forward-sexp)
1115 (global-set-key [C-M-up] 'backward-up-list)
1116 (define-key esc-map [C-up] 'backward-up-list)
1117 (global-set-key [C-M-down] 'down-list)
1118 (define-key esc-map [C-down] 'down-list)
1119 (global-set-key [C-M-home] 'beginning-of-defun)
1120 (define-key esc-map [C-home] 'beginning-of-defun)
1121 (global-set-key [C-M-end] 'end-of-defun)
1122 (define-key esc-map [C-end] 'end-of-defun)
1124 (define-key esc-map "\C-f" 'forward-sexp)
1125 (define-key esc-map "\C-b" 'backward-sexp)
1126 (define-key esc-map "\C-u" 'backward-up-list)
1127 (define-key esc-map "\C-@" 'mark-sexp)
1128 (define-key esc-map [?\C-\ ] 'mark-sexp)
1129 (define-key esc-map "\C-d" 'down-list)
1130 (define-key esc-map "\C-k" 'kill-sexp)
1131 ;;; These are dangerous in various situations,
1132 ;;; so let's not encourage anyone to use them.
1133 ;;;(define-key global-map [C-M-delete] 'backward-kill-sexp)
1134 ;;;(define-key global-map [C-M-backspace] 'backward-kill-sexp)
1135 (define-key esc-map [C-delete] 'backward-kill-sexp)
1136 (define-key esc-map [C-backspace] 'backward-kill-sexp)
1137 (define-key esc-map "\C-n" 'forward-list)
1138 (define-key esc-map "\C-p" 'backward-list)
1139 (define-key esc-map "\C-a" 'beginning-of-defun)
1140 (define-key esc-map "\C-e" 'end-of-defun)
1141 (define-key esc-map "\C-h" 'mark-defun)
1142 (define-key ctl-x-map "nd" 'narrow-to-defun)
1143 (define-key esc-map "(" 'insert-parentheses)
1144 (define-key esc-map ")" 'move-past-close-and-reindent)
1146 (define-key ctl-x-map "\C-e" 'eval-last-sexp)
1148 (define-key ctl-x-map "m" 'compose-mail)
1149 (define-key ctl-x-4-map "m" 'compose-mail-other-window)
1150 (define-key ctl-x-5-map "m" 'compose-mail-other-frame)
1153 (defvar ctl-x-r-map (make-sparse-keymap)
1154 "Keymap for subcommands of C-x r.")
1155 (define-key ctl-x-map "r" ctl-x-r-map)
1157 (define-key esc-map "q" 'fill-paragraph)
1158 (define-key ctl-x-map "." 'set-fill-prefix)
1160 (define-key esc-map "{" 'backward-paragraph)
1161 (define-key esc-map "}" 'forward-paragraph)
1162 (define-key esc-map "h" 'mark-paragraph)
1163 (define-key esc-map "a" 'backward-sentence)
1164 (define-key esc-map "e" 'forward-sentence)
1165 (define-key esc-map "k" 'kill-sentence)
1166 (define-key ctl-x-map "\177" 'backward-kill-sentence)
1168 (define-key ctl-x-map "[" 'backward-page)
1169 (define-key ctl-x-map "]" 'forward-page)
1170 (define-key ctl-x-map "\C-p" 'mark-page)
1171 (define-key ctl-x-map "l" 'count-lines-page)
1172 (define-key ctl-x-map "np" 'narrow-to-page)
1173 ;; (define-key ctl-x-map "p" 'narrow-to-page)
1175 (defvar abbrev-map (make-sparse-keymap)
1176 "Keymap for abbrev commands.")
1177 (define-key ctl-x-map "a" abbrev-map)
1179 (define-key abbrev-map "l" 'add-mode-abbrev)
1180 (define-key abbrev-map "\C-a" 'add-mode-abbrev)
1181 (define-key abbrev-map "g" 'add-global-abbrev)
1182 (define-key abbrev-map "+" 'add-mode-abbrev)
1183 (define-key abbrev-map "ig" 'inverse-add-global-abbrev)
1184 (define-key abbrev-map "il" 'inverse-add-mode-abbrev)
1185 ;; (define-key abbrev-map "\C-h" 'inverse-add-global-abbrev)
1186 (define-key abbrev-map "-" 'inverse-add-global-abbrev)
1187 (define-key abbrev-map "e" 'expand-abbrev)
1188 (define-key abbrev-map "'" 'expand-abbrev)
1189 ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev)
1190 ;; (define-key ctl-x-map "\+" 'add-global-abbrev)
1191 ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev)
1192 ;; (define-key ctl-x-map "\-" 'inverse-add-global-abbrev)
1193 (define-key esc-map "'" 'abbrev-prefix-mark)
1194 (define-key ctl-x-map "'" 'expand-abbrev)
1195 (define-key ctl-x-map "\C-b" 'list-buffers)
1197 (define-key ctl-x-map "z" 'repeat)
1199 (define-key esc-map "\C-l" 'reposition-window)
1201 (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
1202 (define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window)
1204 ;; Signal handlers
1205 (define-key special-event-map [sigusr1] 'ignore)
1206 (define-key special-event-map [sigusr2] 'ignore)
1208 ;; Don't look for autoload cookies in this file.
1209 ;; Local Variables:
1210 ;; no-update-autoloads: t
1211 ;; End:
1213 ;;; bindings.el ends here