1 ;;; bindings.el --- define standard key bindings and some variables
3 ;; Copyright (C) 1985,86,87,92,93,94,95,96,99,2000, 2001
4 ;; Free Software Foundation, Inc.
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29 ;;; Special formatting conventions are used in this file!
31 ;;; a backslash-newline is used at the beginning of a documentation string
32 ;;; when that string should be stored in the file etc/DOCnnn, not in core.
34 ;;; Such strings read into Lisp as numbers (during the pure-loading phase).
36 ;;; But you must obey certain rules to make sure the string is understood
37 ;;; and goes into etc/DOCnnn properly.
39 ;;; The doc string must appear in the standard place in a call to
40 ;;; defun, autoload, defvar or defconst. No Lisp macros are recognized.
41 ;;; The open-paren starting the definition must appear in column 0.
43 ;;; In defvar and defconst, there is an additional rule:
44 ;;; The double-quote that starts the string must be on the same
45 ;;; line as the defvar or defconst.
46 ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50 (defun make-mode-line-mouse2-map (f) "\
51 Return a keymap with single entry for mouse-2 on mode line.
52 This is defined to run function F with no args in the buffer
53 corresponding to the mode line clicked."
54 (let ((map (make-sparse-keymap)))
55 (define-key map
[mode-line mouse-2
] f
)
59 (defun mode-line-toggle-read-only (event)
60 "Like `toggle-read-only', for the mode-line."
63 (select-window (posn-window (event-start event
)))
65 (force-mode-line-update)))
68 (defun mode-line-toggle-modified (event)
69 "Toggle the buffer-modified flag from the mode-line."
72 (select-window (posn-window (event-start event
)))
73 (set-buffer-modified-p (not (buffer-modified-p)))
74 (force-mode-line-update)))
77 (defun mode-line-widen (event)
78 "Widen a buffer from the mode-line."
81 (select-window (posn-window (event-start event
)))
83 (force-mode-line-update)))
86 (defun mode-line-abbrev-mode (event)
87 "Turn off `abbrev-mode' from the mode-line."
90 (select-window (posn-window (event-start event
)))
92 (force-mode-line-update)))
95 (defun mode-line-auto-fill-mode (event)
96 "Turn off `auto-fill-mode' from the mode-line."
99 (select-window (posn-window (event-start event
)))
101 (force-mode-line-update)))
104 (defvar mode-line-input-method-map
105 (let ((map (make-sparse-keymap)))
106 (define-key map
[mode-line mouse-2
]
109 (save-selected-window
111 (posn-window (event-start e
)))
112 (toggle-input-method)
113 (force-mode-line-update))))
114 (define-key map
[mode-line mouse-3
]
117 (save-selected-window
119 (posn-window (event-start e
)))
120 (describe-current-input-method))))
123 (defvar mode-line-mule-info
125 (current-input-method
128 '(propertize current-input-method-title
132 ". mouse-2 disables, mouse-3 describes")
133 'local-map mode-line-input-method-map
))))
137 (purecopy (lambda (window object point
)
138 (save-window-excursion
139 (select-window window
)
140 ;; Don't show this tip if the coding system is nil,
141 ;; it reads like a bug, and is not useful anyway.
142 (when buffer-file-coding-system
143 (if enable-multibyte-characters
144 (concat (symbol-name buffer-file-coding-system
)
145 " buffer; see M-x describe-coding-system")
147 (symbol-name buffer-file-coding-system
)
149 "Mode-line control for displaying information of multilingual environment.
150 Normally it displays current input method (if any activated) and
151 mnemonics of the following coding systems:
152 coding system for saving or writing the current buffer
153 coding system for keyboard input (if Emacs is running on terminal)
154 coding system for terminal output (if Emacs is running on terminal)"
156 ;;; coding system for decoding output of buffer process (if any)
157 ;;; coding system for encoding text to send to buffer process (if any)."
160 (make-variable-buffer-local 'mode-line-mule-info
)
162 (defvar mode-line-buffer-identification
(purecopy '("%12b")) "\
163 Mode-line control for identifying the buffer being displayed.
164 Its default value is (\"%12b\").
165 Major modes that edit things other than ordinary files may change this
166 \(e.g. Info, Dired,...)")
168 (make-variable-buffer-local 'mode-line-buffer-identification
)
170 (defvar mode-line-frame-identification
'("-%F "))
172 (defvar mode-line-process nil
"\
173 Mode-line control for displaying info on process status.
174 Normally nil in most modes, since there is no process to display.")
176 (make-variable-buffer-local 'mode-line-process
)
178 (defvar mode-line-modified
181 'help-echo
(purecopy (lambda (window object point
)
182 (format "%sead-only: mouse-2 toggles"
183 (save-selected-window
184 (select-window window
)
188 'local-map
(purecopy (make-mode-line-mouse2-map
189 #'mode-line-toggle-read-only
)))
192 'help-echo
(purecopy (lambda (window object point
)
193 (format "%sodified: mouse-2 toggles"
194 (save-selected-window
195 (select-window window
)
196 (if (buffer-modified-p)
199 'local-map
(purecopy (make-mode-line-mouse2-map
200 #'mode-line-toggle-modified
))))
201 "Mode-line control for displaying whether current buffer is modified.")
203 (make-variable-buffer-local 'mode-line-modified
)
205 (setq-default mode-line-format
207 ;; The multi-line message doesn't work terribly well on the
208 ;; bottom mode line... Better ideas?
210 ;;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
211 ;;; drag-mouse-1: resize, C-mouse-2: split horizontally"
212 "mouse-1: select window, mouse-2: delete others, mouse-3: delete ...")
213 (dashes (propertize "--" 'help-echo help-echo
)))
215 (propertize "-" 'help-echo help-echo
)
218 'mode-line-frame-identification
219 'mode-line-buffer-identification
220 (propertize " " 'help-echo help-echo
)
222 (propertize " %[(" 'help-echo help-echo
)
223 '(:eval
(mode-line-mode-name)) 'mode-line-process
'minor-mode-alist
224 (propertize "%n" 'help-echo
"mouse-2: widen"
225 'local-map
(make-mode-line-mouse2-map #'mode-line-widen
))
226 (propertize ")%]--" 'help-echo help-echo
)
227 `(which-func-mode ("" which-func-format
,dashes
))
228 `(line-number-mode ("L%l" ,dashes
))
229 `(column-number-mode ("C%c" ,dashes
))
230 (purecopy '(-3 .
"%p"))
231 (propertize "-%-" 'help-echo help-echo
))))
233 (defvar minor-mode-alist nil
"\
234 Alist saying how to show minor modes in the mode line.
235 Each element looks like (VARIABLE STRING);
236 STRING is included in the mode line iff VARIABLE's value is non-nil.
238 Actually, STRING need not be a string; any possible mode-line element
239 is okay. See `mode-line-format'.")
240 ;; Don't use purecopy here--some people want to change these strings.
241 (setq minor-mode-alist
244 (propertize " Abbrev"
246 "mouse-2: turn off Abbrev mode")
247 'local-map
(purecopy (make-mode-line-mouse2-map
248 #'mode-line-abbrev-mode
))))
249 '(overwrite-mode overwrite-mode
)
250 (list 'auto-fill-function
253 "mouse-2: turn off Autofill mode")
254 'local-map
(purecopy (make-mode-line-mouse2-map
255 #'mode-line-auto-fill-mode
))))
256 ;; not really a minor mode...
257 '(defining-kbd-macro " Def")))
259 (defvar mode-line-buffer-identification-keymap nil
"\
260 Keymap for what is displayed by `mode-line-buffer-identification'.")
262 (defvar mode-line-minor-mode-keymap nil
"\
263 Keymap for what is displayed by `mode-line-mode-name'.")
265 (defvar mode-line-mode-menu-keymap nil
"\
266 Keymap for mode operations menu in the mode line.")
268 (defun mode-line-unbury-buffer () "\
269 Switch to the last buffer in the buffer list that is not hidden."
271 (let ((list (reverse (buffer-list))))
272 (while (eq (aref (buffer-name (car list
)) 0) ?
)
273 (setq list
(cdr list
)))
274 (switch-to-buffer (car list
))))
276 (defun mode-line-other-buffer () "\
277 Switch to the most recently selected buffer other than the current one."
279 (switch-to-buffer (other-buffer)))
281 (defvar mode-line-mode-menu
(make-sparse-keymap "Minor Modes") "\
282 Menu of mode operations in the mode line.")
284 (defun mode-line-mode-menu-1 (event)
286 (save-selected-window
287 (select-window (posn-window (event-start event
)))
288 (let* ((selection (mode-line-mode-menu event
))
289 (binding (and selection
(lookup-key mode-line-mode-menu
290 (vector (car selection
))))))
292 (call-interactively binding
)))))
294 (defun mode-line-mode-name () "\
295 Return a string to display in the mode line for the current mode name."
296 (let (length (result mode-name
))
297 (let ((local-map (get-text-property 0 'local-map result
))
298 (help-echo (get-text-property 0 'help-echo result
)))
299 (setq result
(copy-sequence result
))
300 ;; Add `local-map' property if there isn't already one.
301 (when (and (null local-map
)
302 (null (next-single-property-change 0 'local-map result
)))
303 (put-text-property 0 (length result
)
304 'local-map mode-line-minor-mode-keymap result
))
305 ;; Add `help-echo' property if there isn't already one.
306 (when (and (null help-echo
)
307 (null (next-single-property-change 0 'help-echo result
)))
308 (put-text-property 0 (length result
)
309 'help-echo
"mouse-3: minor mode menu" result
)))
312 (defmacro bound-and-true-p
(var)
313 "Return the value of symbol VAR if it is bound, else nil."
314 `(and (boundp (quote ,var
)) ,var
))
316 (define-key mode-line-mode-menu
[overwrite-mode
]
317 `(menu-item ,(purecopy "Overwrite") overwrite-mode
318 :button
(:toggle . overwrite-mode
)))
319 (define-key mode-line-mode-menu
[outline-minor-mode
]
320 `(menu-item ,(purecopy "Outline") outline-minor-mode
321 :button
(:toggle .
(bound-and-true-p outline-minor-mode
))))
322 (define-key mode-line-mode-menu
[line-number-mode
]
323 `(menu-item ,(purecopy "Line number") line-number-mode
324 :button
(:toggle . line-number-mode
)))
325 (define-key mode-line-mode-menu
[highlight-changes-mode
]
326 `(menu-item ,(purecopy "Highlight changes") highlight-changes-mode
327 :button
(:toggle . highlight-changes-mode
)))
328 (define-key mode-line-mode-menu
[glasses-mode
]
329 `(menu-item ,(purecopy "Glasses") glasses-mode
330 :button
(:toggle .
(bound-and-true-p glasses-mode
))))
331 (define-key mode-line-mode-menu
[hide-ifdef-mode
]
332 `(menu-item ,(purecopy "Hide ifdef") hide-ifdef-mode
333 :button
(:toggle .
(bound-and-true-p hide-ifdef-mode
))))
334 (define-key mode-line-mode-menu
[font-lock-mode
]
335 `(menu-item ,(purecopy "Font-lock") font-lock-mode
336 :button
(:toggle . font-lock-mode
)))
337 (define-key mode-line-mode-menu
[flyspell-mode
]
338 `(menu-item ,(purecopy "Flyspell") flyspell-mode
339 :button
(:toggle .
(bound-and-true-p flyspell-mode
))))
340 (define-key mode-line-mode-menu
[column-number-mode
]
341 `(menu-item ,(purecopy "Column number") column-number-mode
342 :button
(:toggle . column-number-mode
)))
343 (define-key mode-line-mode-menu
[auto-fill-mode
]
344 `(menu-item ,(purecopy "Auto-fill") auto-fill-mode
345 :button
(:toggle . auto-fill-function
)))
346 (define-key mode-line-mode-menu
[auto-revert-mode
]
347 `(menu-item ,(purecopy "Auto revert") auto-revert-mode
348 :button
(:toggle . auto-revert-mode
)))
349 (define-key mode-line-mode-menu
[abbrev-mode
]
350 `(menu-item ,(purecopy "Abbrev") abbrev-mode
351 :button
(:toggle . abbrev-mode
)))
353 (defun mode-line-mode-menu (event)
355 (x-popup-menu event mode-line-mode-menu
))
357 ;; Add menu of buffer operations to the buffer identification part
359 (let ((map (make-sparse-keymap)))
360 (define-key map
[mode-line mouse-1
] 'mode-line-other-buffer
)
361 (define-key map
[header-line mouse-1
] 'mode-line-other-buffer
)
362 (define-key map
[mode-line M-mouse-2
] 'mode-line-unbury-buffer
)
363 (define-key map
[header-line M-mouse-2
] 'mode-line-unbury-buffer
)
364 (define-key map
[mode-line mouse-2
] 'bury-buffer
)
365 (define-key map
[header-line mouse-2
] 'bury-buffer
)
366 (define-key map
[mode-line down-mouse-3
] 'mouse-buffer-menu
)
367 (define-key map
[header-line down-mouse-3
] 'mouse-buffer-menu
)
368 (setq mode-line-buffer-identification-keymap map
))
370 (defun propertized-buffer-identification (fmt)
371 "Return a list suitable for `mode-line-buffer-identification'.
372 FMT is a format specifier such as \"%12b\". This function adds
373 text properties for face, help-echo, and local-map to it."
374 (list (propertize fmt
375 'face
'(:weight bold
)
376 'help-echo
(purecopy "mouse-1: other \
377 buffer, mouse-2: prev, M-mouse-2: next, mouse-3: buffer menu")
378 'local-map mode-line-buffer-identification-keymap
)))
380 (setq-default mode-line-buffer-identification
381 (propertized-buffer-identification "%12b"))
383 ;; Menu of minor modes.
384 (let ((map (make-sparse-keymap)))
385 (define-key map
[mode-line down-mouse-3
] 'mode-line-mode-menu-1
)
386 (define-key map
[header-line down-mouse-3
] 'mode-line-mode-menu-1
)
387 (setq mode-line-minor-mode-keymap map
))
389 ;; These variables are used by autoloadable packages.
390 ;; They are defined here so that they do not get overridden
391 ;; by the loading of those packages.
393 ;; Names in directory that end in one of these
394 ;; are ignored in completion,
395 ;; making it more likely you will get a unique match.
396 (setq completion-ignored-extensions
398 (cond ((or (eq system-type
'ms-dos
) (eq system-type
'windows-nt
))
399 '(".o" "~" ".bin" ".bak" ".obj" ".map"
400 ".a" ".ln" ".blg" ".bbl"))
401 ((eq system-type
'vax-vms
)
402 '(".obj" ".exe" ".bin" ".lbin" ".sbin"
403 ".brn" ".rnt" ".mem" ".lni" ".lis"
404 ".olb" ".tlb" ".mlb" ".hlb"))
406 '(".o" "~" ".bin" ".lbin" ".fasl" ".ufsl"
407 ".a" ".ln" ".blg" ".bbl")))
411 ".dvi" ".fmt" ".tfm" ".pdf"
422 ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
423 ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs")))
425 ;; Packages should add to this list appropriately when they are
426 ;; loaded, rather than listing everything here.
427 (setq debug-ignored-errors
428 '(beginning-of-line beginning-of-buffer end-of-line
429 end-of-buffer end-of-file buffer-read-only
431 "^Previous command was not a yank$"
432 "^Minibuffer window is not active$"
433 "^End of history; no next item$"
434 "^Beginning of history; no preceding item$"
435 "^No recursive edit is in progress$"
436 "^Changes to be undone are outside visible portion of buffer$"
437 "^No undo information in this buffer$"
438 "^No further undo information$"
439 "^Save not confirmed$"
440 "^Recover-file cancelled\\.$"
441 "^Cannot switch buffers in a dedicated window$"
444 "^Errors in diff output. Diff output is in "
445 "^Hmm... I don't see an Ediff command around here...$"
446 "^Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer$"
447 ": This command runs in Ediff Control Buffer only!$"
448 ": Invalid op in ediff-check-version$"
449 "^ediff-shrink-window-C can be used only for merging jobs$"
450 "^Lost difference info on these directories$"
451 "^This command is inapplicable in the present context$"
452 "^This session group has no parent$"
453 "^Can't hide active session, $"
454 "^Ediff: something wrong--no multiple diffs buffer$"
455 "^Can't make context diff for Session $"
456 "^The patch buffer wasn't found$"
458 "^This Ediff session is not part of a session group$"
459 "^No active Ediff sessions or corrupted session registry$"
460 "^No session info in this line$"
461 "^`.*' is not an ordinary file$"
462 "^Patch appears to have failed$"
463 "^Recomputation of differences cancelled$"
464 "^No fine differences in this mode$"
465 "^Lost connection to ancestor buffer...sorry$"
466 "^Not merging with ancestor$"
467 "^Don't know how to toggle read-only in buffer "
468 "Emacs is not running as a window application$"
469 "^This command makes sense only when merging with an ancestor$"
470 "^At end of the difference list$"
471 "^At beginning of the difference list$"
472 "^Nothing saved for diff .* in buffer "
473 "^Buffer is out of sync for file "
474 "^Buffer out of sync for file "
475 "^Output from `diff' not found$"
476 "^You forgot to specify a region in buffer "
477 "^All right. Make up your mind and come back...$"
478 "^Current buffer is not visiting any file$"
479 "^Failed to retrieve revision: $"
480 "^Can't determine display width.$"
481 "^File `.*' does not exist or is not readable$"
482 "^File `.*' is a directory$"
483 "^Buffer .* doesn't exist$"
484 "^Directories . and . are the same: "
485 "^Directory merge aborted$"
486 "^Merge of directory revisions aborted$"
487 "^Buffer .* doesn't exist$"
488 "^There is no file to merge$"
489 "^Version control package .*.el not found. Use vc.el instead$"))
492 (make-variable-buffer-local 'indent-tabs-mode
)
494 ;; We have base64 and md5 functions built in now.
495 (add-to-list 'features
'base64
)
496 (add-to-list 'features
'md5
)
497 (add-to-list 'features
'overlay
)
499 (define-key esc-map
"\t" 'complete-symbol
)
501 (defun complete-symbol (arg) "\
502 Perform tags completion on the text around point.
503 Completes to the set of names listed in the current tags table.
504 The string to complete is chosen in the same way as the default
505 for \\[find-tag] (which see).
507 With a prefix argument, this command does completion within
508 the collection of symbols listed in the index of the manual for the
509 language you are using."
512 (info-complete-symbol)
513 (if (fboundp 'complete-tag
)
515 ;; Don't autoload etags if we have no tags table.
516 (error (substitute-command-keys
517 "No tags table loaded; use \\[visit-tags-table] to load one")))))
519 ;; Reduce total amount of space we must allocate during this function
520 ;; that we will not need to keep permanently.
523 ;; Make all multibyte characters self-insert.
524 (let ((l (generic-character-list))
525 (table (nth 1 global-map
)))
527 (set-char-table-default table
(car l
) 'self-insert-command
)
530 (setq help-event-list
'(help f1
))
532 (make-variable-buffer-local 'minor-mode-overriding-map-alist
)
534 ;These commands are defined in editfns.c
535 ;but they are not assigned to keys there.
536 (put 'narrow-to-region
'disabled t
)
537 (define-key ctl-x-map
"nn" 'narrow-to-region
)
538 (define-key ctl-x-map
"nw" 'widen
)
539 ;; (define-key ctl-x-map "n" 'narrow-to-region)
540 ;; (define-key ctl-x-map "w" 'widen)
542 (define-key global-map
"\C-j" 'newline-and-indent
)
543 (define-key global-map
"\C-m" 'newline
)
544 (define-key global-map
"\C-o" 'open-line
)
545 (define-key esc-map
"\C-o" 'split-line
)
546 (define-key global-map
"\C-q" 'quoted-insert
)
547 (define-key esc-map
"^" 'delete-indentation
)
548 (define-key esc-map
"\\" 'delete-horizontal-space
)
549 (define-key esc-map
"m" 'back-to-indentation
)
550 (define-key ctl-x-map
"\C-o" 'delete-blank-lines
)
551 (define-key esc-map
" " 'just-one-space
)
552 (define-key esc-map
"z" 'zap-to-char
)
553 (define-key esc-map
"=" 'count-lines-region
)
554 (define-key ctl-x-map
"=" 'what-cursor-position
)
555 (define-key esc-map
":" 'eval-expression
)
556 ;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
557 (define-key esc-map
"\M-:" 'eval-expression
)
558 ;; Changed from C-x ESC so that function keys work following C-x.
559 (define-key ctl-x-map
"\e\e" 'repeat-complex-command
)
560 ;; New binding analogous to M-:.
561 (define-key ctl-x-map
"\M-:" 'repeat-complex-command
)
562 (define-key ctl-x-map
"u" 'advertised-undo
)
563 ;; Many people are used to typing C-/ on X terminals and getting C-_.
564 (define-key global-map
[?\C-
/] 'undo
)
565 (define-key global-map
"\C-_" 'undo
)
566 (define-key esc-map
"!" 'shell-command
)
567 (define-key esc-map
"|" 'shell-command-on-region
)
569 ;; This is an experiment--make up and down arrows do history.
570 (define-key minibuffer-local-map
[up] 'previous-history-element)
571 (define-key minibuffer-local-map [down] 'next-history-element)
572 (define-key minibuffer-local-ns-map [up] 'previous-history-element
)
573 (define-key minibuffer-local-ns-map
[down] 'next-history-element)
574 (define-key minibuffer-local-completion-map [up] 'previous-history-element)
575 (define-key minibuffer-local-completion-map [down] 'next-history-element
)
576 (define-key minibuffer-local-must-match-map
[up] 'previous-history-element)
577 (define-key minibuffer-local-must-match-map [down] 'next-history-element)
579 (define-key global-map "\C-u" 'universal-argument)
582 (define-key esc-map (char-to-string i) 'digit-argument)
584 (define-key esc-map "-" 'negative-argument)
585 ;; Define control-digits.
588 (define-key global-map (read (format "[?\\C-%c]" i)) 'digit-argument)
590 (define-key global-map [?\C--] 'negative-argument)
591 ;; Define control-meta-digits.
594 (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
596 (define-key global-map [?\C-\M--] 'negative-argument)
598 (define-key global-map "\C-k" 'kill-line)
599 (define-key global-map "\C-w" 'kill-region)
600 (define-key esc-map "w" 'kill-ring-save)
601 (define-key esc-map "\C-w" 'append-next-kill)
602 (define-key global-map "\C-y" 'yank)
603 (define-key esc-map "y" 'yank-pop)
605 ;; (define-key ctl-x-map "a" 'append-to-buffer)
607 (define-key global-map "\C-@" 'set-mark-command)
608 ;; Many people are used to typing C-SPC and getting C-@.
609 (define-key global-map [?\C- ] 'set-mark-command)
610 (define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
611 (define-key ctl-x-map "\C-@" 'pop-global-mark)
612 (define-key ctl-x-map [?\C- ] 'pop-global-mark)
614 (define-key global-map "\C-n" 'next-line)
615 (define-key global-map "\C-p" 'previous-line)
616 (define-key ctl-x-map "\C-n" 'set-goal-column)
618 ;;(defun function-key-error ()
620 ;; (error "That function key is not bound to anything"))
622 (define-key global-map [menu] 'execute-extended-command)
623 (define-key global-map [find] 'search-forward)
625 ;; Don't do this. We define <delete> in function-key-map instead.
626 ;(define-key global-map [delete] 'backward-delete-char)
628 ;; natural bindings for terminal keycaps --- defined in X keysym order
629 (define-key global-map [home] 'beginning-of-line)
630 (define-key global-map [C-home] 'beginning-of-buffer)
631 (define-key global-map [M-home] 'beginning-of-buffer-other-window)
632 (define-key global-map [left] 'backward-char)
633 (define-key global-map [up] 'previous-line
)
634 (define-key global-map
[right] 'forward-char)
635 (define-key global-map [down] 'next-line)
636 (define-key global-map [prior] 'scroll-down)
637 (define-key global-map [next] 'scroll-up)
638 (define-key global-map [C-up] 'backward-paragraph)
639 (define-key global-map [C-down] 'forward-paragraph)
640 (define-key global-map [C-prior] 'scroll-right)
641 (define-key global-map [C-next] 'scroll-left)
642 (define-key global-map [M-next] 'scroll-other-window)
643 (define-key global-map [M-prior] 'scroll-other-window-down)
644 (define-key global-map [end] 'end-of-line)
645 (define-key global-map [C-end] 'end-of-buffer)
646 (define-key global-map [M-end] 'end-of-buffer-other-window)
647 (define-key global-map [begin] 'beginning-of-buffer)
648 (define-key global-map [M-begin] 'beginning-of-buffer-other-window)
649 ;; (define-key global-map [select] 'function-key-error)
650 ;; (define-key global-map [print] 'function-key-error)
651 (define-key global-map [execute] 'execute-extended-command)
652 (define-key global-map [insert] 'overwrite-mode)
653 (define-key global-map [C-insert] 'kill-ring-save)
654 (define-key global-map [S-insert] 'yank)
655 (define-key global-map [undo] 'undo)
656 (define-key global-map [redo] 'repeat-complex-command)
657 ;; (define-key global-map [clearline] 'function-key-error)
658 (define-key global-map [insertline] 'open-line)
659 (define-key global-map [deleteline] 'kill-line)
660 ;; (define-key global-map [insertchar] 'function-key-error)
661 (define-key global-map [deletechar] 'delete-char)
662 ;; (define-key global-map [backtab] 'function-key-error)
663 ;; (define-key global-map [f1] 'function-key-error)
664 ;; (define-key global-map [f2] 'function-key-error)
665 ;; (define-key global-map [f3] 'function-key-error)
666 ;; (define-key global-map [f4] 'function-key-error)
667 ;; (define-key global-map [f5] 'function-key-error)
668 ;; (define-key global-map [f6] 'function-key-error)
669 ;; (define-key global-map [f7] 'function-key-error)
670 ;; (define-key global-map [f8] 'function-key-error)
671 ;; (define-key global-map [f9] 'function-key-error)
672 ;; (define-key global-map [f10] 'function-key-error)
673 ;; (define-key global-map [f11] 'function-key-error)
674 ;; (define-key global-map [f12] 'function-key-error)
675 ;; (define-key global-map [f13] 'function-key-error)
676 ;; (define-key global-map [f14] 'function-key-error)
677 ;; (define-key global-map [f15] 'function-key-error)
678 ;; (define-key global-map [f16] 'function-key-error)
679 ;; (define-key global-map [f17] 'function-key-error)
680 ;; (define-key global-map [f18] 'function-key-error)
681 ;; (define-key global-map [f19] 'function-key-error)
682 ;; (define-key global-map [f20] 'function-key-error)
683 ;; (define-key global-map [f21] 'function-key-error)
684 ;; (define-key global-map [f22] 'function-key-error)
685 ;; (define-key global-map [f23] 'function-key-error)
686 ;; (define-key global-map [f24] 'function-key-error)
687 ;; (define-key global-map [f25] 'function-key-error)
688 ;; (define-key global-map [f26] 'function-key-error)
689 ;; (define-key global-map [f27] 'function-key-error)
690 ;; (define-key global-map [f28] 'function-key-error)
691 ;; (define-key global-map [f29] 'function-key-error)
692 ;; (define-key global-map [f30] 'function-key-error)
693 ;; (define-key global-map [f31] 'function-key-error)
694 ;; (define-key global-map [f32] 'function-key-error)
695 ;; (define-key global-map [f33] 'function-key-error)
696 ;; (define-key global-map [f34] 'function-key-error)
697 ;; (define-key global-map [f35] 'function-key-error)
698 ;; (define-key global-map [kp-backtab] 'function-key-error)
699 ;; (define-key global-map [kp-space] 'function-key-error)
700 ;; (define-key global-map [kp-tab] 'function-key-error)
701 ;; (define-key global-map [kp-enter] 'function-key-error)
702 ;; (define-key global-map [kp-f1] 'function-key-error)
703 ;; (define-key global-map [kp-f2] 'function-key-error)
704 ;; (define-key global-map [kp-f3] 'function-key-error)
705 ;; (define-key global-map [kp-f4] 'function-key-error)
706 ;; (define-key global-map [kp-multiply] 'function-key-error)
707 ;; (define-key global-map [kp-add] 'function-key-error)
708 ;; (define-key global-map [kp-separator] 'function-key-error)
709 ;; (define-key global-map [kp-subtract] 'function-key-error)
710 ;; (define-key global-map [kp-decimal] 'function-key-error)
711 ;; (define-key global-map [kp-divide] 'function-key-error)
712 ;; (define-key global-map [kp-0] 'function-key-error)
713 ;; (define-key global-map [kp-1] 'function-key-error)
714 ;; (define-key global-map [kp-2] 'function-key-error)
715 ;; (define-key global-map [kp-3] 'function-key-error)
716 ;; (define-key global-map [kp-4] 'function-key-error)
717 ;; (define-key global-map [kp-5] 'recenter)
718 ;; (define-key global-map [kp-6] 'function-key-error)
719 ;; (define-key global-map [kp-7] 'function-key-error)
720 ;; (define-key global-map [kp-8] 'function-key-error)
721 ;; (define-key global-map [kp-9] 'function-key-error)
722 ;; (define-key global-map [kp-equal] 'function-key-error)
724 ;; X11R6 distinguishes these keys from the non-kp keys.
725 ;; Make them behave like the non-kp keys unless otherwise bound.
726 (define-key function-key-map [kp-home] [home])
727 (define-key function-key-map [kp-left] [left])
728 (define-key function-key-map [kp-up] [up])
729 (define-key function-key-map [kp-right] [right])
730 (define-key function-key-map
[kp-down
] [down])
731 (define-key function-key-map [kp-prior] [prior])
732 (define-key function-key-map [kp-next] [next])
733 (define-key function-key-map [M-kp-next] [M-next])
734 (define-key function-key-map [kp-end] [end])
735 (define-key function-key-map [kp-begin] [begin])
736 (define-key function-key-map [kp-insert] [insert])
737 (define-key function-key-map [backspace] [?\C-?])
738 (define-key function-key-map [delete] [?\C-?])
739 (define-key function-key-map [kp-delete] [?\C-?])
741 (define-key global-map [mouse-movement] 'ignore)
743 (define-key global-map "\C-t" 'transpose-chars)
744 (define-key esc-map "t" 'transpose-words)
745 (define-key esc-map "\C-t" 'transpose-sexps)
746 (define-key ctl-x-map "\C-t" 'transpose-lines)
748 (define-key esc-map ";" 'comment-dwim)
749 (define-key esc-map "j" 'comment-indent-new-line)
750 (define-key esc-map "\C-j" 'comment-indent-new-line)
751 (define-key ctl-x-map ";" 'comment-set-column)
752 (define-key ctl-x-map "f" 'set-fill-column)
753 (define-key ctl-x-map "$" 'set-selective-display)
755 (define-key esc-map "@" 'mark-word)
756 (define-key esc-map "f" 'forward-word)
757 (define-key esc-map "b" 'backward-word)
758 (define-key esc-map "d" 'kill-word)
759 (define-key esc-map "\177" 'backward-kill-word)
761 (define-key esc-map "<" 'beginning-of-buffer)
762 (define-key esc-map ">" 'end-of-buffer)
763 (define-key ctl-x-map "h" 'mark-whole-buffer)
764 (define-key esc-map "\\" 'delete-horizontal-space)
766 (defalias 'mode-specific-command-prefix (make-sparse-keymap))
767 (defvar mode-specific-map (symbol-function 'mode-specific-command-prefix)
768 "Keymap for characters following C-c.")
769 (define-key global-map "\C-c" 'mode-specific-command-prefix)
771 (global-set-key [M-right] 'forward-word)
772 (global-set-key [M-left] 'backward-word)
773 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
774 (global-set-key [C-right] 'forward-word)
775 (global-set-key [C-left] 'backward-word)
776 ;; This is not quite compatible, but at least is analogous
777 (global-set-key [C-delete] 'backward-kill-word)
778 (global-set-key [C-backspace] 'kill-word)
779 ;; This is "move to the clipboard", or as close as we come.
780 (global-set-key [S-delete] 'kill-region)
782 (define-key esc-map "\C-f" 'forward-sexp)
783 (define-key esc-map "\C-b" 'backward-sexp)
784 (define-key esc-map "\C-u" 'backward-up-list)
785 (define-key esc-map "\C-@" 'mark-sexp)
786 (define-key esc-map [?\C-\ ] 'mark-sexp)
787 (define-key esc-map "\C-d" 'down-list)
788 (define-key esc-map "\C-k" 'kill-sexp)
789 (define-key global-map [C-M-delete] 'backward-kill-sexp)
790 (define-key global-map [C-M-backspace] 'backward-kill-sexp)
791 (define-key esc-map [C-delete] 'backward-kill-sexp)
792 (define-key esc-map [C-backspace] 'backward-kill-sexp)
793 (define-key esc-map "\C-n" 'forward-list)
794 (define-key esc-map "\C-p" 'backward-list)
795 (define-key esc-map "\C-a" 'beginning-of-defun)
796 (define-key esc-map "\C-e" 'end-of-defun)
797 (define-key esc-map "\C-h" 'mark-defun)
798 (define-key ctl-x-map "nd" 'narrow-to-defun)
799 (define-key esc-map "(" 'insert-parentheses)
800 (define-key esc-map ")" 'move-past-close-and-reindent)
802 (define-key ctl-x-map "\C-e" 'eval-last-sexp)
804 (define-key ctl-x-map "m" 'compose-mail)
805 (define-key ctl-x-4-map "m" 'compose-mail-other-window)
806 (define-key ctl-x-5-map "m" 'compose-mail-other-frame)
808 (define-key ctl-x-map "r\C-@" 'point-to-register)
809 (define-key ctl-x-map [?r ?\C-\ ] 'point-to-register)
810 (define-key ctl-x-map "r " 'point-to-register)
811 (define-key ctl-x-map "rj" 'jump-to-register)
812 (define-key ctl-x-map "rs" 'copy-to-register)
813 (define-key ctl-x-map "rx" 'copy-to-register)
814 (define-key ctl-x-map "ri" 'insert-register)
815 (define-key ctl-x-map "rg" 'insert-register)
816 (define-key ctl-x-map "rr" 'copy-rectangle-to-register)
817 (define-key ctl-x-map "rn" 'number-to-register)
818 (define-key ctl-x-map "r+" 'increment-register)
819 (define-key ctl-x-map "rc" 'clear-rectangle)
820 (define-key ctl-x-map "rk" 'kill-rectangle)
821 (define-key ctl-x-map "rd" 'delete-rectangle)
822 (define-key ctl-x-map "ry" 'yank-rectangle)
823 (define-key ctl-x-map "ro" 'open-rectangle)
824 (define-key ctl-x-map "rt" 'string-rectangle)
825 (define-key ctl-x-map "rw" 'window-configuration-to-register)
826 (define-key ctl-x-map "rf" 'frame-configuration-to-register)
828 ;; These key bindings are deprecated; use the above C-x r map instead.
829 ;; We use these aliases so \[...] will show the C-x r bindings instead.
830 (defalias 'point-to-register-compatibility-binding 'point-to-register)
831 (defalias 'jump-to-register-compatibility-binding 'jump-to-register)
832 (defalias 'copy-to-register-compatibility-binding 'copy-to-register)
833 (defalias 'insert-register-compatibility-binding 'insert-register)
834 (define-key ctl-x-map "/" 'point-to-register-compatibility-binding)
835 (define-key ctl-x-map "j" 'jump-to-register-compatibility-binding)
836 (define-key ctl-x-map "x" 'copy-to-register-compatibility-binding)
837 (define-key ctl-x-map "g" 'insert-register-compatibility-binding)
838 ;; (define-key ctl-x-map "r" 'copy-rectangle-to-register)
840 (define-key esc-map "q" 'fill-paragraph)
841 ;; (define-key esc-map "g" 'fill-region)
842 (define-key ctl-x-map "." 'set-fill-prefix)
844 (define-key esc-map "{" 'backward-paragraph)
845 (define-key esc-map "}" 'forward-paragraph)
846 (define-key esc-map "h" 'mark-paragraph)
847 (define-key esc-map "a" 'backward-sentence)
848 (define-key esc-map "e" 'forward-sentence)
849 (define-key esc-map "k" 'kill-sentence)
850 (define-key ctl-x-map "\177" 'backward-kill-sentence)
852 (define-key ctl-x-map "[" 'backward-page)
853 (define-key ctl-x-map "]" 'forward-page)
854 (define-key ctl-x-map "\C-p" 'mark-page)
855 (define-key ctl-x-map "l" 'count-lines-page)
856 (define-key ctl-x-map "np" 'narrow-to-page)
857 ;; (define-key ctl-x-map "p" 'narrow-to-page)
859 (define-key ctl-x-map "al" 'add-mode-abbrev)
860 (define-key ctl-x-map "a\C-a" 'add-mode-abbrev)
861 (define-key ctl-x-map "ag" 'add-global-abbrev)
862 (define-key ctl-x-map "a+" 'add-mode-abbrev)
863 (define-key ctl-x-map "aig" 'inverse-add-global-abbrev)
864 (define-key ctl-x-map "ail" 'inverse-add-mode-abbrev)
865 ;; (define-key ctl-x-map "a\C-h" 'inverse-add-global-abbrev)
866 (define-key ctl-x-map "a-" 'inverse-add-global-abbrev)
867 (define-key ctl-x-map "ae" 'expand-abbrev)
868 (define-key ctl-x-map "a'" 'expand-abbrev)
869 ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev)
870 ;; (define-key ctl-x-map "\+" 'add-global-abbrev)
871 ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev)
872 ;; (define-key ctl-x-map "\-" 'inverse-add-global-abbrev)
873 (define-key esc-map "'" 'abbrev-prefix-mark)
874 (define-key ctl-x-map "'" 'expand-abbrev)
876 (define-key ctl-x-map "z" 'repeat)
878 ;;; Don't compile this file; it contains no large function definitions.
879 ;;; Don't look for autoload cookies in this file.
881 ;;; no-byte-compile: t
882 ;;; no-update-autoloads: t
885 ;;; bindings.el ends here