]> git.eshelyaron.com Git - emacs.git/commitdiff
Make dired-replace-in-string obsolete
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 26 Sep 2020 22:50:39 +0000 (00:50 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 26 Sep 2020 22:50:39 +0000 (00:50 +0200)
* 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.

lisp/dired-aux.el
lisp/dired.el

index df25a6418fab920a065d24ab946922eb5be0a669..6034d12f32368b0c7a13006600adb393e27b696f 100644 (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))))))
 \f
@@ -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.
index 1ed949d5db893ad6a9b7f33cb294938e3bd74bdb..b4b3368a5b789901e4177b3e8231834621246f00 100644 (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)