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.
This commit is contained in:
parent
da591df90a
commit
29435ecd8e
2 changed files with 17 additions and 1 deletions
|
@ -344,7 +344,7 @@ non-nil means return old filename."
|
|||
;; Don't unquote the old name, it wasn't quoted in the first place
|
||||
(and file (setq file (wdired-normalize-filename file (not old)))))
|
||||
(if (or no-dir old)
|
||||
file
|
||||
(if no-dir (file-relative-name file) file)
|
||||
(and file (> (length file) 0)
|
||||
(concat (dired-current-directory) file))))))
|
||||
|
||||
|
|
|
@ -178,6 +178,22 @@ wdired-get-filename before and after editing."
|
|||
(server-force-delete)
|
||||
(delete-directory test-dir t))))
|
||||
|
||||
(ert-deftest wdired-test-bug39280 ()
|
||||
"Test for https://debbugs.gnu.org/39280."
|
||||
(let* ((test-dir (make-temp-file "test-dir" 'dir))
|
||||
(fname "foo")
|
||||
(full-fname (expand-file-name fname test-dir)))
|
||||
(make-empty-file full-fname)
|
||||
(let ((buf (find-file-noselect test-dir)))
|
||||
(unwind-protect
|
||||
(with-current-buffer buf
|
||||
(dired-toggle-read-only)
|
||||
(dolist (old '(t nil))
|
||||
(should (equal fname (wdired-get-filename 'nodir old)))
|
||||
(should (equal full-fname (wdired-get-filename nil old))))
|
||||
(wdired-finish-edit))
|
||||
(if buf (kill-buffer buf))
|
||||
(delete-directory test-dir t)))))
|
||||
|
||||
(provide 'wdired-tests)
|
||||
;;; wdired-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue