Mercurial > emacs
changeset 37194:299f754a4b17
(normal-erase-is-backspace): Rename from
delete-key-deletes-forward. Doc fix.
(normal-erase-is-backspace-mode): Rename from
delete-key-deletes-forward-mode. Doc fix. Run
normal-erase-is-backspace-hook.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 04 Apr 2001 14:06:07 +0000 |
parents | a6aec910476e |
children | 1084c7437815 |
files | lisp/simple.el |
diffstat | 1 files changed, 48 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/simple.el Wed Apr 04 14:06:06 2001 +0000 +++ b/lisp/simple.el Wed Apr 04 14:06:07 2001 +0000 @@ -4044,16 +4044,16 @@ ;;; Handling of Backspace and Delete keys. -(defcustom delete-key-deletes-forward nil - "Whether the Delete key should delete forward or not. +(defcustom normal-erase-is-backspace nil + "If non-nil, Delete key deletes forward and Backspace key deletes backward. On window systems, the default value of this option is chosen according to the keyboard used. If the keyboard has both a Backspace key and a Delete key, and both are mapped to their usual meanings, the option's default value is set to t, so that Backspace can be used to -delete backward, and Delete can be used used to delete forward - -If not running under a window system, setting this option accomplishes +delete backward, and Delete can be used to delete forward. + +If not running under a window system, customizing this option accomplishes a similar effect by mapping C-h, which is usually generated by the Backspace key, to DEL, and by mapping DEL to C-d via `keyboard-translate'. The former functionality of C-h is available on @@ -4061,31 +4061,57 @@ have both Backspace, Delete and F1 keys. Setting this variable with setq doesn't take effect. Programmatically, -call `delete-key-deleted-forward-mode' instead." +call `normal-erase-is-backspace-mode' (which see) instead." :type 'boolean :group 'editing-basics :version "21.1" :set (lambda (symbol value) ;; The fboundp is because of a problem with :set when ;; dumping Emacs. It doesn't really matter. - (if (fboundp 'delete-key-deletes-forward-mode) - (delete-key-deletes-forward-mode (or value 0)) + (if (fboundp 'normal-erase-is-backspace-mode) + (normal-erase-is-backspace-mode (or value 0)) (set-default symbol value)))) -(defun delete-key-deletes-forward-mode (&optional arg) - "Toggle Delete key deleting forward or backward. -With numeric arg, turn the mode on if and only iff ARG is positive. -For more details, see `delete-key-deletes-forward'." +(defun normal-erase-is-backspace-mode (&optional arg) + "Toggle the Erase and Delete mode of the Backspace and Delete keys. + +With numeric arg, turn the mode on if and only ARG is positive. + +On window systems, when this mode is on, Delete is mapped to C-d and +Backspace is mapped to DEL; when this mode is off, both Delete and +Backspace are mapped to DEL. (The remapping goes via +`function-key-map', so binding Delete or Backspace in the global or +local keymap will override that.) + +In addition, on window systems, the bindings of C-Delete, M-Delete, +C-M-Delete, C-Backspace, M-Backspace, and C-M-Backspace are changed in +the global keymap in accordance with the functionality of Delete and +Backspace. For example, if Delete is remapped to C-d, which deletes +forward, C-Delete is bound to `kill-word', but if Delete is remapped +to DEL, which deletes backward, C-Delete is bound to +`backward-kill-word'. + +If not running on a window system, a similar effect is accomplished by +remapping C-h (normally produced by the Backspace key) and DEL via +`keyboard-translate': if this mode is on, C-h is mapped to DEL and DEL +to C-d; if it's off, the keys are not remapped. + +When not running on a window system, and this mode is turned on, the +former functionality of C-h is available on the F1 key. You should +probably not turn on this mode on a text-only terminal if you don't +have both Backspace, Delete and F1 keys. + +See also `normal-erase-is-backspace'." (interactive "P") - (setq delete-key-deletes-forward + (setq normal-erase-is-backspace (if arg (> (prefix-numeric-value arg) 0) - (not delete-key-deletes-forward))) + (not normal-erase-is-backspace))) (cond ((or (memq window-system '(x w32 mac pc)) (memq system-type '(ms-dos windows-nt))) - (let ((bindings + (let ((bindings `(([C-delete] [C-backspace]) ([M-delete] [M-backspace]) ([C-M-delete] [C-M-backspace]) @@ -4093,7 +4119,7 @@ [C-delete] [C-backspace]))) (old-state (lookup-key function-key-map [delete]))) - (if delete-key-deletes-forward + (if normal-erase-is-backspace (progn (define-key function-key-map [delete] [?\C-d]) (define-key function-key-map [kp-delete] [?\C-d]) @@ -4115,19 +4141,19 @@ (define-key map key1 binding2) (define-key map key2 binding1))))))) (t - (if delete-key-deletes-forward + (if normal-erase-is-backspace (progn (keyboard-translate ?\C-h ?\C-?) (keyboard-translate ?\C-? ?\C-d)) (keyboard-translate ?\C-h ?\C-h) (keyboard-translate ?\C-? ?\C-?)))) - (run-hooks 'delete-key-deletes-forward-hook) + (run-hooks 'normal-erase-is-backspace-hook) (if (interactive-p) - (message "Delete key deletes %s" - (if delete-key-deletes-forward "forward" "backward")))) - - + (message "Delete key deletes %s" + (if normal-erase-is-backspace "forward" "backward")))) + + ;;; Misc (defun byte-compiling-files-p ()