Commit 7f62656b authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

(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.
parent 1013f4e3
2001-04-04 Eli Zaretskii <eliz@is.elta.co.il> 2001-04-04 Eli Zaretskii <eliz@is.elta.co.il>
   
* cus-load.el (normal-erase-is-backspace): Use it instead of
delete-key-deletes-forward.
* startup.el (command-line): Use normal-erase-is-backspace and
normal-erase-is-backspace-mode.
* simple.el (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.
* dired.el (dired-move-to-filename-regexp): Support file sizes in * dired.el (dired-move-to-filename-regexp): Support file sizes in
``human-readable'' format produced by GNU `ls'. ``human-readable'' format produced by GNU `ls'.
(dired-move-to-filename-regexp): Recognize ISO format dates. From (dired-move-to-filename-regexp): Recognize ISO format dates. From
......
...@@ -4044,16 +4044,16 @@ DESCRIPTION is the descriptive string for the syntax.") ...@@ -4044,16 +4044,16 @@ DESCRIPTION is the descriptive string for the syntax.")
;;; Handling of Backspace and Delete keys. ;;; Handling of Backspace and Delete keys.
(defcustom delete-key-deletes-forward nil (defcustom normal-erase-is-backspace nil
"Whether the Delete key should delete forward or not. "If non-nil, Delete key deletes forward and Backspace key deletes backward.
On window systems, the default value of this option is chosen On window systems, the default value of this option is chosen
according to the keyboard used. If the keyboard has both a Backspace 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 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 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 delete backward, and Delete can be used to delete forward.
If not running under a window system, setting this option accomplishes If not running under a window system, customizing this option accomplishes
a similar effect by mapping C-h, which is usually generated by the 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 Backspace key, to DEL, and by mapping DEL to C-d via
`keyboard-translate'. The former functionality of C-h is available on `keyboard-translate'. The former functionality of C-h is available on
...@@ -4061,31 +4061,57 @@ the F1 key. You should probably not use this setting if you don't ...@@ -4061,31 +4061,57 @@ the F1 key. You should probably not use this setting if you don't
have both Backspace, Delete and F1 keys. have both Backspace, Delete and F1 keys.
Setting this variable with setq doesn't take effect. Programmatically, 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 :type 'boolean
:group 'editing-basics :group 'editing-basics
:version "21.1" :version "21.1"
:set (lambda (symbol value) :set (lambda (symbol value)
;; The fboundp is because of a problem with :set when ;; The fboundp is because of a problem with :set when
;; dumping Emacs. It doesn't really matter. ;; dumping Emacs. It doesn't really matter.
(if (fboundp 'delete-key-deletes-forward-mode) (if (fboundp 'normal-erase-is-backspace-mode)
(delete-key-deletes-forward-mode (or value 0)) (normal-erase-is-backspace-mode (or value 0))
(set-default symbol value)))) (set-default symbol value))))
(defun delete-key-deletes-forward-mode (&optional arg) (defun normal-erase-is-backspace-mode (&optional arg)
"Toggle Delete key deleting forward or backward. "Toggle the Erase and Delete mode of the Backspace and Delete keys.
With numeric arg, turn the mode on if and only iff ARG is positive.
For more details, see `delete-key-deletes-forward'." 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") (interactive "P")
(setq delete-key-deletes-forward (setq normal-erase-is-backspace
(if arg (if arg
(> (prefix-numeric-value arg) 0) (> (prefix-numeric-value arg) 0)
(not delete-key-deletes-forward))) (not normal-erase-is-backspace)))
(cond ((or (memq window-system '(x w32 mac pc)) (cond ((or (memq window-system '(x w32 mac pc))
(memq system-type '(ms-dos windows-nt))) (memq system-type '(ms-dos windows-nt)))
(let ((bindings (let ((bindings
`(([C-delete] [C-backspace]) `(([C-delete] [C-backspace])
([M-delete] [M-backspace]) ([M-delete] [M-backspace])
([C-M-delete] [C-M-backspace]) ([C-M-delete] [C-M-backspace])
...@@ -4093,7 +4119,7 @@ For more details, see `delete-key-deletes-forward'." ...@@ -4093,7 +4119,7 @@ For more details, see `delete-key-deletes-forward'."
[C-delete] [C-backspace]))) [C-delete] [C-backspace])))
(old-state (lookup-key function-key-map [delete]))) (old-state (lookup-key function-key-map [delete])))
(if delete-key-deletes-forward (if normal-erase-is-backspace
(progn (progn
(define-key function-key-map [delete] [?\C-d]) (define-key function-key-map [delete] [?\C-d])
(define-key function-key-map [kp-delete] [?\C-d]) (define-key function-key-map [kp-delete] [?\C-d])
...@@ -4115,19 +4141,19 @@ For more details, see `delete-key-deletes-forward'." ...@@ -4115,19 +4141,19 @@ For more details, see `delete-key-deletes-forward'."
(define-key map key1 binding2) (define-key map key1 binding2)
(define-key map key2 binding1))))))) (define-key map key2 binding1)))))))
(t (t
(if delete-key-deletes-forward (if normal-erase-is-backspace
(progn (progn
(keyboard-translate ?\C-h ?\C-?) (keyboard-translate ?\C-h ?\C-?)
(keyboard-translate ?\C-? ?\C-d)) (keyboard-translate ?\C-? ?\C-d))
(keyboard-translate ?\C-h ?\C-h) (keyboard-translate ?\C-h ?\C-h)
(keyboard-translate ?\C-? ?\C-?)))) (keyboard-translate ?\C-? ?\C-?))))
(run-hooks 'delete-key-deletes-forward-hook) (run-hooks 'normal-erase-is-backspace-hook)
(if (interactive-p) (if (interactive-p)
(message "Delete key deletes %s" (message "Delete key deletes %s"
(if delete-key-deletes-forward "forward" "backward")))) (if normal-erase-is-backspace "forward" "backward"))))
;;; Misc ;;; Misc
(defun byte-compiling-files-p () (defun byte-compiling-files-p ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment