* 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
* bug#39280: 27.0.60; wdired-get-filename ignores first argument
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
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Berman @ 2020-01-25 20:55 UTC (permalink / raw)
To: Tino Calancha; +Cc: 39280
On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha@gmail.com> wrote:
> 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"
Do you have a use case for this? AFAICS in wdired.el there are no uses
of wdired-get-filename with both of its arguments non-nil.
Steve Berman
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39280: 27.0.60; wdired-get-filename ignores first argument
2020-01-25 20:55 ` Stephen Berman
@ 2020-01-25 21:13 ` Tino Calancha
2020-01-26 10:47 ` Stephen Berman
0 siblings, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2020-01-25 21:13 UTC (permalink / raw)
To: Stephen Berman; +Cc: 39280, Tino Calancha
On Sat, 25 Jan 2020, Stephen Berman wrote:
> On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha@gmail.com> wrote:
>
>> 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"
>
> Do you have a use case for this?
No, I don't have one.
> AFAICS in wdired.el there are no uses
> of wdired-get-filename with both of its arguments non-nil.
Right, that's why we haven't detected this bug before.
I was playing a bit with wdired this month, and when I tried
to call this function with both args non-nil I got unexpected results.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39280: 27.0.60; wdired-get-filename ignores first argument
2020-01-25 21:13 ` Tino Calancha
@ 2020-01-26 10:47 ` Stephen Berman
2020-10-01 21:26 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Berman @ 2020-01-26 10:47 UTC (permalink / raw)
To: Tino Calancha; +Cc: 39280
On Sat, 25 Jan 2020 22:13:10 +0100 (CET) Tino Calancha <tino.calancha@gmail.com> wrote:
> On Sat, 25 Jan 2020, Stephen Berman wrote:
>
>> On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha@gmail.com> wrote:
>>
>>> 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"
>>
>> Do you have a use case for this?
> No, I don't have one.
I see you do now, as a possible fix for bug#39284.
>> AFAICS in wdired.el there are no uses
>> of wdired-get-filename with both of its arguments non-nil.
>
> Right, that's why we haven't detected this bug before.
> I was playing a bit with wdired this month, and when I tried
> to call this function with both args non-nil I got unexpected results.
Ok.
Steve Berman
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39280: 27.0.60; wdired-get-filename ignores first argument
2020-01-26 10:47 ` Stephen Berman
@ 2020-10-01 21:26 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-01 21:26 UTC (permalink / raw)
To: Stephen Berman; +Cc: 39280, Tino Calancha
Stephen Berman <stephen.berman@gmx.net> writes:
>>> Do you have a use case for this?
>> No, I don't have one.
>
> I see you do now, as a possible fix for bug#39284.
Looks like this wasn't applied at the time, but if I read the patch
correctly, it looks like the right fix to me, so I've applied it to
Emacs 28 now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [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).