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