1 ;;; bindings.el --- define standard key bindings and some variables
3 ;; Copyright (C) 1985-1987, 1992-1996, 1999-2017 Free Software
6 ;; Maintainer: emacs-devel@gnu.org
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
29 (defun make-mode-line-mouse-map (mouse function
) "\
30 Return a keymap with single entry for mouse key MOUSE on the mode line.
31 MOUSE is defined to run function FUNCTION with no args in the buffer
32 corresponding to the mode line clicked."
33 (let ((map (make-sparse-keymap)))
34 (define-key map
(vector 'mode-line mouse
) function
)
38 (defun mode-line-toggle-read-only (event)
39 "Like toggling `read-only-mode', for the mode-line."
41 (with-selected-window (posn-window (event-start event
))
42 (read-only-mode 'toggle
)))
44 (defun mode-line-toggle-modified (event)
45 "Toggle the buffer-modified flag from the mode-line."
47 (with-selected-window (posn-window (event-start event
))
48 (set-buffer-modified-p (not (buffer-modified-p)))
49 (force-mode-line-update)))
51 (defun mode-line-widen (event)
52 "Widen a buffer from the mode-line."
54 (with-selected-window (posn-window (event-start event
))
56 (force-mode-line-update)))
58 (defvar mode-line-input-method-map
59 (let ((map (make-sparse-keymap)))
60 (define-key map
[mode-line mouse-2
]
63 (with-selected-window (posn-window (event-start e
))
65 (force-mode-line-update))))
66 (define-key map
[mode-line mouse-3
]
69 (with-selected-window (posn-window (event-start e
))
70 (describe-current-input-method))))
73 (defvar mode-line-coding-system-map
74 (let ((map (make-sparse-keymap)))
75 (define-key map
[mode-line mouse-1
]
78 (with-selected-window (posn-window (event-start e
))
79 (when (and enable-multibyte-characters
80 buffer-file-coding-system
)
81 (describe-coding-system buffer-file-coding-system
)))))
82 (define-key map
[mode-line mouse-3
]
85 (with-selected-window (posn-window (event-start e
))
86 (call-interactively 'set-buffer-file-coding-system
))))
88 "Local keymap for the coding-system part of the mode line.")
90 (defun mode-line-change-eol (event)
91 "Cycle through the various possible kinds of end-of-line styles."
93 (with-selected-window (posn-window (event-start event
))
94 (let ((eol (coding-system-eol-type buffer-file-coding-system
)))
95 (set-buffer-file-coding-system
96 (cond ((eq eol
0) 'dos
) ((eq eol
1) 'mac
) (t 'unix
))))))
98 (defvar mode-line-eol-desc-cache nil
)
100 (defun mode-line-eol-desc ()
101 (let* ((eol (coding-system-eol-type buffer-file-coding-system
))
102 (mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system
))
103 (desc (assoc eol mode-line-eol-desc-cache
)))
104 (if (and desc
(eq (cadr desc
) mnemonic
))
106 (if desc
(setq mode-line-eol-desc-cache nil
)) ;Flush the cache if stale.
110 'help-echo
(format "End-of-line style: %s\nmouse-1: Cycle"
111 (if (eq eol
0) "Unix-style LF"
112 (if (eq eol
1) "DOS-style CRLF"
113 (if (eq eol
2) "Mac-style CR"
117 (let ((map (make-sparse-keymap)))
118 (define-key map
[mode-line mouse-1
] 'mode-line-change-eol
)
120 'mouse-face
'mode-line-highlight
))
121 (push (cons eol
(cons mnemonic desc
)) mode-line-eol-desc-cache
)
125 ;;; Mode line contents
127 (defcustom mode-line-default-help-echo
128 "mouse-1: Select (drag to resize)\n\
129 mouse-2: Make current window occupy the whole frame\n\
130 mouse-3: Remove current window from display"
131 "Default help text for the mode line.
132 If the value is a string, it specifies the tooltip or echo area
133 message to display when the mouse is moved over the mode line.
134 If the text at the mouse position has a `help-echo' text
135 property, that overrides this variable."
136 :type
'(choice (const :tag
"No help" :value nil
) string
)
140 (defvar mode-line-front-space
'(:eval
(if (display-graphic-p) " " "-"))
141 "Mode line construct to put at the front of the mode line.
142 By default, this construct is displayed right at the beginning of
143 the mode line, except that if there is a memory-full message, it
144 is displayed first.")
145 (put 'mode-line-front-space
'risky-local-variable t
)
147 (defun mode-line-mule-info-help-echo (window _object _point
)
148 "Return help text specifying WINDOW's buffer coding system."
149 (with-current-buffer (window-buffer window
)
150 (if buffer-file-coding-system
151 (format "Buffer coding system (%s): %s
152 mouse-1: Describe coding system
153 mouse-3: Set coding system"
154 (if enable-multibyte-characters
"multi-byte" "unibyte")
155 (symbol-name buffer-file-coding-system
))
156 "Buffer coding system: none specified")))
158 (defvar mode-line-mule-info
160 (current-input-method
161 (:propertize
("" current-input-method-title
)
163 ,(purecopy "Current input method: ")
166 mouse-2: Disable input method\n\
167 mouse-3: Describe current input method"))
168 local-map
,mode-line-input-method-map
169 mouse-face mode-line-highlight
))
172 'help-echo
'mode-line-mule-info-help-echo
173 'mouse-face
'mode-line-highlight
174 'local-map mode-line-coding-system-map
)
175 (:eval
(mode-line-eol-desc)))
176 "Mode line construct to report the multilingual environment.
177 Normally it displays current input method (if any activated) and
178 mnemonics of the following coding systems:
179 coding system for saving or writing the current buffer
180 coding system for keyboard input (on a text terminal)
181 coding system for terminal output (on a text terminal)")
183 (put 'mode-line-mule-info
'risky-local-variable t
)
184 (make-variable-buffer-local 'mode-line-mule-info
)
186 (defvar mode-line-client
188 (:propertize
("" (:eval
(if (frame-parameter nil
'client
) "@" "")))
189 help-echo
,(purecopy "emacsclient frame")))
190 "Mode line construct for identifying emacsclient frames.")
192 (put 'mode-line-client
'risky-local-variable t
)
194 (defun mode-line-read-only-help-echo (window _object _point
)
195 "Return help text specifying WINDOW's buffer read-only status."
196 (format "Buffer is %s\nmouse-1: Toggle"
197 (if (buffer-local-value 'buffer-read-only
(window-buffer window
))
201 (defun mode-line-modified-help-echo (window _object _point
)
202 "Return help text specifying WINDOW's buffer modification status."
203 (format "Buffer is %smodified\nmouse-1: Toggle modification state"
204 (if (buffer-modified-p (window-buffer window
)) "" "not ")))
206 (defvar mode-line-modified
209 'help-echo
'mode-line-read-only-help-echo
210 'local-map
(purecopy (make-mode-line-mouse-map
212 #'mode-line-toggle-read-only
))
213 'mouse-face
'mode-line-highlight
)
216 'help-echo
'mode-line-modified-help-echo
217 'local-map
(purecopy (make-mode-line-mouse-map
218 'mouse-1
#'mode-line-toggle-modified
))
219 'mouse-face
'mode-line-highlight
))
220 "Mode line construct for displaying whether current buffer is modified.")
222 (put 'mode-line-modified
'risky-local-variable t
)
223 (make-variable-buffer-local 'mode-line-modified
)
225 (defvar mode-line-remote
228 'mouse-face
'mode-line-highlight
229 'help-echo
(purecopy (lambda (window _object _point
)
231 (with-selected-window window
232 (if (stringp default-directory
)
234 (if (file-remote-p default-directory
)
235 "Current directory is remote: "
236 "Current directory is local: ")
238 "Current directory is nil")))))))
239 "Mode line construct to indicate a remote buffer.")
241 (put 'mode-line-remote
'risky-local-variable t
)
242 (make-variable-buffer-local 'mode-line-remote
)
244 ;; MSDOS frames have window-system, but want the Fn identification.
245 (defun mode-line-frame-control ()
246 "Compute mode line construct for frame identification.
247 Value is used for `mode-line-frame-identification', which see."
248 (if (or (null window-system
)
249 (eq window-system
'pc
))
253 ;; We need to defer the call to mode-line-frame-control to the time
254 ;; the mode line is actually displayed.
255 (defvar mode-line-frame-identification
'(:eval
(mode-line-frame-control))
256 "Mode line construct to describe the current frame.")
258 (put 'mode-line-frame-identification
'risky-local-variable t
)
260 (defvar mode-line-process nil
261 "Mode line construct for displaying info on process status.
262 Normally nil in most modes, since there is no process to display.")
264 (put 'mode-line-process
'risky-local-variable t
)
265 (make-variable-buffer-local 'mode-line-process
)
267 (defun bindings--define-key (map key item
)
268 "Make as much as possible of the menus pure."
272 ((not (consp item
)) item
) ;Not sure that could be other than a symbol.
273 ;; Keymaps can't be made pure otherwise users can't remove/add elements
274 ;; from/to them any more.
275 ((keymapp item
) item
)
276 ((stringp (car item
))
277 (if (keymapp (cdr item
))
278 (cons (purecopy (car item
)) (cdr item
))
280 ((eq 'menu-item
(car item
))
281 (if (keymapp (nth 2 item
))
282 `(menu-item ,(purecopy (nth 1 item
)) ,(nth 2 item
)
283 ,@(purecopy (nthcdr 3 item
)))
285 (t (message "non-menu-item: %S" item
) item
))))
287 (defvar mode-line-mode-menu
(make-sparse-keymap "Minor Modes") "\
288 Menu of mode operations in the mode line.")
290 (defvar mode-line-major-mode-keymap
291 (let ((map (make-sparse-keymap)))
292 (bindings--define-key map
[mode-line down-mouse-1
]
293 `(menu-item "Menu Bar" ignore
294 :filter
,(lambda (_) (mouse-menu-major-mode-map))))
295 (define-key map
[mode-line mouse-2
] 'describe-mode
)
296 (define-key map
[mode-line down-mouse-3
] mode-line-mode-menu
)
298 Keymap to display on major mode.")
300 (defvar mode-line-minor-mode-keymap
301 (let ((map (make-sparse-keymap)))
302 (define-key map
[mode-line down-mouse-1
] 'mouse-minor-mode-menu
)
303 (define-key map
[mode-line mouse-2
] 'mode-line-minor-mode-help
)
304 (define-key map
[mode-line down-mouse-3
] mode-line-mode-menu
)
305 (define-key map
[header-line down-mouse-3
] mode-line-mode-menu
)
307 Keymap to display on minor modes.")
309 (defvar mode-line-modes
310 (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out"))
311 (list (propertize "%[" 'help-echo recursive-edit-help-echo
)
313 `(:propertize
("" mode-name
)
314 help-echo
"Major mode\n\
315 mouse-1: Display major mode menu\n\
316 mouse-2: Show help for major mode\n\
317 mouse-3: Toggle minor modes"
318 mouse-face mode-line-highlight
319 local-map
,mode-line-major-mode-keymap
)
320 '("" mode-line-process
)
321 `(:propertize
("" minor-mode-alist
)
322 mouse-face mode-line-highlight
323 help-echo
"Minor mode\n\
324 mouse-1: Display minor mode menu\n\
325 mouse-2: Show help for minor mode\n\
326 mouse-3: Toggle minor modes"
327 local-map
,mode-line-minor-mode-keymap
)
328 (propertize "%n" 'help-echo
"mouse-2: Remove narrowing from buffer"
329 'mouse-face
'mode-line-highlight
330 'local-map
(make-mode-line-mouse-map
331 'mouse-2
#'mode-line-widen
))
333 (propertize "%]" 'help-echo recursive-edit-help-echo
)
335 "Mode line construct for displaying major and minor modes.")
336 (put 'mode-line-modes
'risky-local-variable t
)
338 (defvar mode-line-column-line-number-mode-map
339 (let ((map (make-sparse-keymap))
340 (menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
341 (bindings--define-key menu-map
[size-indication-mode
]
342 '(menu-item "Display Size Indication" size-indication-mode
343 :help
"Toggle displaying a size indication in the mode-line"
344 :button
(:toggle . size-indication-mode
)))
345 (bindings--define-key menu-map
[line-number-mode
]
346 '(menu-item "Display Line Numbers" line-number-mode
347 :help
"Toggle displaying line numbers in the mode-line"
348 :button
(:toggle . line-number-mode
)))
349 (bindings--define-key menu-map
[column-number-mode
]
350 '(menu-item "Display Column Numbers" column-number-mode
351 :help
"Toggle displaying column numbers in the mode-line"
352 :button
(:toggle . column-number-mode
)))
353 (define-key map
[mode-line down-mouse-1
] menu-map
)
355 Keymap to display on column and line numbers.")
357 (defcustom column-number-indicator-zero-based t
358 "When non-nil, mode line displays column numbers zero-based.
360 This variable has effect only when Column Number mode is turned on,
361 which displays column numbers in the mode line.
362 If the value is non-nil, the displayed column numbers start from
363 zero, otherwise they start from one."
368 (defcustom mode-line-percent-position
'(-3 "%p")
369 "Specification of \"percentage offset\" of window through buffer.
370 This option specifies both the field width and the type of offset
371 displayed in `mode-line-position', a component of the default
374 (const :tag
"nil: No offset is displayed" nil
)
375 (const :tag
"\"%o\": Proportion of \"travel\" of the window through the buffer"
377 (const :tag
"\"%p\": Percentage offset of top of window"
379 (const :tag
"\"%P\": Percentage offset of bottom of window"
381 (const :tag
"\"%q\": Offsets of both top and bottom of window"
385 (put 'mode-line-percent-position
'risky-local-variable t
)
387 (defvar mode-line-position
389 mode-line-percent-position
390 local-map
,mode-line-column-line-number-mode-map
391 mouse-face mode-line-highlight
392 ;; XXX needs better description
393 help-echo
"Size indication mode\n\
394 mouse-1: Display Line and Column Mode Menu")
395 (size-indication-mode
398 'local-map mode-line-column-line-number-mode-map
399 'mouse-face
'mode-line-highlight
400 ;; XXX needs better description
401 'help-echo
"Size indication mode\n\
402 mouse-1: Display Line and Column Mode Menu")))
405 (column-number-indicator-zero-based
408 'local-map mode-line-column-line-number-mode-map
409 'mouse-face
'mode-line-highlight
410 'help-echo
"Line number and Column number\n\
411 mouse-1: Display Line and Column Mode Menu"))
414 'local-map mode-line-column-line-number-mode-map
415 'mouse-face
'mode-line-highlight
416 'help-echo
"Line number and Column number\n\
417 mouse-1: Display Line and Column Mode Menu")))
420 'local-map mode-line-column-line-number-mode-map
421 'mouse-face
'mode-line-highlight
422 'help-echo
"Line Number\n\
423 mouse-1: Display Line and Column Mode Menu"))))
425 (column-number-indicator-zero-based
428 'local-map mode-line-column-line-number-mode-map
429 'mouse-face
'mode-line-highlight
430 'help-echo
"Column number\n\
431 mouse-1: Display Line and Column Mode Menu"))
434 'local-map mode-line-column-line-number-mode-map
435 'mouse-face
'mode-line-highlight
436 'help-echo
"Column number\n\
437 mouse-1: Display Line and Column Mode Menu")))))))
438 "Mode line construct for displaying the position in the buffer.
439 Normally displays the buffer percentage and, optionally, the
440 buffer size, the line number and the column number.")
441 (put 'mode-line-position
'risky-local-variable t
)
443 (defvar mode-line-buffer-identification-keymap
444 ;; Add menu of buffer operations to the buffer identification part
445 ;; of the mode line.or header line.
446 (let ((map (make-sparse-keymap)))
447 ;; Bind down- events so that the global keymap won't ``shine
449 (define-key map
[mode-line mouse-1
] 'mode-line-previous-buffer
)
450 (define-key map
[header-line down-mouse-1
] 'ignore
)
451 (define-key map
[header-line mouse-1
] 'mode-line-previous-buffer
)
452 (define-key map
[mode-line mouse-3
] 'mode-line-next-buffer
)
453 (define-key map
[header-line down-mouse-3
] 'ignore
)
454 (define-key map
[header-line mouse-3
] 'mode-line-next-buffer
)
456 Keymap for what is displayed by `mode-line-buffer-identification'.")
458 (defun propertized-buffer-identification (fmt)
459 "Return a list suitable for `mode-line-buffer-identification'.
460 FMT is a format specifier such as \"%12b\". This function adds
461 text properties for face, help-echo, and local-map to it."
462 (list (propertize fmt
463 'face
'mode-line-buffer-id
465 (purecopy "Buffer name
466 mouse-1: Previous buffer\nmouse-3: Next buffer")
467 'mouse-face
'mode-line-highlight
468 'local-map mode-line-buffer-identification-keymap
)))
470 (defvar mode-line-buffer-identification
471 (propertized-buffer-identification "%12b")
472 "Mode line construct for identifying the buffer being displayed.
473 Its default value is (\"%12b\") with some text properties added.
474 Major modes that edit things other than ordinary files may change this
475 \(e.g. Info, Dired,...)")
477 (put 'mode-line-buffer-identification
'risky-local-variable t
)
478 (make-variable-buffer-local 'mode-line-buffer-identification
)
480 (defvar mode-line-misc-info
481 '((global-mode-string ("" global-mode-string
" ")))
482 "Mode line construct for miscellaneous information.
483 By default, this shows the information specified by `global-mode-string'.")
484 (put 'mode-line-misc-info
'risky-local-variable t
)
486 (defvar mode-line-end-spaces
'(:eval
(unless (display-graphic-p) "-%-"))
487 "Mode line construct to put at the end of the mode line.")
488 (put 'mode-line-end-spaces
'risky-local-variable t
)
490 ;; Default value of the top-level `mode-line-format' variable:
491 (let ((standard-mode-line-format
493 'mode-line-front-space
498 'mode-line-frame-identification
499 'mode-line-buffer-identification
506 'mode-line-end-spaces
)))
507 (setq-default mode-line-format standard-mode-line-format
)
508 (put 'mode-line-format
'standard-value
509 (list `(quote ,standard-mode-line-format
))))
512 (defun mode-line-unbury-buffer (event) "\
513 Call `unbury-buffer' in this window."
515 (with-selected-window (posn-window (event-start event
))
518 (defun mode-line-bury-buffer (event) "\
519 Like `bury-buffer', but temporarily select EVENT's window."
521 (with-selected-window (posn-window (event-start event
))
524 (defun mode-line-other-buffer () "\
525 Switch to the most recently selected buffer other than the current one."
527 (switch-to-buffer (other-buffer) nil t
))
529 (defun mode-line-next-buffer (event)
530 "Like `next-buffer', but temporarily select EVENT's window."
532 (with-selected-window (posn-window (event-start event
))
535 (defun mode-line-previous-buffer (event)
536 "Like `previous-buffer', but temporarily select EVENT's window."
538 (with-selected-window (posn-window (event-start event
))
541 (defmacro bound-and-true-p
(var)
542 "Return the value of symbol VAR if it is bound, else nil."
543 `(and (boundp (quote ,var
)) ,var
))
545 ;; Use mode-line-mode-menu for local minor-modes only.
546 ;; Global ones can go on the menubar (Options --> Show/Hide).
547 (bindings--define-key mode-line-mode-menu
[overwrite-mode
]
548 '(menu-item "Overwrite (Ovwrt)" overwrite-mode
549 :help
"Overwrite mode: typed characters replace existing text"
550 :button
(:toggle . overwrite-mode
)))
551 (bindings--define-key mode-line-mode-menu
[outline-minor-mode
]
552 '(menu-item "Outline (Outl)" outline-minor-mode
553 ;; XXX: This needs a good, brief description.
555 :button
(:toggle .
(bound-and-true-p outline-minor-mode
))))
556 (bindings--define-key mode-line-mode-menu
[highlight-changes-mode
]
557 '(menu-item "Highlight changes (Chg)" highlight-changes-mode
558 :help
"Show changes in the buffer in a distinctive color"
559 :button
(:toggle .
(bound-and-true-p highlight-changes-mode
))))
560 (bindings--define-key mode-line-mode-menu
[hide-ifdef-mode
]
561 '(menu-item "Hide ifdef (Ifdef)" hide-ifdef-mode
562 :help
"Show/Hide code within #ifdef constructs"
563 :button
(:toggle .
(bound-and-true-p hide-ifdef-mode
))))
564 (bindings--define-key mode-line-mode-menu
[glasses-mode
]
565 '(menu-item "Glasses (o^o)" glasses-mode
566 :help
"Insert virtual separators to make long identifiers easy to read"
567 :button
(:toggle .
(bound-and-true-p glasses-mode
))))
568 (bindings--define-key mode-line-mode-menu
[font-lock-mode
]
569 '(menu-item "Font Lock" font-lock-mode
570 :help
"Syntax coloring"
571 :button
(:toggle . font-lock-mode
)))
572 (bindings--define-key mode-line-mode-menu
[flyspell-mode
]
573 '(menu-item "Flyspell (Fly)" flyspell-mode
574 :help
"Spell checking on the fly"
575 :button
(:toggle .
(bound-and-true-p flyspell-mode
))))
576 (bindings--define-key mode-line-mode-menu
[auto-revert-tail-mode
]
577 '(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode
578 :help
"Revert the tail of the buffer when buffer grows"
579 :enable
(buffer-file-name)
580 :button
(:toggle .
(bound-and-true-p auto-revert-tail-mode
))))
581 (bindings--define-key mode-line-mode-menu
[auto-revert-mode
]
582 '(menu-item "Auto revert (ARev)" auto-revert-mode
583 :help
"Revert the buffer when the file on disk changes"
584 :button
(:toggle .
(bound-and-true-p auto-revert-mode
))))
585 (bindings--define-key mode-line-mode-menu
[auto-fill-mode
]
586 '(menu-item "Auto fill (Fill)" auto-fill-mode
587 :help
"Automatically insert new lines"
588 :button
(:toggle . auto-fill-function
)))
589 (bindings--define-key mode-line-mode-menu
[abbrev-mode
]
590 '(menu-item "Abbrev (Abbrev)" abbrev-mode
591 :help
"Automatically expand abbreviations"
592 :button
(:toggle . abbrev-mode
)))
594 (defun mode-line-minor-mode-help (event)
595 "Describe minor mode for EVENT on minor modes area of the mode line."
597 (let ((indicator (car (nth 4 (car (cdr event
))))))
598 (describe-minor-mode-from-indicator indicator
)))
600 (defvar minor-mode-alist nil
"\
601 Alist saying how to show minor modes in the mode line.
602 Each element looks like (VARIABLE STRING);
603 STRING is included in the mode line if VARIABLE's value is non-nil.
605 Actually, STRING need not be a string; any mode-line construct is
606 okay. See `mode-line-format'.")
608 (put 'minor-mode-alist
'risky-local-variable t
)
609 ;; Don't use purecopy here--some people want to change these strings.
610 (setq minor-mode-alist
611 '((abbrev-mode " Abbrev")
612 (overwrite-mode overwrite-mode
)
613 (auto-fill-function " Fill")
614 ;; not really a minor mode...
615 (defining-kbd-macro " Def")))
617 ;; These variables are used by autoloadable packages.
618 ;; They are defined here so that they do not get overridden
619 ;; by the loading of those packages.
621 ;; Names in directory that end in one of these
622 ;; are ignored in completion,
623 ;; making it more likely you will get a unique match.
624 (setq completion-ignored-extensions
626 (cond ((memq system-type
'(ms-dos windows-nt
))
628 '(".o" "~" ".bin" ".bak" ".obj" ".map" ".ico" ".pif" ".lnk"
629 ".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386")))
632 '(".o" "~" ".bin" ".lbin" ".so"
633 ".a" ".ln" ".blg" ".bbl"))))
637 ;; VCS metadata directories
638 ".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/"
647 ;; OpenMCL / Clozure CL
648 ".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl"
649 ".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl"
650 ".sx32fsl" ".wx64fsl" ".wx32fsl"
651 ;; Other CL implementations (Allegro, LispWorks)
652 ".fasl" ".ufsl" ".fsl" ".dxl"
658 ;; This used to contain .log, but that's commonly used for log
659 ;; files you do want to see, not just TeX stuff. -- fx
661 ".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
662 ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs"
663 ;; Python byte-compiled
666 ;; Suffixes used for executables.
669 ((memq system-type
'(ms-dos windows-nt
))
670 '(".exe" ".com" ".bat" ".cmd" ".btm" ""))
674 ;; Packages should add to this list appropriately when they are
675 ;; loaded, rather than listing everything here.
676 (setq debug-ignored-errors
677 ;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line,
678 ;; end-of-buffer, end-of-file, buffer-read-only, and
679 ;; file-supersession should all be user-errors!
680 `(beginning-of-line beginning-of-buffer end-of-line
681 end-of-buffer end-of-file buffer-read-only
682 file-supersession mark-inactive
683 user-error
;; That's the main one!
686 (make-variable-buffer-local 'indent-tabs-mode
)
688 ;; These per-buffer variables are never reset by
689 ;; `kill-all-local-variables', because they have no default value.
690 ;; For consistency, we give them the `permanent-local' property, even
691 ;; though `kill-all-local-variables' does not actually consult it.
693 (mapc (lambda (sym) (put sym
'permanent-local t
))
694 '(buffer-file-name default-directory buffer-backed-up
695 buffer-saved-size buffer-auto-save-file-name
696 buffer-read-only buffer-undo-list mark-active
697 point-before-scroll buffer-file-truename
698 buffer-file-format buffer-auto-save-file-format
699 buffer-display-count buffer-display-time
700 enable-multibyte-characters
))
702 ;; We have base64, md5 and sha1 functions built in now.
706 (provide 'overlay
'(display syntax-table field
))
707 (provide 'text-properties
'(display syntax-table field point-entered
))
709 (define-key esc-map
"\t" 'complete-symbol
)
711 (defun complete-symbol (arg)
712 "Perform completion on the text around point.
713 The completion method is determined by `completion-at-point-functions'.
715 With a prefix argument, this command does completion within
716 the collection of symbols listed in the index of the manual for the
717 language you are using."
719 (if arg
(info-complete-symbol) (completion-at-point)))
721 ;; Reduce total amount of space we must allocate during this function
722 ;; that we will not need to keep permanently.
726 (setq help-event-list
'(help f1 ?
\?))
728 (make-variable-buffer-local 'minor-mode-overriding-map-alist
)
731 (global-set-key [switch-frame
] 'handle-switch-frame
)
732 (global-set-key [select-window
] 'handle-select-window
)
734 ;; FIXME: Do those 3 events really ever reach the global-map ?
735 ;; It seems that they can't because they're handled via
736 ;; special-event-map which is used at very low-level. -stef
737 (global-set-key [delete-frame
] 'handle-delete-frame
)
738 (global-set-key [iconify-frame
] 'ignore-event
)
739 (global-set-key [make-frame-visible
] 'ignore-event
)
742 ;These commands are defined in editfns.c
743 ;but they are not assigned to keys there.
744 (put 'narrow-to-region
'disabled t
)
746 ;; Moving with arrows in bidi-sensitive direction.
747 (defcustom visual-order-cursor-movement nil
748 "If non-nil, moving cursor with arrow keys follows the visual order.
750 When this is non-nil, \\[right-char] will move to the character that is
751 to the right of point on display, and \\[left-char] will move to the left,
752 disregarding the surrounding bidirectional context. Depending on the
753 bidirectional context of the surrounding characters, this can move point
754 many buffer positions away.
756 When the text is entirely left-to-right, logical-order and visual-order
757 cursor movements produce identical results."
758 :type
'(choice (const :tag
"Logical-order cursor movement" nil
)
759 (const :tag
"Visual-order cursor movement" t
))
763 (defun right-char (&optional n
)
764 "Move point N characters to the right (to the left if N is negative).
765 On reaching beginning or end of buffer, stop and signal error.
767 If `visual-order-cursor-movement' is non-nil, this always moves
768 to the right on display, wherever that is in the buffer.
769 Otherwise, depending on the bidirectional context, this may move
770 one position either forward or backward in the buffer. This is
771 in contrast with \\[forward-char] and \\[backward-char], which
774 (if visual-order-cursor-movement
775 (dotimes (i (if (numberp n
) (abs n
) 1))
776 (move-point-visually (if (and (numberp n
) (< n
0)) -
1 1)))
777 (if (eq (current-bidi-paragraph-direction) 'left-to-right
)
781 (defun left-char ( &optional n
)
782 "Move point N characters to the left (to the right if N is negative).
783 On reaching beginning or end of buffer, stop and signal error.
785 If `visual-order-cursor-movement' is non-nil, this always moves
786 to the left on display, wherever that is in the buffer.
787 Otherwise, depending on the bidirectional context, this may move
788 one position either backward or forward in the buffer. This is
789 in contrast with \\[forward-char] and \\[backward-char], which
792 (if visual-order-cursor-movement
793 (dotimes (i (if (numberp n
) (abs n
) 1))
794 (move-point-visually (if (and (numberp n
) (< n
0)) 1 -
1)))
795 (if (eq (current-bidi-paragraph-direction) 'left-to-right
)
799 (defun right-word (&optional n
)
800 "Move point N words to the right (to the left if N is negative).
802 Depending on the bidirectional context, this may move either forward
803 or backward in the buffer. This is in contrast with \\[forward-word]
804 and \\[backward-word], which see.
807 If an edge of the buffer or a field boundary is reached, point is left there
808 there and the function returns nil. Field boundaries are not noticed
809 if `inhibit-field-text-motion' is non-nil."
811 (if (eq (current-bidi-paragraph-direction) 'left-to-right
)
815 (defun left-word (&optional n
)
816 "Move point N words to the left (to the right if N is negative).
818 Depending on the bidirectional context, this may move either backward
819 or forward in the buffer. This is in contrast with \\[backward-word]
820 and \\[forward-word], which see.
823 If an edge of the buffer or a field boundary is reached, point is left there
824 there and the function returns nil. Field boundaries are not noticed
825 if `inhibit-field-text-motion' is non-nil."
827 (if (eq (current-bidi-paragraph-direction) 'left-to-right
)
831 (defvar narrow-map
(make-sparse-keymap)
832 "Keymap for narrowing commands.")
833 (define-key ctl-x-map
"n" narrow-map
)
835 (define-key narrow-map
"n" 'narrow-to-region
)
836 (define-key narrow-map
"w" 'widen
)
839 (define-key global-map
"\e\e\e" 'keyboard-escape-quit
)
840 (define-key global-map
"\C-g" 'keyboard-quit
)
842 ;; Used to be in termdev.el: when using several terminals, make C-z
843 ;; suspend only the relevant terminal.
844 (substitute-key-definition 'suspend-emacs
'suspend-frame global-map
)
846 (define-key global-map
"\C-m" 'newline
)
847 (define-key global-map
"\C-o" 'open-line
)
848 (define-key esc-map
"\C-o" 'split-line
)
849 (define-key global-map
"\C-q" 'quoted-insert
)
850 (define-key esc-map
"^" 'delete-indentation
)
851 (define-key esc-map
"\\" 'delete-horizontal-space
)
852 (define-key esc-map
"m" 'back-to-indentation
)
853 (define-key ctl-x-map
"\C-o" 'delete-blank-lines
)
854 (define-key esc-map
" " 'just-one-space
)
855 (define-key esc-map
"z" 'zap-to-char
)
856 (define-key esc-map
"=" 'count-words-region
)
857 (define-key ctl-x-map
"=" 'what-cursor-position
)
858 (define-key esc-map
":" 'eval-expression
)
859 ;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
860 (define-key esc-map
"\M-:" 'eval-expression
)
861 ;; Changed from C-x ESC so that function keys work following C-x.
862 (define-key ctl-x-map
"\e\e" 'repeat-complex-command
)
863 ;; New binding analogous to M-:.
864 (define-key ctl-x-map
"\M-:" 'repeat-complex-command
)
865 (define-key ctl-x-map
"u" 'undo
)
866 (put 'undo
:advertised-binding
[?\C-x ?u
])
867 ;; Many people are used to typing C-/ on X terminals and getting C-_.
868 (define-key global-map
[?\C-
/] 'undo
)
869 (define-key global-map
"\C-_" 'undo
)
870 ;; Richard said that we should not use C-x <uppercase letter> and I have
871 ;; no idea whereas to bind it. Any suggestion welcome. -stef
872 ;; (define-key ctl-x-map "U" 'undo-only)
874 (define-key esc-map
"!" 'shell-command
)
875 (define-key esc-map
"|" 'shell-command-on-region
)
876 (define-key esc-map
"&" 'async-shell-command
)
878 (define-key ctl-x-map
[right] 'next-buffer)
879 (define-key ctl-x-map [C-right] 'next-buffer)
880 (define-key global-map [XF86Forward] 'next-buffer)
881 (define-key ctl-x-map [left] 'previous-buffer)
882 (define-key ctl-x-map [C-left] 'previous-buffer)
883 (define-key global-map [XF86Back] 'previous-buffer)
885 (let ((map minibuffer-local-map))
886 (define-key map "\en" 'next-history-element)
887 (define-key map [next] 'next-history-element)
888 (define-key map [down] 'next-line-or-history-element)
889 (define-key map [XF86Forward] 'next-history-element)
890 (define-key map "\ep" 'previous-history-element)
891 (define-key map [prior] 'previous-history-element)
892 (define-key map [up] 'previous-line-or-history-element)
893 (define-key map [XF86Back] 'previous-history-element)
894 (define-key map "\es" 'next-matching-history-element)
895 (define-key map "\er" 'previous-matching-history-element)
896 ;; Override the global binding (which calls indent-relative via
897 ;; indent-for-tab-command). The alignment that indent-relative tries to
898 ;; do doesn't make much sense here since the prompt messes it up.
899 (define-key map "\t" 'self-insert-command)
900 (define-key map [C-tab] 'file-cache-minibuffer-complete))
902 (define-key global-map "\C-u" 'universal-argument)
905 (define-key esc-map (char-to-string i) 'digit-argument)
907 (define-key esc-map "-" 'negative-argument)
908 ;; Define control-digits.
911 (define-key global-map (read (format "[?\\C-%c]" i)) 'digit-argument)
913 (define-key global-map [?\C--] 'negative-argument)
914 ;; Define control-meta-digits.
917 (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
919 (define-key global-map [?\C-\M--] 'negative-argument)
921 ;; Update tutorial--default-keys if you change these.
922 (define-key global-map "\177" 'delete-backward-char)
923 ;; We explicitly want C-d to use `delete-char' instead of
924 ;; `delete-forward-char' so that it ignores `delete-active-region':
925 ;; Most C-d users are old-timers who don't expect
926 ;; `delete-active-region' here, while newer users who expect
927 ;; `delete-active-region' use C-d much less.
928 (define-key global-map "\C-d" 'delete-char)
930 (define-key global-map "\C-k" 'kill-line)
931 (define-key global-map "\C-w" 'kill-region)
932 (define-key esc-map "w" 'kill-ring-save)
933 (define-key esc-map "\C-w" 'append-next-kill)
934 (define-key global-map "\C-y" 'yank)
935 (define-key esc-map "y" 'yank-pop)
937 ;; (define-key ctl-x-map "a" 'append-to-buffer)
939 (define-key global-map "\C-@" 'set-mark-command)
940 ;; Many people are used to typing C-SPC and getting C-@.
941 (define-key global-map [?\C- ] 'set-mark-command)
942 (put 'set-mark-command :advertised-binding [?\C- ])
944 (define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
945 (define-key ctl-x-map "\C-@" 'pop-global-mark)
946 (define-key ctl-x-map " " 'rectangle-mark-mode)
947 (define-key ctl-x-map [?\C- ] 'pop-global-mark)
949 (define-key global-map "\C-n" 'next-line)
950 (define-key global-map "\C-p" 'previous-line)
951 (define-key ctl-x-map "\C-n" 'set-goal-column)
952 (define-key global-map "\C-a" 'move-beginning-of-line)
953 (define-key global-map "\C-e" 'move-end-of-line)
955 (define-key ctl-x-map "`" 'next-error)
957 (defvar goto-map (make-sparse-keymap)
958 "Keymap for navigation commands.")
959 (define-key esc-map "g" goto-map)
961 (define-key goto-map "c" 'goto-char)
962 (define-key goto-map "g" 'goto-line)
963 (define-key goto-map "\M-g" 'goto-line)
964 (define-key goto-map "n" 'next-error)
965 (define-key goto-map "\M-n" 'next-error)
966 (define-key goto-map "p" 'previous-error)
967 (define-key goto-map "\M-p" 'previous-error)
968 (define-key goto-map "\t" 'move-to-column)
970 (defvar search-map (make-sparse-keymap)
971 "Keymap for search related commands.")
972 (define-key esc-map "s" search-map)
974 (define-key search-map "o" 'occur)
975 (define-key search-map "\M-w" 'eww-search-words)
976 (define-key search-map "hr" 'highlight-regexp)
977 (define-key search-map "hp" 'highlight-phrase)
978 (define-key search-map "hl" 'highlight-lines-matching-regexp)
979 (define-key search-map "h." 'highlight-symbol-at-point)
980 (define-key search-map "hu" 'unhighlight-regexp)
981 (define-key search-map "hf" 'hi-lock-find-patterns)
982 (define-key search-map "hw" 'hi-lock-write-interactive-patterns)
984 ;;(defun function-key-error ()
986 ;; (error "That function key is not bound to anything"))
988 (define-key global-map [menu] 'execute-extended-command)
989 (define-key global-map [find] 'search-forward)
991 ;; Don't do this. We define <delete> in function-key-map instead.
992 ;(define-key global-map [delete] 'backward-delete-char)
994 ;; natural bindings for terminal keycaps --- defined in X keysym order
995 (define-key global-map [C-S-backspace] 'kill-whole-line)
996 (define-key global-map [home] 'move-beginning-of-line)
997 (define-key global-map [C-home] 'beginning-of-buffer)
998 (define-key global-map [M-home] 'beginning-of-buffer-other-window)
999 (define-key esc-map [home] 'beginning-of-buffer-other-window)
1000 (define-key global-map [left] 'left-char)
1001 (define-key global-map [up] 'previous-line)
1002 (define-key global-map [right] 'right-char
)
1003 (define-key global-map
[down] 'next-line)
1004 (define-key global-map [prior] 'scroll-down-command)
1005 (define-key global-map [next] 'scroll-up-command)
1006 (define-key global-map [C-up] 'backward-paragraph)
1007 (define-key global-map [C-down] 'forward-paragraph)
1008 (define-key global-map [C-prior] 'scroll-right)
1009 (put 'scroll-left 'disabled t)
1010 (define-key global-map [C-next] 'scroll-left)
1011 (define-key global-map [M-next] 'scroll-other-window)
1012 (define-key esc-map [next] 'scroll-other-window)
1013 (define-key global-map [M-prior] 'scroll-other-window-down)
1014 (define-key esc-map [prior] 'scroll-other-window-down)
1015 (define-key esc-map [?\C-\S-v] 'scroll-other-window-down)
1016 (define-key global-map [end] 'move-end-of-line)
1017 (define-key global-map [C-end] 'end-of-buffer)
1018 (define-key global-map [M-end] 'end-of-buffer-other-window)
1019 (define-key esc-map [end] 'end-of-buffer-other-window)
1020 (define-key global-map [begin] 'beginning-of-buffer)
1021 (define-key global-map [M-begin] 'beginning-of-buffer-other-window)
1022 (define-key esc-map [begin] 'beginning-of-buffer-other-window)
1023 ;; (define-key global-map [select] 'function-key-error)
1024 ;; (define-key global-map [print] 'function-key-error)
1025 (define-key global-map [execute] 'execute-extended-command)
1026 (define-key global-map [insert] 'overwrite-mode)
1027 (define-key global-map [C-insert] 'kill-ring-save)
1028 (define-key global-map [S-insert] 'yank)
1029 ;; `insertchar' is what term.c produces. Should we change term.c
1030 ;; to produce `insert' instead?
1031 (define-key global-map [insertchar] 'overwrite-mode)
1032 (define-key global-map [C-insertchar] 'kill-ring-save)
1033 (define-key global-map [S-insertchar] 'yank)
1034 (define-key global-map [undo] 'undo)
1035 (define-key global-map [redo] 'repeat-complex-command)
1036 (define-key global-map [again] 'repeat-complex-command) ; Sun keyboard
1037 (define-key global-map [open] 'find-file) ; Sun
1038 ;; The following wouldn't work to interrupt running code since C-g is
1039 ;; treated specially in the event loop.
1040 ;; (define-key global-map [stop] 'keyboard-quit) ; Sun
1041 ;; (define-key global-map [clearline] 'function-key-error)
1042 (define-key global-map [insertline] 'open-line)
1043 (define-key global-map [deleteline] 'kill-line)
1044 (define-key global-map [deletechar] 'delete-forward-char)
1045 ;; (define-key global-map [backtab] 'function-key-error)
1046 ;; (define-key global-map [f1] 'function-key-error)
1047 ;; (define-key global-map [f2] 'function-key-error)
1048 ;; (define-key global-map [f3] 'function-key-error)
1049 ;; (define-key global-map [f4] 'function-key-error)
1050 ;; (define-key global-map [f5] 'function-key-error)
1051 ;; (define-key global-map [f6] 'function-key-error)
1052 ;; (define-key global-map [f7] 'function-key-error)
1053 ;; (define-key global-map [f8] 'function-key-error)
1054 ;; (define-key global-map [f9] 'function-key-error)
1055 ;; (define-key global-map [f10] 'function-key-error)
1056 ;; (define-key global-map [f11] 'function-key-error)
1057 ;; (define-key global-map [f12] 'function-key-error)
1058 ;; (define-key global-map [f13] 'function-key-error)
1059 ;; (define-key global-map [f14] 'function-key-error)
1060 ;; (define-key global-map [f15] 'function-key-error)
1061 ;; (define-key global-map [f16] 'function-key-error)
1062 ;; (define-key global-map [f17] 'function-key-error)
1063 ;; (define-key global-map [f18] 'function-key-error)
1064 ;; (define-key global-map [f19] 'function-key-error)
1065 ;; (define-key global-map [f20] 'function-key-error)
1066 ;; (define-key global-map [f21] 'function-key-error)
1067 ;; (define-key global-map [f22] 'function-key-error)
1068 ;; (define-key global-map [f23] 'function-key-error)
1069 ;; (define-key global-map [f24] 'function-key-error)
1070 ;; (define-key global-map [f25] 'function-key-error)
1071 ;; (define-key global-map [f26] 'function-key-error)
1072 ;; (define-key global-map [f27] 'function-key-error)
1073 ;; (define-key global-map [f28] 'function-key-error)
1074 ;; (define-key global-map [f29] 'function-key-error)
1075 ;; (define-key global-map [f30] 'function-key-error)
1076 ;; (define-key global-map [f31] 'function-key-error)
1077 ;; (define-key global-map [f32] 'function-key-error)
1078 ;; (define-key global-map [f33] 'function-key-error)
1079 ;; (define-key global-map [f34] 'function-key-error)
1080 ;; (define-key global-map [f35] 'function-key-error)
1081 ;; (define-key global-map [kp-backtab] 'function-key-error)
1082 ;; (define-key global-map [kp-space] 'function-key-error)
1083 ;; (define-key global-map [kp-tab] 'function-key-error)
1084 ;; (define-key global-map [kp-enter] 'function-key-error)
1085 ;; (define-key global-map [kp-f1] 'function-key-error)
1086 ;; (define-key global-map [kp-f2] 'function-key-error)
1087 ;; (define-key global-map [kp-f3] 'function-key-error)
1088 ;; (define-key global-map [kp-f4] 'function-key-error)
1089 ;; (define-key global-map [kp-multiply] 'function-key-error)
1090 ;; (define-key global-map [kp-add] 'function-key-error)
1091 ;; (define-key global-map [kp-separator] 'function-key-error)
1092 ;; (define-key global-map [kp-subtract] 'function-key-error)
1093 ;; (define-key global-map [kp-decimal] 'function-key-error)
1094 ;; (define-key global-map [kp-divide] 'function-key-error)
1095 ;; (define-key global-map [kp-0] 'function-key-error)
1096 ;; (define-key global-map [kp-1] 'function-key-error)
1097 ;; (define-key global-map [kp-2] 'function-key-error)
1098 ;; (define-key global-map [kp-3] 'function-key-error)
1099 ;; (define-key global-map [kp-4] 'function-key-error)
1100 ;; (define-key global-map [kp-5] 'recenter)
1101 ;; (define-key global-map [kp-6] 'function-key-error)
1102 ;; (define-key global-map [kp-7] 'function-key-error)
1103 ;; (define-key global-map [kp-8] 'function-key-error)
1104 ;; (define-key global-map [kp-9] 'function-key-error)
1105 ;; (define-key global-map [kp-equal] 'function-key-error)
1107 ;; X11R6 distinguishes these keys from the non-kp keys.
1108 ;; Make them behave like the non-kp keys unless otherwise bound.
1109 ;; FIXME: rather than list such mappings for every modifier-combination,
1110 ;; we should come up with a way to do it generically, something like
1111 ;; (define-key function-key-map [*-kp-home] [*-home])
1112 ;; Currently we add keypad key combinations with basic modifiers
1113 ;; (to complement plain bindings in "Keypad support" section in simple.el)
1114 ;; Until [*-kp-home] is implemented, for more modifiers we could also use:
1115 ;; (todo-powerset '(control meta shift hyper super alt)) (Bug#14397)
1116 (let ((modifiers '(nil (control) (meta) (control meta) (shift)
1117 (control shift) (meta shift) (control meta shift)))
1118 (keys '((kp-delete delete) (kp-insert insert)
1119 (kp-end end) (kp-down down) (kp-next next)
1120 (kp-left left) (kp-begin begin) (kp-right right)
1121 (kp-home home) (kp-up up) (kp-prior prior)
1122 (kp-enter enter) (kp-decimal ?.)
1123 (kp-0 ?0) (kp-1 ?1) (kp-2 ?2) (kp-3 ?3) (kp-4 ?4)
1124 (kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9)
1125 (kp-add ?+) (kp-subtract ?-) (kp-multiply ?*) (kp-divide ?/))))
1127 (let ((keypad (nth 0 pair))
1128 (normal (nth 1 pair)))
1129 (when (characterp normal)
1130 (put keypad 'ascii-character normal))
1131 (dolist (mod modifiers)
1132 (define-key function-key-map
1133 (vector (append mod (list keypad)))
1134 (vector (append mod (list normal))))))))
1136 (define-key function-key-map [backspace] [?\C-?])
1137 (define-key function-key-map [delete] [?\C-?])
1138 (define-key function-key-map [kp-delete] [?\C-?])
1140 ;; Don't bind shifted keypad numeric keys, they reportedly
1141 ;; interfere with the feature of some keyboards to produce
1142 ;; numbers when NumLock is off.
1143 ;(define-key function-key-map [S-kp-1] [S-end])
1144 ;(define-key function-key-map [S-kp-2] [S-down])
1145 ;(define-key function-key-map [S-kp-3] [S-next])
1146 ;(define-key function-key-map [S-kp-4] [S-left])
1147 ;(define-key function-key-map [S-kp-6] [S-right])
1148 ;(define-key function-key-map [S-kp-7] [S-home])
1149 ;(define-key function-key-map [S-kp-8] [S-up])
1150 ;(define-key function-key-map [S-kp-9] [S-prior])
1151 ;(define-key function-key-map [C-S-kp-1] [C-S-end])
1152 ;(define-key function-key-map [C-S-kp-2] [C-S-down])
1153 ;(define-key function-key-map [C-S-kp-3] [C-S-next])
1154 ;(define-key function-key-map [C-S-kp-4] [C-S-left])
1155 ;(define-key function-key-map [C-S-kp-6] [C-S-right])
1156 ;(define-key function-key-map [C-S-kp-7] [C-S-home])
1157 ;(define-key function-key-map [C-S-kp-8] [C-S-up])
1158 ;(define-key function-key-map [C-S-kp-9] [C-S-prior])
1160 ;; Hitting C-SPC on text terminals, usually sends the ascii code 0 (aka C-@),
1161 ;; so we can't distinguish those two keys, but usually we consider C-SPC
1162 ;; (rather than C-@) as the "canonical" binding.
1163 (define-key function-key-map [?\C-@] [?\C-\s])
1164 ;; Many keyboards don't have a `backtab' key, so by convention the user
1165 ;; can use S-tab instead to access that binding.
1166 (define-key function-key-map [S-tab] [backtab])
1168 (define-key global-map [mouse-movement] 'ignore)
1170 (define-key global-map "\C-t" 'transpose-chars)
1171 (define-key esc-map "t" 'transpose-words)
1172 (define-key esc-map "\C-t" 'transpose-sexps)
1173 (define-key ctl-x-map "\C-t" 'transpose-lines)
1175 (define-key esc-map ";" 'comment-dwim)
1176 (define-key esc-map "j" 'indent-new-comment-line)
1177 (define-key esc-map "\C-j" 'indent-new-comment-line)
1178 (define-key ctl-x-map ";" 'comment-set-column)
1179 (define-key ctl-x-map [?\C-\;] 'comment-line)
1180 (define-key ctl-x-map "f" 'set-fill-column)
1181 (define-key ctl-x-map "$" 'set-selective-display)
1183 (define-key esc-map "@" 'mark-word)
1184 (define-key esc-map "f" 'forward-word)
1185 (define-key esc-map "b" 'backward-word)
1186 (define-key esc-map "d" 'kill-word)
1187 (define-key esc-map "\177" 'backward-kill-word)
1189 (define-key esc-map "<" 'beginning-of-buffer)
1190 (define-key esc-map ">" 'end-of-buffer)
1191 (define-key ctl-x-map "h" 'mark-whole-buffer)
1192 (define-key esc-map "\\" 'delete-horizontal-space)
1194 (defalias 'mode-specific-command-prefix (make-sparse-keymap))
1195 (defvar mode-specific-map (symbol-function 'mode-specific-command-prefix)
1196 "Keymap for characters following C-c.")
1197 (define-key global-map "\C-c" 'mode-specific-command-prefix)
1199 (global-set-key [M-right] 'right-word)
1200 (define-key esc-map [right] 'forward-word)
1201 (global-set-key [M-left] 'left-word)
1202 (define-key esc-map [left] 'backward-word)
1203 ;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
1204 (global-set-key [C-right] 'right-word)
1205 (global-set-key [C-left] 'left-word)
1206 ;; This is not quite compatible, but at least is analogous
1207 (global-set-key [C-delete] 'kill-word)
1208 (global-set-key [C-backspace] 'backward-kill-word)
1209 ;; This is "move to the clipboard", or as close as we come.
1210 (global-set-key [S-delete] 'kill-region)
1212 (global-set-key [C-M-left] 'backward-sexp)
1213 (define-key esc-map [C-left] 'backward-sexp)
1214 (global-set-key [C-M-right] 'forward-sexp)
1215 (define-key esc-map [C-right] 'forward-sexp)
1216 (global-set-key [C-M-up] 'backward-up-list)
1217 (define-key esc-map [C-up] 'backward-up-list)
1218 (global-set-key [C-M-down] 'down-list)
1219 (define-key esc-map [C-down] 'down-list)
1220 (global-set-key [C-M-home] 'beginning-of-defun)
1221 (define-key esc-map [C-home] 'beginning-of-defun)
1222 (global-set-key [C-M-end] 'end-of-defun)
1223 (define-key esc-map [C-end] 'end-of-defun)
1225 (define-key esc-map "\C-f" 'forward-sexp)
1226 (define-key esc-map "\C-b" 'backward-sexp)
1227 (define-key esc-map "\C-u" 'backward-up-list)
1228 (define-key esc-map "\C-@" 'mark-sexp)
1229 (define-key esc-map [?\C-\ ] 'mark-sexp)
1230 (define-key esc-map "\C-d" 'down-list)
1231 (define-key esc-map "\C-k" 'kill-sexp)
1232 ;;; These are dangerous in various situations,
1233 ;;; so let's not encourage anyone to use them.
1234 ;;;(define-key global-map [C-M-delete] 'backward-kill-sexp)
1235 ;;;(define-key global-map [C-M-backspace] 'backward-kill-sexp)
1236 (define-key esc-map [C-delete] 'backward-kill-sexp)
1237 (define-key esc-map [C-backspace] 'backward-kill-sexp)
1238 (define-key esc-map "\C-n" 'forward-list)
1239 (define-key esc-map "\C-p" 'backward-list)
1240 (define-key esc-map "\C-a" 'beginning-of-defun)
1241 (define-key esc-map "\C-e" 'end-of-defun)
1242 (define-key esc-map "\C-h" 'mark-defun)
1243 (define-key ctl-x-map "nd" 'narrow-to-defun)
1244 (define-key esc-map "(" 'insert-parentheses)
1245 (define-key esc-map ")" 'move-past-close-and-reindent)
1247 (define-key ctl-x-map "\C-e" 'eval-last-sexp)
1249 (define-key ctl-x-map "m" 'compose-mail)
1250 (define-key ctl-x-4-map "m" 'compose-mail-other-window)
1251 (define-key ctl-x-5-map "m" 'compose-mail-other-frame)
1255 (let ((map (make-sparse-keymap)))
1256 (define-key map "c" 'clear-rectangle)
1257 (define-key map "k" 'kill-rectangle)
1258 (define-key map "d" 'delete-rectangle)
1259 (define-key map "y" 'yank-rectangle)
1260 (define-key map "o" 'open-rectangle)
1261 (define-key map "t" 'string-rectangle)
1262 (define-key map "N" 'rectangle-number-lines)
1263 (define-key map "\M-w" 'copy-rectangle-as-kill)
1264 (define-key map "\C-@" 'point-to-register)
1265 (define-key map [?\C-\ ] 'point-to-register)
1266 (define-key map " " 'point-to-register)
1267 (define-key map "j" 'jump-to-register)
1268 (define-key map "s" 'copy-to-register)
1269 (define-key map "x" 'copy-to-register)
1270 (define-key map "i" 'insert-register)
1271 (define-key map "g" 'insert-register)
1272 (define-key map "r" 'copy-rectangle-to-register)
1273 (define-key map "n" 'number-to-register)
1274 (define-key map "+" 'increment-register)
1275 (define-key map "w" 'window-configuration-to-register)
1276 (define-key map "f" 'frameset-to-register)
1278 "Keymap for subcommands of C-x r.")
1279 (define-key ctl-x-map "r" ctl-x-r-map)
1281 (define-key esc-map "q" 'fill-paragraph)
1282 (define-key ctl-x-map "." 'set-fill-prefix)
1284 (define-key esc-map "{" 'backward-paragraph)
1285 (define-key esc-map "}" 'forward-paragraph)
1286 (define-key esc-map "h" 'mark-paragraph)
1287 (define-key esc-map "a" 'backward-sentence)
1288 (define-key esc-map "e" 'forward-sentence)
1289 (define-key esc-map "k" 'kill-sentence)
1290 (define-key ctl-x-map "\177" 'backward-kill-sentence)
1292 (define-key ctl-x-map "[" 'backward-page)
1293 (define-key ctl-x-map "]" 'forward-page)
1294 (define-key ctl-x-map "\C-p" 'mark-page)
1295 (define-key ctl-x-map "l" 'count-lines-page)
1296 (define-key ctl-x-map "np" 'narrow-to-page)
1297 ;; (define-key ctl-x-map "p" 'narrow-to-page)
1299 (defvar abbrev-map (make-sparse-keymap)
1300 "Keymap for abbrev commands.")
1301 (define-key ctl-x-map "a" abbrev-map)
1303 (define-key abbrev-map "l" 'add-mode-abbrev)
1304 (define-key abbrev-map "\C-a" 'add-mode-abbrev)
1305 (define-key abbrev-map "g" 'add-global-abbrev)
1306 (define-key abbrev-map "+" 'add-mode-abbrev)
1307 (define-key abbrev-map "ig" 'inverse-add-global-abbrev)
1308 (define-key abbrev-map "il" 'inverse-add-mode-abbrev)
1309 ;; (define-key abbrev-map "\C-h" 'inverse-add-global-abbrev)
1310 (define-key abbrev-map "-" 'inverse-add-global-abbrev)
1311 (define-key abbrev-map "e" 'expand-abbrev)
1312 (define-key abbrev-map "'" 'expand-abbrev)
1313 ;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev)
1314 ;; (define-key ctl-x-map "+" 'add-global-abbrev)
1315 ;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev)
1316 ;; (define-key ctl-x-map "-" 'inverse-add-global-abbrev)
1317 (define-key esc-map "'" 'abbrev-prefix-mark)
1318 (define-key ctl-x-map "'" 'expand-abbrev)
1319 (define-key ctl-x-map "\C-b" 'list-buffers)
1321 (define-key ctl-x-map "z" 'repeat)
1323 (define-key esc-map "\C-l" 'reposition-window)
1325 (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
1326 (define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window)
1329 (define-key special-event-map [sigusr1] 'ignore)
1330 (define-key special-event-map [sigusr2] 'ignore)
1332 ;; Don't look for autoload cookies in this file.
1334 ;; no-update-autoloads: t
1337 ;;; bindings.el ends here