Make dired-replace-in-string obsolete

* lisp/dired.el (dired-insert-directory):
* lisp/dired-aux.el (dired-rename-subdir, dired-rename-subdir-2)
(dired-insert-subdir): Adjust callers.

* lisp/dired.el (dired-replace-in-string): Make obsolete.
This commit is contained in:
Lars Ingebrigtsen 2020-09-27 00:50:39 +02:00
parent 104688feb4
commit 8a148c5976
2 changed files with 6 additions and 7 deletions

View file

@ -1802,7 +1802,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil."
(if (and buffer-file-name
(dired-in-this-tree-p buffer-file-name expanded-from-dir))
(let ((modflag (buffer-modified-p))
(to-file (dired-replace-in-string
(to-file (replace-regexp-in-string
(concat "^" (regexp-quote from-dir))
to-dir
buffer-file-name)))
@ -1866,7 +1866,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil."
;; Update buffer-local dired-subdir-alist and dired-switches-alist
(let ((cons (assoc-string (car elt) dired-switches-alist))
(cur-dir (dired-normalize-subdir
(dired-replace-in-string regexp newtext (car elt)))))
(replace-regexp-in-string regexp newtext (car elt)))))
(setcar elt cur-dir)
(when cons (setcar cons cur-dir))))))
@ -2612,7 +2612,7 @@ This function takes some pains to conform to `ls -lR' output."
(push (cons dirname switches) dired-switches-alist)))
(when switches-have-R
(dired-build-subdir-alist switches)
(setq switches (dired-replace-in-string "R" "" switches))
(setq switches (string-replace "R" "" switches))
(dolist (cur-ass dired-subdir-alist)
(let ((cur-dir (car cur-ass)))
(and (dired-in-this-tree-p cur-dir dirname)
@ -2713,7 +2713,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well."
(let ((dired-actual-switches
(or switches
dired-subdir-switches
(dired-replace-in-string "R" "" dired-actual-switches))))
(string-replace "R" "" dired-actual-switches))))
(if (equal dirname (car (car (last dired-subdir-alist))))
;; If doing the top level directory of the buffer,
;; redo it as specified in dired-directory.

View file

@ -1504,7 +1504,7 @@ see `dired-use-ls-dired' for more details.")
;; "--dired", so we cannot add it to the `process-file'
;; call for wildcards.
(when (file-remote-p dir)
(setq switches (dired-replace-in-string "--dired" "" switches)))
(setq switches (string-replace "--dired" "" switches)))
(let* ((default-directory (car dir-wildcard))
(script (format "ls %s %s" switches (cdr dir-wildcard)))
(remotep (file-remote-p dir))
@ -4290,11 +4290,10 @@ With a prefix argument, edit the current listing switches instead."
(dired-sort-set-mode-line)
(revert-buffer))
;; Some user code loads dired especially for this.
;; Don't do that--use replace-regexp-in-string instead.
(defun dired-replace-in-string (regexp newtext string)
;; Replace REGEXP with NEWTEXT everywhere in STRING and return result.
;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized.
(declare (obsolete replace-regexp-in-string "28.1"))
(let ((result "") (start 0) mb me)
(while (string-match regexp string start)
(setq mb (match-beginning 0)