aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2020-10-01 23:25:15 +0200
committerLars Ingebrigtsen2020-10-01 23:34:01 +0200
commit29435ecd8e31497a9cc461fcf88dbbf00876863a (patch)
tree4200cdcff40c604dfaedd52f51c842bb9e26150e
parentda591df90ae95a6bc34f43b1594fc58a91967304 (diff)
downloademacs-29435ecd8e31497a9cc461fcf88dbbf00876863a.tar.gz
emacs-29435ecd8e31497a9cc461fcf88dbbf00876863a.zip
Fix bug in wdired-get-filename
* lisp/wdired.el (wdired-get-filename): Acknowledge the first argument (bug#39280). * test/lisp/wdired-tests.el (wdired-test-bug39280): Add test.
-rw-r--r--lisp/wdired.el2
-rw-r--r--test/lisp/wdired-tests.el16
2 files changed, 17 insertions, 1 deletions
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 6defbf8bc86..806eb304d9f 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -344,7 +344,7 @@ non-nil means return old filename."
344 ;; Don't unquote the old name, it wasn't quoted in the first place 344 ;; Don't unquote the old name, it wasn't quoted in the first place
345 (and file (setq file (wdired-normalize-filename file (not old))))) 345 (and file (setq file (wdired-normalize-filename file (not old)))))
346 (if (or no-dir old) 346 (if (or no-dir old)
347 file 347 (if no-dir (file-relative-name file) file)
348 (and file (> (length file) 0) 348 (and file (> (length file) 0)
349 (concat (dired-current-directory) file)))))) 349 (concat (dired-current-directory) file))))))
350 350
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index b89e8c876e2..f876967bf98 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -178,6 +178,22 @@ wdired-get-filename before and after editing."
178 (server-force-delete) 178 (server-force-delete)
179 (delete-directory test-dir t)))) 179 (delete-directory test-dir t))))
180 180
181(ert-deftest wdired-test-bug39280 ()
182 "Test for https://debbugs.gnu.org/39280."
183 (let* ((test-dir (make-temp-file "test-dir" 'dir))
184 (fname "foo")
185 (full-fname (expand-file-name fname test-dir)))
186 (make-empty-file full-fname)
187 (let ((buf (find-file-noselect test-dir)))
188 (unwind-protect
189 (with-current-buffer buf
190 (dired-toggle-read-only)
191 (dolist (old '(t nil))
192 (should (equal fname (wdired-get-filename 'nodir old)))
193 (should (equal full-fname (wdired-get-filename nil old))))
194 (wdired-finish-edit))
195 (if buf (kill-buffer buf))
196 (delete-directory test-dir t)))))
181 197
182(provide 'wdired-tests) 198(provide 'wdired-tests)
183;;; wdired-tests.el ends here 199;;; wdired-tests.el ends here