X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b4d3bc10dc84f6b01a2b6b215d0e489555aa6edd..8137e7b3165ea5dffc66a0a49f34716df0c00c2d:/lisp/simple.el diff --git a/lisp/simple.el b/lisp/simple.el index 64356ce8aa..3240ede029 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1,6 +1,6 @@ ;;; simple.el --- basic editing commands for Emacs -;; Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc. +;; Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal @@ -28,8 +28,6 @@ ;;; Code: -(eval-when-compile (require 'cl)) ;For define-minor-mode. - (declare-function widget-convert "wid-edit" (type &rest args)) (declare-function shell-mode "shell" ()) @@ -817,7 +815,7 @@ instead of deleted." :type '(choice (const :tag "Delete active region" t) (const :tag "Kill active region" kill) (const :tag "Do ordinary deletion" nil)) - :group 'editing + :group 'killing :version "24.1") (defun delete-backward-char (n &optional killflag) @@ -988,7 +986,11 @@ END, without printing any message." ((use-region-p) (call-interactively 'count-words-region)) (t - (count-words--message "Buffer" (point-min) (point-max))))) + (count-words--message + (if (= (point-max) (1+ (buffer-size))) + "Buffer" + "Narrowed part of buffer") + (point-min) (point-max))))) (defun count-words--message (str start end) (let ((lines (count-lines start end)) @@ -1354,6 +1356,60 @@ to get different commands to edit and resubmit." "M-x ") obarray 'commandp t nil 'extended-command-history))) +(defcustom suggest-key-bindings t + "Non-nil means show the equivalent key-binding when M-x command has one. +The value can be a length of time to show the message for. +If the value is non-nil and not a number, we wait 2 seconds." + :group 'keyboard + :type '(choice (const :tag "off" nil) + (integer :tag "time" 2) + (other :tag "on"))) + +(defun execute-extended-command (prefixarg &optional command-name) + ;; Based on Fexecute_extended_command in keyboard.c of Emacs. + ;; Aaron S. Hawley 2009-08-24 + "Read function name, then read its arguments and call it. + +To pass a numeric argument to the command you are invoking with, specify +the numeric argument to this command. + +Noninteractively, the argument PREFIXARG is the prefix argument to +give to the command you invoke, if it asks for an argument." + (interactive (list current-prefix-arg (read-extended-command))) + ;; Emacs<24 calling-convention was with a single `prefixarg' argument. + (if (null command-name) (setq command-name (read-extended-command))) + (let* ((function (and (stringp command-name) (intern-soft command-name))) + (binding (and suggest-key-bindings + (not executing-kbd-macro) + (where-is-internal function overriding-local-map t)))) + (unless (commandp function) + (error "`%s' is not a valid command name" command-name)) + (setq this-command function) + ;; Normally `real-this-command' should never be changed, but here we really + ;; want to pretend that M-x RET is nothing more than a "key + ;; binding" for , so the command the user really wanted to run is + ;; `function' and not `execute-extended-command'. The difference is + ;; visible in cases such as M-x RET and then C-x z (bug#11506). + (setq real-this-command function) + (let ((prefix-arg prefixarg)) + (command-execute function 'record)) + ;; If enabled, show which key runs this command. + (when binding + ;; But first wait, and skip the message if there is input. + (let* ((waited + ;; If this command displayed something in the echo area; + ;; wait a few seconds, then display our suggestion message. + (sit-for (cond + ((zerop (length (current-message))) 0) + ((numberp suggest-key-bindings) suggest-key-bindings) + (t 2))))) + (when (and waited (not (consp unread-command-events))) + (with-temp-message + (format "You can run the command `%s' with %s" + function (key-description binding)) + (sit-for (if (numberp suggest-key-bindings) + suggest-key-bindings + 2)))))))) (defvar minibuffer-history nil "Default minibuffer history list. @@ -1415,7 +1471,7 @@ See also `minibuffer-history-case-insensitive-variables'." (list (if (string= regexp "") (if minibuffer-history-search-history (car minibuffer-history-search-history) - (error "No previous history search regexp")) + (user-error "No previous history search regexp")) regexp) (prefix-numeric-value current-prefix-arg)))) (unless (zerop n) @@ -1441,9 +1497,9 @@ See also `minibuffer-history-case-insensitive-variables'." (setq prevpos pos) (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history))) (when (= pos prevpos) - (error (if (= pos 1) - "No later matching history item" - "No earlier matching history item"))) + (user-error (if (= pos 1) + "No later matching history item" + "No earlier matching history item"))) (setq match-string (if (eq minibuffer-history-sexp-flag (minibuffer-depth)) (let ((print-level nil)) @@ -1486,7 +1542,7 @@ makes the search case-sensitive." (list (if (string= regexp "") (if minibuffer-history-search-history (car minibuffer-history-search-history) - (error "No previous history search regexp")) + (user-error "No previous history search regexp")) regexp) (prefix-numeric-value current-prefix-arg)))) (previous-matching-history-element regexp (- n))) @@ -1545,11 +1601,11 @@ The argument NABS specifies the absolute history position." (setq minibuffer-text-before-history (minibuffer-contents-no-properties))) (if (< nabs minimum) - (if minibuffer-default - (error "End of defaults; no next item") - (error "End of history; no default available"))) + (user-error (if minibuffer-default + "End of defaults; no next item" + "End of history; no default available"))) (if (> nabs (length (symbol-value minibuffer-history-variable))) - (error "Beginning of history; no preceding item")) + (user-error "Beginning of history; no preceding item")) (unless (memq last-command '(next-history-element previous-history-element)) (let ((prompt-end (minibuffer-prompt-end))) @@ -1649,58 +1705,50 @@ Intended to be added to `minibuffer-setup-hook'." (defun minibuffer-history-isearch-search () "Return the proper search function, for isearch in minibuffer history." - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (t - (lambda (string bound noerror) - (let ((search-fun - ;; Use standard functions to search within minibuffer text - (cond - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward)))) - found) - ;; Avoid lazy-highlighting matches in the minibuffer prompt when - ;; searching forward. Lazy-highlight calls this lambda with the - ;; bound arg, so skip the minibuffer prompt. - (if (and bound isearch-forward (< (point) (minibuffer-prompt-end))) - (goto-char (minibuffer-prompt-end))) - (or - ;; 1. First try searching in the initial minibuffer text - (funcall search-fun string - (if isearch-forward bound (minibuffer-prompt-end)) - noerror) - ;; 2. If the above search fails, start putting next/prev history - ;; elements in the minibuffer successively, and search the string - ;; in them. Do this only when bound is nil (i.e. not while - ;; lazy-highlighting search strings in the current minibuffer text). - (unless bound - (condition-case nil - (progn - (while (not found) - (cond (isearch-forward - (next-history-element 1) - (goto-char (minibuffer-prompt-end))) - (t - (previous-history-element 1) - (goto-char (point-max)))) - (setq isearch-barrier (point) isearch-opoint (point)) - ;; After putting the next/prev history element, search - ;; the string in them again, until next-history-element - ;; or previous-history-element raises an error at the - ;; beginning/end of history. - (setq found (funcall search-fun string - (unless isearch-forward - ;; For backward search, don't search - ;; in the minibuffer prompt - (minibuffer-prompt-end)) - noerror))) - ;; Return point of the new search result - (point)) - ;; Return nil when next(prev)-history-element fails - (error nil))))))))) + (lambda (string bound noerror) + (let ((search-fun + ;; Use standard functions to search within minibuffer text + (isearch-search-fun-default)) + found) + ;; Avoid lazy-highlighting matches in the minibuffer prompt when + ;; searching forward. Lazy-highlight calls this lambda with the + ;; bound arg, so skip the minibuffer prompt. + (if (and bound isearch-forward (< (point) (minibuffer-prompt-end))) + (goto-char (minibuffer-prompt-end))) + (or + ;; 1. First try searching in the initial minibuffer text + (funcall search-fun string + (if isearch-forward bound (minibuffer-prompt-end)) + noerror) + ;; 2. If the above search fails, start putting next/prev history + ;; elements in the minibuffer successively, and search the string + ;; in them. Do this only when bound is nil (i.e. not while + ;; lazy-highlighting search strings in the current minibuffer text). + (unless bound + (condition-case nil + (progn + (while (not found) + (cond (isearch-forward + (next-history-element 1) + (goto-char (minibuffer-prompt-end))) + (t + (previous-history-element 1) + (goto-char (point-max)))) + (setq isearch-barrier (point) isearch-opoint (point)) + ;; After putting the next/prev history element, search + ;; the string in them again, until next-history-element + ;; or previous-history-element raises an error at the + ;; beginning/end of history. + (setq found (funcall search-fun string + (unless isearch-forward + ;; For backward search, don't search + ;; in the minibuffer prompt + (minibuffer-prompt-end)) + noerror))) + ;; Return point of the new search result + (point)) + ;; Return nil when next(prev)-history-element fails + (error nil))))))) (defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis) "Display the minibuffer history search prompt. @@ -1731,14 +1779,13 @@ Otherwise, it displays the standard isearch message returned from "Wrap the minibuffer history search when search fails. Move point to the first history element for a forward search, or to the last history element for a backward search." - (unless isearch-word - ;; When `minibuffer-history-isearch-search' fails on reaching the - ;; beginning/end of the history, wrap the search to the first/last - ;; minibuffer history element. - (if isearch-forward - (goto-history-element (length (symbol-value minibuffer-history-variable))) - (goto-history-element 0)) - (setq isearch-success t)) + ;; When `minibuffer-history-isearch-search' fails on reaching the + ;; beginning/end of the history, wrap the search to the first/last + ;; minibuffer history element. + (if isearch-forward + (goto-history-element (length (symbol-value minibuffer-history-variable))) + (goto-history-element 0)) + (setq isearch-success t) (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max)))) (defun minibuffer-history-isearch-push-state () @@ -1895,8 +1942,8 @@ Some change-hooks test this variable to do something different.") Call `undo-start' to get ready to undo recent changes, then call `undo-more' one or more times to undo them." (or (listp pending-undo-list) - (error (concat "No further undo information" - (and undo-in-region " for region")))) + (user-error (concat "No further undo information" + (and undo-in-region " for region")))) (let ((undo-in-progress t)) ;; Note: The following, while pulling elements off ;; `pending-undo-list' will call primitive change functions which @@ -1922,7 +1969,7 @@ If BEG and END are specified, then only undo elements that apply to text between BEG and END are used; other undo elements are ignored. If BEG and END are nil, all undo elements are used." (if (eq buffer-undo-list t) - (error "No undo information in this buffer")) + (user-error "No undo information in this buffer")) (setq pending-undo-list (if (and beg end (not (= beg end))) (undo-make-selective-list (min beg end) (max beg end)) @@ -2150,7 +2197,7 @@ of `history-length', which see.") "Switch used to have the shell execute its command line argument.") (defvar shell-command-default-error-buffer nil - "*Buffer name for `shell-command' and `shell-command-on-region' error output. + "Buffer name for `shell-command' and `shell-command-on-region' error output. This buffer is used when `shell-command' or `shell-command-on-region' is run interactively. A value of nil means that output to stderr and stdout will be intermixed in the output stream.") @@ -2204,9 +2251,11 @@ to `shell-command-history'." (defun async-shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND asynchronously in background. -Like `shell-command' but if COMMAND doesn't end in ampersand, adds `&' -surrounded by whitespace and executes the command asynchronously. +Like `shell-command', but adds `&' at the end of COMMAND +to execute it asynchronously. + The output appears in the buffer `*Async Shell Command*'. +That buffer is in shell mode. In Elisp, you will often be better served by calling `start-process' directly, since it offers more control and does not impose the use of a @@ -2214,8 +2263,12 @@ shell (with its need to quote arguments)." (interactive (list (read-shell-command "Async shell command: " nil nil - (and buffer-file-name - (file-relative-name buffer-file-name))) + (let ((filename + (cond + (buffer-file-name) + ((eq major-mode 'dired-mode) + (dired-get-filename nil t))))) + (and filename (file-relative-name filename)))) current-prefix-arg shell-command-default-error-buffer)) (unless (string-match "&[ \t]*\\'" command) @@ -2226,9 +2279,10 @@ shell (with its need to quote arguments)." "Execute string COMMAND in inferior shell; display output, if any. With prefix argument, insert the COMMAND's output at point. -If COMMAND ends in ampersand, execute it asynchronously. +If COMMAND ends in `&', execute it asynchronously. The output appears in the buffer `*Async Shell Command*'. -That buffer is in shell mode. +That buffer is in shell mode. You can also use +`async-shell-command' that automatically adds `&'. Otherwise, COMMAND is executed synchronously. The output appears in the buffer `*Shell Command Output*'. If the output is short enough to @@ -2464,9 +2518,9 @@ COMMAND. To specify a coding system for converting non-ASCII characters in the input and output to the shell command, use \\[universal-coding-system-argument] before this command. By default, the input (from the current buffer) -is encoded in the same coding system that will be used to save the file, -`buffer-file-coding-system'. If the output is going to replace the region, -then it is decoded from that same coding system. +is encoded using coding-system specified by `process-coding-system-alist', +falling back to `default-process-coding-system' if no match for COMMAND +is found in `process-coding-system-alist'. The noninteractive arguments are START, END, COMMAND, OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER. @@ -2677,13 +2731,13 @@ value passed." (defvar process-file-side-effects t "Whether a call of `process-file' changes remote files. -Per default, this variable is always set to `t', meaning that a +By default, this variable is always set to `t', meaning that a call of `process-file' could potentially change any file on a remote host. When set to `nil', a file handler could optimize -its behavior with respect to remote file attributes caching. +its behavior with respect to remote file attribute caching. -This variable should never be changed by `setq'. Instead of, it -shall be set only by let-binding.") +You should only ever change this variable with a let-binding; +never with `setq'.") (defun start-file-process (name buffer program &rest program-args) "Start a program in a subprocess. Return the process object for it. @@ -2999,41 +3053,43 @@ be copied into other buffers." (defvar interprogram-cut-function nil "Function to call to make a killed region available to other programs. +Most window systems provide a facility for cutting and pasting +text between different programs, such as the clipboard on X and +MS-Windows, or the pasteboard on Nextstep/Mac OS. -Most window systems provide some sort of facility for cutting and -pasting text between the windows of different programs. -This variable holds a function that Emacs calls whenever text -is put in the kill ring, to make the new kill available to other -programs. - -The function takes one argument, TEXT, which is a string containing -the text which should be made available.") +This variable holds a function that Emacs calls whenever text is +put in the kill ring, to make the new kill available to other +programs. The function takes one argument, TEXT, which is a +string containing the text which should be made available.") (defvar interprogram-paste-function nil "Function to call to get text cut from other programs. - -Most window systems provide some sort of facility for cutting and -pasting text between the windows of different programs. -This variable holds a function that Emacs calls to obtain -text that other programs have provided for pasting. - -The function should be called with no arguments. If the function -returns nil, then no other program has provided such text, and the top -of the Emacs kill ring should be used. If the function returns a -string, then the caller of the function \(usually `current-kill') -should put this string in the kill ring as the latest kill. - -This function may also return a list of strings if the window +Most window systems provide a facility for cutting and pasting +text between different programs, such as the clipboard on X and +MS-Windows, or the pasteboard on Nextstep/Mac OS. + +This variable holds a function that Emacs calls to obtain text +that other programs have provided for pasting. The function is +called with no arguments. If no other program has provided text +to paste, the function should return nil (in which case the +caller, usually `current-kill', should use the top of the Emacs +kill ring). If another program has provided text to paste, the +function should return that text as a string (in which case the +caller should put this string in the kill ring as the latest +kill). + +The function may also return a list of strings if the window system supports multiple selections. The first string will be -used as the pasted text, but the other will be placed in the -kill ring for easy access via `yank-pop'. - -Note that the function should return a string only if a program other -than Emacs has provided a string for pasting; if Emacs provided the -most recent string, the function should return nil. If it is -difficult to tell whether Emacs or some other program provided the -current string, it is probably good enough to return nil if the string -is equal (according to `string=') to the last text Emacs provided.") +used as the pasted text, but the other will be placed in the kill +ring for easy access via `yank-pop'. + +Note that the function should return a string only if a program +other than Emacs has provided a string for pasting; if Emacs +provided the most recent string, the function should return nil. +If it is difficult to tell whether Emacs or some other program +provided the current string, it is probably good enough to return +nil if the string is equal (according to `string=') to the last +text Emacs provided.") @@ -3139,7 +3195,10 @@ If `interprogram-cut-function' is set, pass the resulting kill to it." (set-advertised-calling-convention 'kill-append '(string before-p) "23.3") (defcustom yank-pop-change-selection nil - "If non-nil, rotating the kill ring changes the window system selection." + "Whether rotating the kill ring changes the window system selection. +If non-nil, whenever the kill ring is rotated (usually via the +`yank-pop' command), Emacs also calls `interprogram-cut-function' +to copy the new kill to the window system selection." :type 'boolean :group 'killing :version "23.1") @@ -3194,10 +3253,6 @@ move the yanking point; just return the Nth kill forward." :type 'boolean :group 'killing) -(put 'text-read-only 'error-conditions - '(text-read-only buffer-read-only error)) -(put 'text-read-only 'error-message (purecopy "Text is read-only")) - (defun kill-region (beg end &optional yank-handler) "Kill (\"cut\") text between point and mark. This deletes the text from the buffer and saves it in the kill ring. @@ -3487,20 +3542,20 @@ and KILLP is t if a prefix arg was specified." "Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found." - (interactive "p\ncZap to char: ") + (interactive (list (prefix-numeric-value current-prefix-arg) + (read-char "Zap to char: " t))) ;; Avoid "obsolete" warnings for translation-table-for-input. (with-no-warnings (if (char-table-p translation-table-for-input) (setq char (or (aref translation-table-for-input char) char)))) (kill-region (point) (progn (search-forward (char-to-string char) nil nil arg) -; (goto-char (if (> arg 0) (1- (point)) (1+ (point)))) (point)))) ;; kill-line and its subroutines. (defcustom kill-whole-line nil - "If non-nil, `kill-line' with no arg at beg of line kills the whole line." + "If non-nil, `kill-line' with no arg at start of line kills the whole line." :type 'boolean :group 'killing) @@ -3817,7 +3872,11 @@ run `deactivate-mark-hook'." (cond (saved-region-selection (x-set-selection 'PRIMARY saved-region-selection) (setq saved-region-selection nil)) - ((/= (region-beginning) (region-end)) + ;; If another program has acquired the selection, region + ;; deactivation should not clobber it (Bug#11772). + ((and (/= (region-beginning) (region-end)) + (or (x-selection-owner-p 'PRIMARY) + (null (x-selection-exists-p 'PRIMARY)))) (x-set-selection 'PRIMARY (buffer-substring-no-properties (region-beginning) @@ -4405,23 +4464,25 @@ lines." ;; a cleaner solution to the problem of making C-n do something ;; useful given a tall image. (defun line-move (arg &optional noerror to-end try-vscroll) - (unless (and auto-window-vscroll try-vscroll - ;; Only vscroll for single line moves - (= (abs arg) 1) - ;; But don't vscroll in a keyboard macro. - (not defining-kbd-macro) - (not executing-kbd-macro) - (line-move-partial arg noerror to-end)) - (set-window-vscroll nil 0 t) - (if (and line-move-visual - ;; Display-based column are incompatible with goal-column. - (not goal-column) - ;; When the text in the window is scrolled to the left, - ;; display-based motion doesn't make sense (because each - ;; logical line occupies exactly one screen line). - (not (> (window-hscroll) 0))) - (line-move-visual arg noerror) - (line-move-1 arg noerror to-end)))) + (if noninteractive + (forward-line arg) + (unless (and auto-window-vscroll try-vscroll + ;; Only vscroll for single line moves + (= (abs arg) 1) + ;; But don't vscroll in a keyboard macro. + (not defining-kbd-macro) + (not executing-kbd-macro) + (line-move-partial arg noerror to-end)) + (set-window-vscroll nil 0 t) + (if (and line-move-visual + ;; Display-based column are incompatible with goal-column. + (not goal-column) + ;; When the text in the window is scrolled to the left, + ;; display-based motion doesn't make sense (because each + ;; logical line occupies exactly one screen line). + (not (> (window-hscroll) 0))) + (line-move-visual arg noerror) + (line-move-1 arg noerror to-end))))) ;; Display-based alternative to line-move-1. ;; Arg says how many lines to move. The value is t if we can move the @@ -5321,7 +5382,7 @@ Returns t if it really did any work." t))) (defvar comment-line-break-function 'comment-indent-new-line - "*Mode-specific function which line breaks and continues a comment. + "Mode-specific function which line breaks and continues a comment. This function is called during auto-filling when a comment syntax is defined. The function should take a single optional argument, which is a flag @@ -5382,7 +5443,9 @@ non-`nil'. The value of `normal-auto-fill-function' specifies the function to use for `auto-fill-function' when turning Auto Fill mode on." - :variable (eq auto-fill-function normal-auto-fill-function)) + :variable (auto-fill-function + . (lambda (v) (setq auto-fill-function + (if v normal-auto-fill-function))))) ;; This holds a document string used to document auto-fill-mode. (defun auto-fill-function () @@ -5495,7 +5558,8 @@ the line. Before a tab, such characters insert until the tab is filled in. \\[quoted-insert] still inserts characters in overwrite mode; this is supposed to make it easier to insert characters when necessary." - :variable (eq overwrite-mode 'overwrite-mode-textual)) + :variable (overwrite-mode + . (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-textual))))) (define-minor-mode binary-overwrite-mode "Toggle Binary Overwrite mode. @@ -5514,7 +5578,8 @@ ordinary typing characters do. Note that Binary Overwrite mode is not its own minor mode; it is a specialization of overwrite mode, entered by setting the `overwrite-mode' variable to `overwrite-mode-binary'." - :variable (eq overwrite-mode 'overwrite-mode-binary)) + :variable (overwrite-mode + . (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-binary))))) (define-minor-mode line-number-mode "Toggle line number display in the mode line (Line Number mode). @@ -6159,21 +6224,11 @@ With prefix argument N, move N items (negative N means move backward)." (setq beg (previous-single-property-change beg 'mouse-face)) (setq end (or (next-single-property-change end 'mouse-face) (point-max))) - (buffer-substring-no-properties beg end)))) - (owindow (selected-window))) + (buffer-substring-no-properties beg end))))) (unless (buffer-live-p buffer) (error "Destination buffer is dead")) - (select-window (posn-window (event-start event))) - (if (and (one-window-p t 'selected-frame) - (window-dedicated-p (selected-window))) - ;; This is a special buffer's frame - (iconify-frame (selected-frame)) - (or (window-dedicated-p (selected-window)) - (bury-buffer))) - (select-window - (or (get-buffer-window buffer 0) - owindow)) + (quit-window nil (posn-window (event-start event))) (with-current-buffer buffer (choose-completion-string @@ -6310,7 +6365,7 @@ Use \\\\[mouse-choose-completion] to select one\ "Finish setup of the completions buffer. Called from `temp-buffer-show-hook'." (when (eq major-mode 'completion-list-mode) - (toggle-read-only 1))) + (setq buffer-read-only t))) (add-hook 'temp-buffer-show-hook 'completion-list-mode-finish) @@ -6747,8 +6802,10 @@ 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'." - :variable (eq (terminal-parameter - nil 'normal-erase-is-backspace) 1) + :variable ((eq (terminal-parameter nil 'normal-erase-is-backspace) 1) + . (lambda (v) + (setf (terminal-parameter nil 'normal-erase-is-backspace) + (if v 1 0)))) (let ((enabled (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))))