unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39280: 27.0.60; wdired-get-filename ignores first argument
@ 2020-01-25 20:05 Tino Calancha
  2020-01-25 20:55 ` Stephen Berman
  0 siblings, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2020-01-25 20:05 UTC (permalink / raw)
  To: 39280


emacs -Q /tmp
M-! touch foo RET
g
j foo RET
C-x C-q
M-: (wdired-get-filename 'local t) RET
=> "/tmp/foo"
;; Expected: "foo"

--8<-----------------------------cut here---------------start------------->8---
commit 5f7e8975e741298718a4e05aa674873207cb56a6
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Sat Jan 25 21:03:53 2020 +0100

    Fix bug in wdired-get-filename
    
    * lisp/wdired.el (wdired-get-filename):
    Acknowledge the first argument.
    * test/lisp/wdired-tests.el (wdired-test-bug39280): Add test.

diff --git a/lisp/wdired.el b/lisp/wdired.el
index d470e0a21b..23dc4b9ef5 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -344,7 +344,7 @@ wdired-get-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))))))
 
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index baa547758e..3d5f504205 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -176,6 +176,22 @@ wdired-test-bug34915
       (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
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.60 (build 24, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2020-01-25 built on calancha-pc.dy.bbexcite.jp
Repository revision: baca81e64141aed076fe088e7160f6e0d4a51c68
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(Shell command succeeded with no output)
Press C-c C-c when finished or C-c ESC to abort changes
"/tmp/foo"
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD PDUMPER
LCMS2 GMP






^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-01 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-25 20:05 bug#39280: 27.0.60; wdired-get-filename ignores first argument Tino Calancha
2020-01-25 20:55 ` Stephen Berman
2020-01-25 21:13   ` Tino Calancha
2020-01-26 10:47     ` Stephen Berman
2020-10-01 21:26       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).