1 ;;; bindings.el --- define standard key bindings and some variables.
3 ;; Copyright (C) 1985,86,87,92,93,94,95,96,99,2000
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
]
60 (posn-window (event-start e
)))
62 (force-mode-line-update))))
65 (defvar mode-line-input-method-map
66 (let ((map (make-sparse-keymap)))
67 (define-key map
[mode-line mouse-2
]
72 (posn-window (event-start e
)))
74 (force-mode-line-update))))
75 (define-key map
[mode-line mouse-3
]
80 (posn-window (event-start e
)))
81 (describe-current-input-method))))
84 (defvar mode-line-mule-info
89 '(propertize current-input-method-title
93 ". mouse-2 disables, mouse-3 describes")
94 'local-map mode-line-input-method-map
))))
98 (purecopy (lambda (window object point
)
99 (save-window-excursion
100 (select-window window
)
101 (if enable-multibyte-characters
102 (concat (symbol-name buffer-file-coding-system
)
103 " buffer; see M-x describe-coding-system")
105 (symbol-name buffer-file-coding-system
)
107 "Mode-line control for displaying information of multilingual environment.
108 Normally it displays current input method (if any activated) and
109 mnemonics of the following coding systems:
110 coding system for saving or writing the current buffer
111 coding system for keyboard input (if Emacs is running on terminal)
112 coding system for terminal output (if Emacs is running on terminal)"
114 ;;; coding system for decoding output of buffer process (if any)
115 ;;; coding system for encoding text to send to buffer process (if any)."
118 (make-variable-buffer-local 'mode-line-mule-info
)
120 (defvar mode-line-buffer-identification
(purecopy '("%12b")) "\
121 Mode-line control for identifying the buffer being displayed.
122 Its default value is (\"%12b\").
123 Major modes that edit things other than ordinary files may change this
124 \(e.g. Info, Dired,...)")
126 (make-variable-buffer-local 'mode-line-buffer-identification
)
128 (defvar mode-line-frame-identification
'("-%F "))
130 (defvar mode-line-process nil
"\
131 Mode-line control for displaying info on process status.
132 Normally nil in most modes, since there is no process to display.")
134 (make-variable-buffer-local 'mode-line-process
)
136 (defvar mode-line-modified
139 'help-echo
(purecopy (lambda (window object point
)
140 (format "%sead-only: mouse-2 toggles"
141 (save-selected-window
142 (select-window window
)
146 'local-map
(purecopy (make-mode-line-mouse2-map #'toggle-read-only
)))
149 'help-echo
(purecopy (lambda (window object point
)
150 (format "%sodified: mouse-2 toggles flag"
151 (save-selected-window
152 (select-window window
)
153 (if (buffer-modified-p)
156 'local-map
(purecopy (make-mode-line-mouse2-map
159 (set-buffer-modified-p
160 (not (buffer-modified-p))))))))
161 "Mode-line control for displaying whether current buffer is modified.")
163 (make-variable-buffer-local 'mode-line-modified
)
165 (setq-default mode-line-format
167 ;; The multi-line message doesn't work terribly well on the
168 ;; bottom mode line... Better ideas?
170 ;;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
171 ;;; drag-mouse-1: resize, C-mouse-2: split horizontally"
172 "mouse-1: select window, mouse-2: delete others, mouse-3: delete ...")
173 (dashes (propertize "--" 'help-echo help-echo
)))
175 (propertize "-" 'help-echo help-echo
)
178 'mode-line-frame-identification
179 'mode-line-buffer-identification
180 (propertize " " 'help-echo help-echo
)
182 (propertize " %[(" 'help-echo help-echo
)
183 '(:eval
(mode-line-mode-name)) 'mode-line-process
'minor-mode-alist
184 (propertize "%n" 'help-echo
"mouse-2: widen"
185 'local-map
(make-mode-line-mouse2-map #'widen
))
186 (propertize ")%]--" 'help-echo help-echo
)
187 `(which-func-mode ("" which-func-format
,dashes
))
188 `(line-number-mode ("L%l" ,dashes
))
189 `(column-number-mode ("C%c" ,dashes
))
190 (purecopy '(-3 .
"%p"))
191 (propertize "-%-" 'help-echo help-echo
))))
193 (defvar minor-mode-alist nil
"\
194 Alist saying how to show minor modes in the mode line.
195 Each element looks like (VARIABLE STRING);
196 STRING is included in the mode line iff VARIABLE's value is non-nil.
198 Actually, STRING need not be a string; any possible mode-line element
199 is okay. See `mode-line-format'.")
200 ;; Don't use purecopy here--some people want to change these strings.
201 (setq minor-mode-alist
204 (propertize " Abbrev"
206 "mouse-2: turn off Abbrev mode")
207 'local-map
(purecopy (make-mode-line-mouse2-map
209 '(overwrite-mode overwrite-mode
)
210 (list 'auto-fill-function
213 "mouse-2: turn off Autofill mode")
214 'local-map
(purecopy (make-mode-line-mouse2-map
216 ;; not really a minor mode...
217 '(defining-kbd-macro " Def")))
219 (defvar mode-line-buffer-identification-keymap nil
"\
220 Keymap for what is displayed by `mode-line-buffer-identification'.")
222 (defvar mode-line-minor-mode-keymap nil
"\
223 Keymap for what is displayed by `mode-line-mode-name'.")
225 (defvar mode-line-mode-menu-keymap nil
"\
226 Keymap for mode operations menu in the mode line.")
228 (defun mode-line-unbury-buffer () "\
229 Switch to the last buffer in the buffer list that is not hidden."
231 (let ((list (reverse (buffer-list))))
232 (while (eq (aref (buffer-name (car list
)) 0) ?
)
233 (setq list
(cdr list
)))
234 (switch-to-buffer (car list
))))
236 (defun mode-line-other-buffer () "\
237 Switch to the most recently selected buffer other than the current one."
239 (switch-to-buffer (other-buffer)))
241 (defvar mode-line-mode-menu
(make-sparse-keymap "Minor Modes") "\
242 Menu of mode operations in the mode line.")
244 (defun mode-line-mode-menu-1 (event)
246 (save-selected-window
247 (select-window (posn-window (event-start event
)))
248 (let* ((selection (mode-line-mode-menu event
))
249 (binding (and selection
(lookup-key mode-line-mode-menu
250 (vector (car selection
))))))
252 (call-interactively binding
)))))
254 (defun mode-line-mode-name () "\
255 Return a string to display in the mode line for the current mode name."
256 (let (length (result mode-name
))
257 (let ((local-map (get-text-property 0 'local-map result
))
258 (help-echo (get-text-property 0 'help-echo result
)))
259 (setq result
(copy-sequence result
))
260 ;; Add `local-map' property if there isn't already one.
261 (when (and (null local-map
)
262 (null (next-single-property-change 0 'local-map result
)))
263 (put-text-property 0 (length result
)
264 'local-map mode-line-minor-mode-keymap result
))
265 ;; Add `help-echo' property if there isn't already one.
266 (when (and (null help-echo
)
267 (null (next-single-property-change 0 'help-echo result
)))
268 (put-text-property 0 (length result
)
269 'help-echo
"mouse-3: minor mode menu" result
)))
272 (defmacro bound-and-true-p
(var)
273 "Return the value of symbol VAR if it is bound, else nil."
274 `(and (boundp (quote ,var
)) ,var
))
276 (define-key mode-line-mode-menu
[abbrev-mode
]
277 `(menu-item ,(purecopy "Abbrev") abbrev-mode
278 :button
(:toggle . abbrev-mode
)))
279 (define-key mode-line-mode-menu
[auto-revert-mode
]
280 `(menu-item ,(purecopy "Auto revert") auto-revert-mode
281 :button
(:toggle . auto-revert-mode
)))
282 (define-key mode-line-mode-menu
[auto-fill-mode
]
283 `(menu-item ,(purecopy "Auto-fill") auto-fill-mode
284 :button
(:toggle . auto-fill-function
)))
285 (define-key mode-line-mode-menu
[column-number-mode
]
286 `(menu-item ,(purecopy "Column number") column-number-mode
287 :button
(:toggle . column-number-mode
)))
288 (define-key mode-line-mode-menu
[flyspell-mode
]
289 `(menu-item ,(purecopy "Flyspell") flyspell-mode
290 :button
(:toggle .
(bound-and-true-p flyspell-mode
))))
291 (define-key mode-line-mode-menu
[font-lock-mode
]
292 `(menu-item ,(purecopy "Font-lock") font-lock-mode
293 :button
(:toggle . font-lock-mode
)))
294 (define-key mode-line-mode-menu
[hide-ifdef-mode
]
295 `(menu-item ,(purecopy "Hide ifdef") hide-ifdef-mode
296 :button
(:toggle .
(bound-and-true-p hide-ifdef-mode
))))
297 (define-key mode-line-mode-menu
[highlight-changes-mode
]
298 `(menu-item ,(purecopy "Highlight changes") highlight-changes-mode
299 :button
(:toggle . highlight-changes-mode
)))
300 (define-key mode-line-mode-menu
[line-number-mode
]
301 `(menu-item ,(purecopy "Line number") line-number-mode
302 :button
(:toggle . line-number-mode
)))
303 (define-key mode-line-mode-menu
[outline-minor-mode
]
304 `(menu-item ,(purecopy "Outline") outline-minor-mode
305 :button
(:toggle .
(bound-and-true-p outline-minor-mode
))))
306 (define-key mode-line-mode-menu
[overwrite-mode
]
307 `(menu-item ,(purecopy "Overwrite") overwrite-mode
308 :button
(:toggle . overwrite-mode
)))
310 (defun mode-line-mode-menu (event)
312 (x-popup-menu event mode-line-mode-menu
))
314 ;; Add menu of buffer operations to the buffer identification part
316 (let ((map (make-sparse-keymap)))
317 (define-key map
[mode-line mouse-1
] 'mode-line-other-buffer
)
318 (define-key map
[header-line mouse-1
] 'mode-line-other-buffer
)
319 (define-key map
[mode-line M-mouse-2
] 'mode-line-unbury-buffer
)
320 (define-key map
[header-line M-mouse-2
] 'mode-line-unbury-buffer
)
321 (define-key map
[mode-line mouse-2
] 'bury-buffer
)
322 (define-key map
[header-line mouse-2
] 'bury-buffer
)
323 (define-key map
[mode-line down-mouse-3
] 'mouse-buffer-menu
)
324 (define-key map
[header-line down-mouse-3
] 'mouse-buffer-menu
)
325 (setq mode-line-buffer-identification-keymap map
))
327 (defun propertized-buffer-identification (fmt)
328 "Return a list suitable for `mode-line-buffer-identification'.
329 FMT is a format specifier such as \"%12b\". This function adds
330 text properties for face, help-echo, and local-map to it."
331 (list (propertize fmt
332 'face
'(:weight bold
)
333 'help-echo
(purecopy "mouse-1: other \
334 buffer, mouse-2: prev, M-mouse-2: next, mouse-3: buffer menu")
335 'local-map mode-line-buffer-identification-keymap
)))
337 (setq-default mode-line-buffer-identification
338 (propertized-buffer-identification "%12b"))
340 ;; Menu of minor modes.
341 (let ((map (make-sparse-keymap)))
342 (define-key map
[mode-line down-mouse-3
] 'mode-line-mode-menu-1
)
343 (define-key map
[header-line down-mouse-3
] 'mode-line-mode-menu-1
)
344 (setq mode-line-minor-mode-keymap map
))
346 ;; These variables are used by autoloadable packages.
347 ;; They are defined here so that they do not get overridden
348 ;; by the loading of those packages.
350 ;; Names in directory that end in one of these
351 ;; are ignored in completion,
352 ;; making it more likely you will get a unique match.
353 (setq completion-ignored-extensions
355 (cond ((or (eq system-type
'ms-dos
) (eq system-type
'windows-nt
))
356 '(".o" "~" ".bin" ".bak" ".obj" ".map"
357 ".a" ".ln" ".blg" ".bbl"))
358 ((eq system-type
'vax-vms
)
359 '(".obj" ".exe" ".bin" ".lbin" ".sbin"
360 ".brn" ".rnt" ".mem" ".lni" ".lis"
361 ".olb" ".tlb" ".mlb" ".hlb"))
363 '(".o" "~" ".bin" ".lbin" ".fasl" ".ufsl"
364 ".a" ".ln" ".blg" ".bbl")))
368 ".dvi" ".fmt" ".tfm" ".pdf"
381 ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
382 ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs")))
384 ;; Packages should add to this list appropriately when they are
385 ;; loaded, rather than listing everything here.
386 (setq debug-ignored-errors
387 '(beginning-of-line beginning-of-buffer end-of-line
388 end-of-buffer end-of-file buffer-read-only
390 "^Previous command was not a yank$"
391 "^Minibuffer window is not active$"
392 "^End of history; no next item$"
393 "^Beginning of history; no preceding item$"
394 "^No recursive edit is in progress$"
395 "^Changes to be undone are outside visible portion of buffer$"
396 "^No undo information in this buffer$"
397 "^No further undo information$"
398 "^Save not confirmed$"
399 "^Recover-file cancelled\\.$"
400 "^Cannot switch buffers in a dedicated window$"
403 "^Errors in diff output. Diff output is in "
404 "^Hmm... I don't see an Ediff command around here...$"
405 "^Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer$"
406 ": This command runs in Ediff Control Buffer only!$"
407 ": Invalid op in ediff-check-version$"
408 "^ediff-shrink-window-C can be used only for merging jobs$"
409 "^Lost difference info on these directories$"
410 "^This command is inapplicable in the present context$"
411 "^This session group has no parent$"
412 "^Can't hide active session, $"
413 "^Ediff: something wrong--no multiple diffs buffer$"
414 "^Can't make context diff for Session $"
415 "^The patch buffer wasn't found$"
417 "^This Ediff session is not part of a session group$"
418 "^No active Ediff sessions or corrupted session registry$"
419 "^No session info in this line$"
420 "^`.*' is not an ordinary file$"
421 "^Patch appears to have failed$"
422 "^Recomputation of differences cancelled$"
423 "^No fine differences in this mode$"
424 "^Lost connection to ancestor buffer...sorry$"
425 "^Not merging with ancestor$"
426 "^Don't know how to toggle read-only in buffer "
427 "Emacs is not running as a window application$"
428 "^This command makes sense only when merging with an ancestor$"
429 "^At end of the difference list$"
430 "^At beginning of the difference list$"
431 "^Nothing saved for diff .* in buffer "
432 "^Buffer is out of sync for file "
433 "^Buffer out of sync for file "
434 "^Output from `diff' not found$"
435 "^You forgot to specify a region in buffer "
436 "^All right. Make up your mind and come back...$"
437 "^Current buffer is not visiting any file$"
438 "^Failed to retrieve revision: $"
439 "^Can't determine display width.$"
440 "^File `.*' does not exist or is not readable$"
441 "^File `.*' is a directory$"
442 "^Buffer .* doesn't exist$"
443 "^Directories . and . are the same: "
444 "^Directory merge aborted$"
445 "^Merge of directory revisions aborted$"
446 "^Buffer .* doesn't exist$"
447 "^There is no file to merge$"
448 "^Version control package .*.el not found. Use vc.el instead$"))
451 (make-variable-buffer-local 'indent-tabs-mode
)
453 ;; We have base64 functions built in now.
454 (add-to-list 'features
'base64
)
456 (define-key esc-map
"\t" 'complete-symbol
)
458 (defun complete-symbol (arg) "\
459 Perform tags completion on the text around point.
460 Completes to the set of names listed in the current tags table.
461 The string to complete is chosen in the same way as the default
462 for \\[find-tag] (which see).
464 With a prefix argument, this command does completion within
465 the collection of symbols listed in the index of the manual for the
466 language you are using."
469 (info-complete-symbol)
470 (if (fboundp 'complete-tag
)
472 ;; Don't autoload etags if we have no tags table.
473 (error (substitute-command-keys
474 "No tags table loaded; use \\[visit-tags-table] to load one")))))
476 ;; Reduce total amount of space we must allocate during this function
477 ;; that we will not need to keep permanently.
480 ;; Make all multibyte characters self-insert.
481 (let ((l (generic-character-list))
482 (table (nth 1 global-map
)))
484 (set-char-table-default table
(car l
) 'self-insert-command
)
487 (setq help-event-list
'(help f1
))
489 (make-variable-buffer-local 'minor-mode-overriding-map-alist
)
491 ;These commands are defined in editfns.c
492 ;but they are not assigned to keys there.
493 (put 'narrow-to-region
'disabled t
)
494 (define-key ctl-x-map
"nn" 'narrow-to-region
)
495 (define-key ctl-x-map
"nw" 'widen
)
496 ;; (define-key ctl-x-map "n" 'narrow-to-region)
497 ;; (define-key ctl-x-map "w" 'widen)
499 (define-key global-map
"\C-j" 'newline-and-indent
)
500 (define-key global-map
"\C-m" 'newline
)
501 (define-key global-map
"\C-o" 'open-line
)
502 (define-key esc-map
"\C-o" 'split-line
)
503 (define-key global-map
"\C-q" 'quoted-insert
)
504 (define-key esc-map
"^" 'delete-indentation
)
505 (define-key esc-map
"\\" 'delete-horizontal-space
)
506 (define-key esc-map
"m" 'back-to-indentation
)
507 (define-key ctl-x-map
"\C-o" 'delete-blank-lines
)
508 (define-key esc-map
" " 'just-one-space
)
509 (define-key esc-map
"z" 'zap-to-char
)
510 (define-key esc-map
"=" 'count-lines-region
)
511 (define-key ctl-x-map
"=" 'what-cursor-position
)
512 (define-key esc-map
":" 'eval-expression
)
513 ;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
514 (define-key esc-map
"\M-:" 'eval-expression
)
515 ;; Changed from C-x ESC so that function keys work following C-x.
516 (define-key ctl-x-map
"\e\e" 'repeat-complex-command
)
517 ;; New binding analogous to M-:.
518 (define-key ctl-x-map
"\M-:" 'repeat-complex-command
)
519 (define-key ctl-x-map
"u" 'advertised-undo
)
520 ;; Many people are used to typing C-/ on X terminals and getting C-_.
521 (define-key global-map
[?\C-
/] 'undo
)
522 (define-key global-map
"\C-_" 'undo
)
523 (define-key esc-map
"!" 'shell-command
)
524 (define-key esc-map
"|" 'shell-command-on-region
)
526 ;; This is an experiment--make up and down arrows do history.
527 (define-key minibuffer-local-map
[up] 'previous-history-element)
528 (define-key minibuffer-local-map [down] 'next-history-element)
529 (define-key minibuffer-local-ns-map [up] 'previous-history-element
)
530 (define-key minibuffer-local-ns-map
[down] 'next-history-element)
531 (define-key minibuffer-local-completion-map [up] 'previous-history-element)
532 (define-key minibuffer-local-completion-map [down] 'next-history-element
)
533 (define-key minibuffer-local-must-match-map
[up] 'previous-history-element)
534 (define-key minibuffer-local-must-match-map [down] 'next-history-element)
536 (define-key global-map "\C-u" 'universal-argument)
539 (define-key esc-map (char-to-string i) 'digit-argument)
541 (define-key esc-map "-" 'negative-argument)
542 ;; Define control-digits.
545 (define-key global-map (read (format "[?\\C-%c]" i)) 'digit-argument)
547 (define-key global-map [?\C--] 'negative-argument)
548 ;; Define control-meta-digits.
551 (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
553 (define-key global-map [?\C-\M--] 'negative-argument)
555 (define-key global-map "\C-k" 'kill-line)
556 (define-key global-map "\C-w" 'kill-region)
557 (define-key esc-map "w" 'kill-ring-save)
558 (define-key esc-map "\C-w" 'append-next-kill)
559 (define-key global-map "\C-y" 'yank)
560 (define-key esc-map "y" 'yank-pop)
562 ;; (define-key ctl-x-map "a" 'append-to-buffer)
564 (define-key global-map "\C-@" 'set-mark-command)
565 ;; Many people are used to typing C-SPC and getting C-@.
566 (define-key global-map [?\C- ] 'set-mark-command)
567 (define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
568 (define-key ctl-x-map "\C-@" 'pop-global-mark)
569 (define-key ctl-x-map [?\C- ] 'pop-global-mark)
571 (define-key global-map "\C-n" 'next-line)
572 (define-key global-map "\C-p" 'previous-line)
573 (define-key ctl-x-map "\C-n" 'set-goal-column)
575 ;;(defun function-key-error ()
577 ;; (error "That function key is not bound to anything."))
579 (define-key global-map [menu] 'execute-extended-command)
580 (define-key global-map [find] 'search-forward)
582 (define-key global-map [delete] 'delete-char)
584 ;; natural bindings for terminal keycaps --- defined in X keysym order
585 (define-key global-map [home] 'beginning-of-buffer)
586 (define-key global-map [M-home] 'beginning-of-buffer-other-window)
587 (define-key global-map [left] 'backward-char)
588 (define-key global-map [up] 'previous-line
)
589 (define-key global-map
[right] 'forward-char)
590 (define-key global-map [down] 'next-line)
591 (define-key global-map [prior] 'scroll-down)
592 (define-key global-map [next] 'scroll-up)
593 (define-key global-map [C-up] 'backward-paragraph)
594 (define-key global-map [C-down] 'forward-paragraph)
595 (define-key global-map [C-prior] 'scroll-right)
596 (define-key global-map [C-next] 'scroll-left)
597 (define-key global-map [M-next] 'scroll-other-window)
598 (define-key global-map [M-prior] 'scroll-other-window-down)
599 (define-key global-map [end] 'end-of-buffer)
600 (define-key global-map [M-end] 'end-of-buffer-other-window)
601 (define-key global-map [begin] 'beginning-of-buffer)
602 (define-key global-map [M-begin] 'beginning-of-buffer-other-window)
603 ;; (define-key global-map [select] 'function-key-error)
604 ;; (define-key global-map [print] 'function-key-error)
605 (define-key global-map [execute] 'execute-extended-command)
606 (define-key global-map [insert] 'overwrite-mode)
607 (define-key global-map [C-insert] 'kill-ring-save)
608 (define-key global-map [S-insert] 'yank)
609 (define-key global-map [undo] 'undo)
610 (define-key global-map [redo] 'repeat-complex-command)
611 ;; (define-key global-map [clearline] 'function-key-error)
612 (define-key global-map [insertline] 'open-line)
613 (define-key global-map [deleteline] 'kill-line)
614 ;; (define-key global-map [insertchar] 'function-key-error)
615 (define-key global-map [deletechar] 'delete-char)
616 ;; (define-key global-map [backtab] 'function-key-error)
617 ;; (define-key global-map [f1] 'function-key-error)
618 ;; (define-key global-map [f2] 'function-key-error)
619 ;; (define-key global-map [f3] 'function-key-error)
620 ;; (define-key global-map [f4] 'function-key-error)
621 ;; (define-key global-map [f5] 'function-key-error)
622 ;; (define-key global-map [f6] 'function-key-error)
623 ;; (define-key global-map [f7] 'function-key-error)
624 ;; (define-key global-map [f8] 'function-key-error)
625 ;; (define-key global-map [f9] 'function-key-error)
626 ;; (define-key global-map [f10] 'function-key-error)
627 ;; (define-key global-map [f11] 'function-key-error)
628 ;; (define-key global-map [f12] 'function-key-error)
629 ;; (define-key global-map [f13] 'function-key-error)
630 ;; (define-key global-map [f14] 'function-key-error)
631 ;; (define-key global-map [f15] 'function-key-error)
632 ;; (define-key global-map [f16] 'function-key-error)
633 ;; (define-key global-map [f17] 'function-key-error)
634 ;; (define-key global-map [f18] 'function-key-error)
635 ;; (define-key global-map [f19] 'function-key-error)
636 ;; (define-key global-map [f20] 'function-key-error)
637 ;; (define-key global-map [f21] 'function-key-error)
638 ;; (define-key global-map [f22] 'function-key-error)
639 ;; (define-key global-map [f23] 'function-key-error)
640 ;; (define-key global-map [f24] 'function-key-error)
641 ;; (define-key global-map [f25] 'function-key-error)
642 ;; (define-key global-map [f26] 'function-key-error)
643 ;; (define-key global-map [f27] 'function-key-error)
644 ;; (define-key global-map [f28] 'function-key-error)
645 ;; (define-key global-map [f29] 'function-key-error)
646 ;; (define-key global-map [f30] 'function-key-error)
647 ;; (define-key global-map [f31] 'function-key-error)
648 ;; (define-key global-map [f32] 'function-key-error)
649 ;; (define-key global-map [f33] 'function-key-error)
650 ;; (define-key global-map [f34] 'function-key-error)
651 ;; (define-key global-map [f35] 'function-key-error)
652 ;; (define-key global-map [kp-backtab] 'function-key-error)
653 ;; (define-key global-map [kp-space] 'function-key-error)
654 ;; (define-key global-map [kp-tab] 'function-key-error)
655 ;; (define-key global-map [kp-enter] 'function-key-error)
656 ;; (define-key global-map [kp-f1] 'function-key-error)
657 ;; (define-key global-map [kp-f2] 'function-key-error)
658 ;; (define-key global-map [kp-f3] 'function-key-error)
659 ;; (define-key global-map [kp-f4] 'function-key-error)
660 ;; (define-key global-map [kp-multiply] 'function-key-error)
661 ;; (define-key global-map [kp-add] 'function-key-error)
662 ;; (define-key global-map [kp-separator] 'function-key-error)
663 ;; (define-key global-map [kp-subtract] 'function-key-error)
664 ;; (define-key global-map [kp-decimal] 'function-key-error)
665 ;; (define-key global-map [kp-divide] 'function-key-error)
666 ;; (define-key global-map [kp-0] 'function-key-error)
667 ;; (define-key global-map [kp-1] 'function-key-error)
668 ;; (define-key global-map [kp-2] 'function-key-error)
669 ;; (define-key global-map [kp-3] 'function-key-error)
670 ;; (define-key global-map [kp-4] 'function-key-error)
671 ;; (define-key global-map [kp-5] 'recenter)
672 ;; (define-key global-map [kp-6] 'function-key-error)
673 ;; (define-key global-map [kp-7] 'function-key-error)
674 ;; (define-key global-map [kp-8] 'function-key-error)
675 ;; (define-key global-map [kp-9] 'function-key-error)
676 ;; (define-key global-map [kp-equal] 'function-key-error)
678 ;; X11R6 distinguishes these keys from the non-kp keys.
679 ;; Make them behave like the non-kp keys unless otherwise bound.
680 (define-key function-key-map [kp-home] [home])
681 (define-key function-key-map [kp-left] [left])
682 (define-key function-key-map [kp-up] [up])
683 (define-key function-key-map [kp-right] [right])
684 (define-key function-key-map
[kp-down
] [down])
685 (define-key function-key-map [kp-prior] [prior])
686 (define-key function-key-map [kp-next] [next])
687 (define-key function-key-map [M-kp-next] [M-next])
688 (define-key function-key-map [kp-end] [end])
689 (define-key function-key-map [kp-begin] [begin])
690 (define-key function-key-map [kp-insert] [insert])
691 (define-key function-key-map [kp-delete] [delete])
693 (define-key global-map [mouse-movement] 'ignore)
695 (define-key global-map "\C-t" 'transpose-chars)
696 (define-key esc-map "t" 'transpose-words)
697 (define-key esc-map "\C-t" 'transpose-sexps)
698 (define-key ctl-x-map "\C-t" 'transpose-lines)
700 (define-key esc-map ";" 'comment-dwim)
701 (define-key esc-map "j" 'comment-indent-new-line)
702 (define-key esc-map "\C-j" 'comment-indent-new-line)
703 (define-key ctl-x-map ";" 'comment-set-column)
704 (define-key ctl-x-map "f" 'set-fill-column)
705 (define-key ctl-x-map "$" 'set-selective-display)
707 (define-key esc-map "@" 'mark-word)
708 (define-key esc-map "f" 'forward-word)
709 (define-key esc-map "b" 'backward-word)
710 (define-key esc-map "d" 'kill-word)
711 (define-key esc-map "\177" 'backward-kill-word)
713 (define-key esc-map "<" 'beginning-of-buffer)
714 (define-key esc-map ">" 'end-of-buffer)
715 (define-key ctl-x-map "h" 'mark-whole-buffer)
716 (define-key esc-map "\\" 'delete-horizontal-space)
718 (defalias 'mode-specific-command-prefix (make-sparse-keymap))
719 (defvar mode-specific-map (symbol-function 'mode-specific-command-prefix)
720 "Keymap for characters following C-c.")
721 (define-key global-map "\C-c" 'mode-specific-command-prefix)
723 (global-set-key [M-right] 'forward-word)
724 (global-set-key [M-left] 'backward-word)
725 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
726 (global-set-key [C-right] 'forward-word)
727 (global-set-key [C-left] 'backward-word)
728 ;; This is not quite compatible, but at least is analogous
729 (global-set-key [C-delete] 'backward-kill-word)
730 ;; This is "move to the clipboard", or as close as we come.
731 (global-set-key [S-delete] 'kill-region)
733 (define-key esc-map "\C-f" 'forward-sexp)
734 (define-key esc-map "\C-b" 'backward-sexp)
735 (define-key esc-map "\C-u" 'backward-up-list)
736 (define-key esc-map "\C-@" 'mark-sexp)
737 (define-key esc-map [?\C-\ ] 'mark-sexp)
738 (define-key esc-map "\C-d" 'down-list)
739 (define-key esc-map "\C-k" 'kill-sexp)
740 (define-key global-map [C-M-delete] 'backward-kill-sexp)
741 (define-key global-map [C-M-backspace] 'backward-kill-sexp)
742 (define-key esc-map "\C-n" 'forward-list)
743 (define-key esc-map "\C-p" 'backward-list)
744 (define-key esc-map "\C-a" 'beginning-of-defun)
745 (define-key esc-map "\C-e" 'end-of-defun)
746 (define-key esc-map "\C-h" 'mark-defun)
747 (define-key ctl-x-map "nd" 'narrow-to-defun)
748 (define-key esc-map "(" 'insert-parentheses)
749 (define-key esc-map ")" 'move-past-close-and-reindent)
751 (define-key ctl-x-map "\C-e" 'eval-last-sexp)
753 (define-key ctl-x-map "m" 'compose-mail)
754 (define-key ctl-x-4-map "m" 'compose-mail-other-window)
755 (define-key ctl-x-5-map "m" 'compose-mail-other-frame)
757 (define-key ctl-x-map "r\C-@" 'point-to-register)
758 (define-key ctl-x-map [?r ?\C-\ ] 'point-to-register)
759 (define-key ctl-x-map "r " 'point-to-register)
760 (define-key ctl-x-map "rj" 'jump-to-register)
761 (define-key ctl-x-map "rs" 'copy-to-register)
762 (define-key ctl-x-map "rx" 'copy-to-register)
763 (define-key ctl-x-map "ri" 'insert-register)
764 (define-key ctl-x-map "rg" 'insert-register)
765 (define-key ctl-x-map "rr" 'copy-rectangle-to-register)
766 (define-key ctl-x-map "rn" 'number-to-register)
767 (define-key ctl-x-map "r+" 'increment-register)
768 (define-key ctl-x-map "rc" 'clear-rectangle)
769 (define-key ctl-x-map "rk" 'kill-rectangle)
770 (define-key ctl-x-map "rd" 'delete-rectangle)
771 (define-key ctl-x-map "ry" 'yank-rectangle)
772 (define-key ctl-x-map "ro" 'open-rectangle)
773 (define-key ctl-x-map "rt" 'string-rectangle)
774 (define-key ctl-x-map "rw" 'window-configuration-to-register)
775 (define-key ctl-x-map "rf" 'frame-configuration-to-register)
777 ;; These key bindings are deprecated; use the above C-x r map instead.
778 ;; We use these aliases so \[...] will show the C-x r bindings instead.
779 (defalias 'point-to-register-compatibility-binding 'point-to-register)
780 (defalias 'jump-to-register-compatibility-binding 'jump-to-register)
781 (defalias 'copy-to-register-compatibility-binding 'copy-to-register)
782 (defalias 'insert-register-compatibility-binding 'insert-register)
783 (define-key ctl-x-map "/" 'point-to-register-compatibility-binding)
784 (define-key ctl-x-map "j" 'jump-to-register-compatibility-binding)
785 (define-key ctl-x-map "x" 'copy-to-register-compatibility-binding)
786 (define-key ctl-x-map "g" 'insert-register-compatibility-binding)
787 ;; (define-key ctl-x-map "r" 'copy-rectangle-to-register)
789 (define-key esc-map "q" 'fill-paragraph)
790 ;; (define-key esc-map "g" 'fill-region)
791 (define-key ctl-x-map "." 'set-fill-prefix)
793 (define-key esc-map "{" 'backward-paragraph)
794 (define-key esc-map "}" 'forward-paragraph)
795 (define-key esc-map "h" 'mark-paragraph)
796 (define-key esc-map "a" 'backward-sentence)
797 (define-key esc-map "e" 'forward-sentence)
798 (define-key esc-map "k" 'kill-sentence)
799 (define-key ctl-x-map "\177" 'backward-kill-sentence)
801 (define-key ctl-x-map "[" 'backward-page)
802 (define-key ctl-x-map "]" 'forward-page)
803 (define-key ctl-x-map "\C-p" 'mark-page)
804 (define-key ctl-x-map "l" 'count-lines-page)
805 (define-key ctl-x-map "np" 'narrow-to-page)
806 ;; (define-key ctl-x-map "p" 'narrow-to-page)
808 (define-key ctl-x-map "al" 'add-mode-abbrev)
809 (define-key ctl-x-map "a\C-a" 'add-mode-abbrev)
810 (define-key ctl-x-map "ag" 'add-global-abbrev)
811 (define-key ctl-x-map "a+" 'add-mode-abbrev)
812 (define-key ctl-x-map "aig" 'inverse-add-global-abbrev)
813 (define-key ctl-x-map "ail" 'inverse-add-mode-abbrev)
814 ;; (define-key ctl-x-map "a\C-h" 'inverse-add-global-abbrev)
815 (define-key ctl-x-map "a-" 'inverse-add-global-abbrev)
816 (define-key ctl-x-map "ae" 'expand-abbrev)
817 (define-key ctl-x-map "a'" 'expand-abbrev)
818 ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev)
819 ;; (define-key ctl-x-map "\+" 'add-global-abbrev)
820 ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev)
821 ;; (define-key ctl-x-map "\-" 'inverse-add-global-abbrev)
822 (define-key esc-map "'" 'abbrev-prefix-mark)
823 (define-key ctl-x-map "'" 'expand-abbrev)
825 (define-key ctl-x-map "z" 'repeat)
827 ;;; Don't compile this file; it contains no large function definitions.
828 ;;; Don't look for autoload cookies in this file.
830 ;;; no-byte-compile: t
831 ;;; no-update-autoloads: t
834 ;;; bindings.el ends here