emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8a148c5: Make dired-replace-in-string obsolete


From: Lars Ingebrigtsen
Subject: master 8a148c5: Make dired-replace-in-string obsolete
Date: Sat, 26 Sep 2020 18:50:51 -0400 (EDT)

branch: master
commit 8a148c5976e3fad53d540ce5aa52a36c6b658f85
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/dired-aux.el | 8 ++++----
 lisp/dired.el     | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index df25a64..6034d12 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -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.
diff --git a/lisp/dired.el b/lisp/dired.el
index 1ed949d..b4b3368 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]