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