From: Mattias EngdegÄrd Date: Wed, 22 Feb 2023 11:55:45 +0000 (+0100) Subject: Use delete-char instead of backward-delete-char X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=37e5d0cd853f9d1c3d024da5381311a0c0be978f;p=emacs.git Use delete-char instead of backward-delete-char * lisp/bs.el (bs-delete): * lisp/dired-aux.el (dired-show-file-type): * lisp/emulation/viper-cmd.el (viper-insert-prev-from-insertion-ring): * lisp/man.el (Man-fontify-manpage, Man-cleanup-manpage): * lisp/net/mailcap.el (mailcap-parse-mailcap): * lisp/progmodes/antlr-mode.el (antlr-insert-makefile-rules): * lisp/textmodes/reftex-ref.el (reftex-reference): * lisp/vc/emerge.el: * lisp/woman.el (woman-man-buffer): * test/src/fns-tests.el (fns-tests-hash-buffer): Replace some calls to backward-delete-char with delete-char (negating the argument) since the former is intended for interactive use. This silences most of the interactive-only warnings. --- diff --git a/lisp/bs.el b/lisp/bs.el index 5f31530f068..70868591196 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -933,7 +933,7 @@ WHAT is a value of nil, `never', or `always'." (end-of-line) (if (eobp) (point) (1+ (point))))) (when (eobp) - (backward-delete-char 1) + (delete-char -1) (beginning-of-line) (recenter -1)) (bs--set-window-height))) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c390017e190..6cb097f6bb3 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3730,7 +3730,7 @@ of the target of the link instead." (process-file "file" nil t t "-L" "--" file) (process-file "file" nil t t "--" file)) (when (bolp) - (backward-delete-char 1)) + (delete-char -1)) (message "%s" (buffer-string))))) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 8cf81c33b5b..ee96d8efac6 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1711,8 +1711,8 @@ to in the global map, instead of cycling through the insertion ring." (if (eq viper-current-state 'replace-state) (undo 1) (if viper-last-inserted-string-from-insertion-ring - (backward-delete-char - (length viper-last-inserted-string-from-insertion-ring)))) + (delete-char + (- (length viper-last-inserted-string-from-insertion-ring))))) ) ;;first search through insertion history (setq viper-temp-insertion-ring (ring-copy viper-insertion-ring))) diff --git a/lisp/man.el b/lisp/man.el index 286edf9314e..9f75c07c791 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1262,21 +1262,21 @@ Same for the ANSI bold and normal escape sequences." (progn (goto-char (point-min)) (while (and (search-forward "__\b\b" nil t) (not (eobp))) - (backward-delete-char 4) + (delete-char -4) (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b\b__" nil t) - (backward-delete-char 4) + (delete-char -4) (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)))) (goto-char (point-min)) (while (and (search-forward "_\b" nil t) (not (eobp))) - (backward-delete-char 2) + (delete-char -2) (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b_" nil t) - (backward-delete-char 2) + (delete-char -2) (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) @@ -1294,7 +1294,7 @@ Same for the ANSI bold and normal escape sequences." ;; condense it to a shorter line interspersed with ^H. Remove ^H with ;; their preceding chars (but don't put Man-overstrike). (Bug#5566) (goto-char (point-min)) - (while (re-search-forward ".\b" nil t) (backward-delete-char 2)) + (while (re-search-forward ".\b" nil t) (delete-char -2)) (goto-char (point-min)) ;; Try to recognize common forms of cross references. (Man-highlight-references) @@ -1375,9 +1375,9 @@ script would have done them." (if (or interactive (not Man-sed-script)) (progn (goto-char (point-min)) - (while (search-forward "_\b" nil t) (backward-delete-char 2)) + (while (search-forward "_\b" nil t) (delete-char -2)) (goto-char (point-min)) - (while (search-forward "\b_" nil t) (backward-delete-char 2)) + (while (search-forward "\b_" nil t) (delete-char -2)) (goto-char (point-min)) (while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t) (replace-match "\\1")) @@ -1392,7 +1392,7 @@ script would have done them." ;; condense it to a shorter line interspersed with ^H. Remove ^H with ;; their preceding chars (but don't put Man-overstrike). (Bug#5566) (goto-char (point-min)) - (while (re-search-forward ".\b" nil t) (backward-delete-char 2)) + (while (re-search-forward ".\b" nil t) (delete-char -2)) (Man-softhyphen-to-minus)) (defun Man-bgproc-filter (process string) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index 722e98be2fc..10c5a7744c1 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -510,7 +510,7 @@ If SOURCE, mark the entry with this as the source." (skip-chars-forward "^;\n") ;; skip \; (while (eq (char-before) ?\\) - (backward-delete-char 1) + (delete-char -1) (forward-char) (skip-chars-forward "^;\n")) (if (eq (or (char-after save-pos) 0) ?') diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index 7574ef86a6e..a54df19425a 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -2147,7 +2147,7 @@ command `antlr-show-makefile-rules' for detail." (antlr-makefile-insert-variable i " $(" ")")) (insert "\n" (car antlr-makefile-specification)))) (if (string-equal (car antlr-makefile-specification) "\n") - (backward-delete-char 1)) + (delete-char -1)) (when with-error (goto-char (point-min)) (insert antlr-help-unknown-file-text)) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 7315c1e1e74..da0779c8e8d 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -495,7 +495,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn sep1 (cdr (assoc sep reftex-multiref-punctuation)) labels (cdr labels)) (when cut - (backward-delete-char cut) + (delete-char (- cut)) (setq cut nil)) ;; remove ~ if we do already have a space diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index de09be80e7c..e95742b304a 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -1299,7 +1299,7 @@ Otherwise, the A or B file present is copied to the output file." (setq ancestor-dir-files (cdr ancestor-dir-files)))) (if output-dir (insert "output=" output-dir f "\t")) - (backward-delete-char 1) + (delete-char -1) (insert "\n"))))) ;;; Common setup routines diff --git a/lisp/woman.el b/lisp/woman.el index 92cd425d32f..24f23c8e8f0 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1690,11 +1690,11 @@ Do not call directly!" (progn (goto-char (point-min)) (while (search-forward "__\b\b" nil t) - (backward-delete-char 4) + (delete-char -4) (woman-set-face (point) (1+ (point)) 'woman-italic)) (goto-char (point-min)) (while (search-forward "\b\b__" nil t) - (backward-delete-char 4) + (delete-char -4) (woman-set-face (1- (point)) (point) 'woman-italic)))) ;; Interpret overprinting to indicate bold face: diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index e0d6c96b360..0321b92d0bc 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -622,7 +622,7 @@ (insert "foo") (goto-char 2) (insert " ") - (backward-delete-char 1) + (delete-char -1) (buffer-hash)) (sha1 "foo"))))