diff options
| author | Richard M. Stallman | 1999-08-28 18:23:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-08-28 18:23:14 +0000 |
| commit | b976e099be16b765534aa96758d4c829c6dc8968 (patch) | |
| tree | 1a3885acfae57d8815b57011f53daff061a3bc14 | |
| parent | ee13a145ea15e9bd352a3fd920281195e2686789 (diff) | |
| download | emacs-b976e099be16b765534aa96758d4c829c6dc8968.tar.gz emacs-b976e099be16b765534aa96758d4c829c6dc8968.zip | |
(dired-string-replace-match): Return `nil' when no match
found with global search.
| -rw-r--r-- | lisp/dired.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index c493c1598ba..c514fa2e31f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1315,12 +1315,12 @@ If it does not match, nil is returned instead of the new string. | |||
| 1315 | Optional arg LITERAL means to take NEWTEXT literally. | 1315 | Optional arg LITERAL means to take NEWTEXT literally. |
| 1316 | Optional arg GLOBAL means to replace all matches." | 1316 | Optional arg GLOBAL means to replace all matches." |
| 1317 | (if global | 1317 | (if global |
| 1318 | (let ((start 0)) | 1318 | (let ((start 0) ret) |
| 1319 | (while (string-match regexp string start) | 1319 | (while (string-match regexp string start) |
| 1320 | (let ((from-end (- (length string) (match-end 0)))) | 1320 | (let ((from-end (- (length string) (match-end 0)))) |
| 1321 | (setq string (replace-match newtext t literal string)) | 1321 | (setq ret (setq string (replace-match newtext t literal string))) |
| 1322 | (setq start (- (length string) from-end)))) | 1322 | (setq start (- (length string) from-end)))) |
| 1323 | string) | 1323 | ret) |
| 1324 | (if (not (string-match regexp string 0)) | 1324 | (if (not (string-match regexp string 0)) |
| 1325 | nil | 1325 | nil |
| 1326 | (replace-match newtext t literal string)))) | 1326 | (replace-match newtext t literal string)))) |