diff options
| author | Lars Ingebrigtsen | 2020-09-27 00:50:39 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-09-27 00:50:39 +0200 |
| commit | 8a148c5976e3fad53d540ce5aa52a36c6b658f85 (patch) | |
| tree | 1fa8795541ebd3660966b7179c99a54ab3a54bd4 | |
| parent | 104688feb45dde126199ce277edc27c85e1b0faf (diff) | |
| download | emacs-8a148c5976e3fad53d540ce5aa52a36c6b658f85.tar.gz emacs-8a148c5976e3fad53d540ce5aa52a36c6b658f85.zip | |
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.
| -rw-r--r-- | lisp/dired-aux.el | 8 | ||||
| -rw-r--r-- | lisp/dired.el | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index df25a6418fa..6034d12f323 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -1802,7 +1802,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil." | |||
| 1802 | (if (and buffer-file-name | 1802 | (if (and buffer-file-name |
| 1803 | (dired-in-this-tree-p buffer-file-name expanded-from-dir)) | 1803 | (dired-in-this-tree-p buffer-file-name expanded-from-dir)) |
| 1804 | (let ((modflag (buffer-modified-p)) | 1804 | (let ((modflag (buffer-modified-p)) |
| 1805 | (to-file (dired-replace-in-string | 1805 | (to-file (replace-regexp-in-string |
| 1806 | (concat "^" (regexp-quote from-dir)) | 1806 | (concat "^" (regexp-quote from-dir)) |
| 1807 | to-dir | 1807 | to-dir |
| 1808 | buffer-file-name))) | 1808 | buffer-file-name))) |
| @@ -1866,7 +1866,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil." | |||
| 1866 | ;; Update buffer-local dired-subdir-alist and dired-switches-alist | 1866 | ;; Update buffer-local dired-subdir-alist and dired-switches-alist |
| 1867 | (let ((cons (assoc-string (car elt) dired-switches-alist)) | 1867 | (let ((cons (assoc-string (car elt) dired-switches-alist)) |
| 1868 | (cur-dir (dired-normalize-subdir | 1868 | (cur-dir (dired-normalize-subdir |
| 1869 | (dired-replace-in-string regexp newtext (car elt))))) | 1869 | (replace-regexp-in-string regexp newtext (car elt))))) |
| 1870 | (setcar elt cur-dir) | 1870 | (setcar elt cur-dir) |
| 1871 | (when cons (setcar cons cur-dir)))))) | 1871 | (when cons (setcar cons cur-dir)))))) |
| 1872 | 1872 | ||
| @@ -2612,7 +2612,7 @@ This function takes some pains to conform to `ls -lR' output." | |||
| 2612 | (push (cons dirname switches) dired-switches-alist))) | 2612 | (push (cons dirname switches) dired-switches-alist))) |
| 2613 | (when switches-have-R | 2613 | (when switches-have-R |
| 2614 | (dired-build-subdir-alist switches) | 2614 | (dired-build-subdir-alist switches) |
| 2615 | (setq switches (dired-replace-in-string "R" "" switches)) | 2615 | (setq switches (string-replace "R" "" switches)) |
| 2616 | (dolist (cur-ass dired-subdir-alist) | 2616 | (dolist (cur-ass dired-subdir-alist) |
| 2617 | (let ((cur-dir (car cur-ass))) | 2617 | (let ((cur-dir (car cur-ass))) |
| 2618 | (and (dired-in-this-tree-p cur-dir dirname) | 2618 | (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." | |||
| 2713 | (let ((dired-actual-switches | 2713 | (let ((dired-actual-switches |
| 2714 | (or switches | 2714 | (or switches |
| 2715 | dired-subdir-switches | 2715 | dired-subdir-switches |
| 2716 | (dired-replace-in-string "R" "" dired-actual-switches)))) | 2716 | (string-replace "R" "" dired-actual-switches)))) |
| 2717 | (if (equal dirname (car (car (last dired-subdir-alist)))) | 2717 | (if (equal dirname (car (car (last dired-subdir-alist)))) |
| 2718 | ;; If doing the top level directory of the buffer, | 2718 | ;; If doing the top level directory of the buffer, |
| 2719 | ;; redo it as specified in dired-directory. | 2719 | ;; redo it as specified in dired-directory. |
diff --git a/lisp/dired.el b/lisp/dired.el index 1ed949d5db8..b4b3368a5b7 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1504,7 +1504,7 @@ see `dired-use-ls-dired' for more details.") | |||
| 1504 | ;; "--dired", so we cannot add it to the `process-file' | 1504 | ;; "--dired", so we cannot add it to the `process-file' |
| 1505 | ;; call for wildcards. | 1505 | ;; call for wildcards. |
| 1506 | (when (file-remote-p dir) | 1506 | (when (file-remote-p dir) |
| 1507 | (setq switches (dired-replace-in-string "--dired" "" switches))) | 1507 | (setq switches (string-replace "--dired" "" switches))) |
| 1508 | (let* ((default-directory (car dir-wildcard)) | 1508 | (let* ((default-directory (car dir-wildcard)) |
| 1509 | (script (format "ls %s %s" switches (cdr dir-wildcard))) | 1509 | (script (format "ls %s %s" switches (cdr dir-wildcard))) |
| 1510 | (remotep (file-remote-p dir)) | 1510 | (remotep (file-remote-p dir)) |
| @@ -4290,11 +4290,10 @@ With a prefix argument, edit the current listing switches instead." | |||
| 4290 | (dired-sort-set-mode-line) | 4290 | (dired-sort-set-mode-line) |
| 4291 | (revert-buffer)) | 4291 | (revert-buffer)) |
| 4292 | 4292 | ||
| 4293 | ;; Some user code loads dired especially for this. | ||
| 4294 | ;; Don't do that--use replace-regexp-in-string instead. | ||
| 4295 | (defun dired-replace-in-string (regexp newtext string) | 4293 | (defun dired-replace-in-string (regexp newtext string) |
| 4296 | ;; Replace REGEXP with NEWTEXT everywhere in STRING and return result. | 4294 | ;; Replace REGEXP with NEWTEXT everywhere in STRING and return result. |
| 4297 | ;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized. | 4295 | ;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized. |
| 4296 | (declare (obsolete replace-regexp-in-string "28.1")) | ||
| 4298 | (let ((result "") (start 0) mb me) | 4297 | (let ((result "") (start 0) mb me) |
| 4299 | (while (string-match regexp string start) | 4298 | (while (string-match regexp string start) |
| 4300 | (setq mb (match-beginning 0) | 4299 | (setq mb (match-beginning 0) |