--- Begin Message ---
Subject: |
23.0.60; dired-get-filename includes `*' for executable in name |
Date: |
Sun, 25 Jan 2009 22:54:12 -0800 |
emacs -Q
Create a file named `grep.exe' in some directory. The file content is
unimportant.
Use `C-u C-x d' to visit the directory, and specify `-alF' as the
listing switches.
Put the cursor on the line of the file named `grep.exe', which is
displayed as `grep.exe*' to show that it is executable.
M-: (dired-get-filename) returns "/the/dir/to/grep.exe*"
That is, the display artifact `*' is included as part of the file
name. This is also a bug in Emacs 22.3. It is a regression from Emacs
21.3.1.
In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
of 2009-01-04 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#2068: 23.0.60; dired-get-filename includes `*' for executable in name |
Date: |
Wed, 28 Jan 2009 21:07:35 +0200 |
> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Tue, 27 Jan 2009 12:43:25 -0800
> Cc:
>
> > > emacs -Q
> > >
> > > Create a file named `grep.exe' in some directory.
> > >
> > > Use `C-u C-x d' to visit the directory, and specify `-alF' as the
> > > listing switches.
> > >
> > > Put the cursor on the line of the file named `grep.exe', which is
> > > displayed as `grep.exe*' to show that it is executable.
> >
> > > M-: (dired-get-filename) returns "/the/dir/to/grep.exe*"
> >
> > Can't reproduce this. If this bug exists, it's probably Windows-only.
>
> Yes, I pretty much figured it was Windows-only.
ls-lisp.el was putting the `dired-filename' property incorrectly when
the "-F" switch was used. Fixed as below.
If you want to try this without rebuilding Emacs, you will need to
issue 2 commands, after byte-compiling the patched ls-lisp.el:
M-x load-library RET files RET
M-x load-library RET ls-lisp RET
IOW, files.elc needs to be loaded before ls-lisp, because the latter
redefines some functions in the former, and redefining them again will
give you trouble.
2009-01-28 Eli Zaretskii <eliz@gnu.org>
* ls-lisp.el (ls-lisp-classify): Propertize file name before
concatenating the type indicating character.
(ls-lisp-format): Don't propertize file-name only if
ls-lisp-classify already did.
Index: lisp/ls-lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ls-lisp.el,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- lisp/ls-lisp.el 5 Jan 2009 03:19:31 -0000 1.80
+++ lisp/ls-lisp.el 28 Jan 2009 19:01:42 -0000 1.81
@@ -531,13 +531,17 @@
(type (cadr filedata)))
(cond (type
(cons
- (concat file-name (if (eq type t) "/" "@"))
+ (concat (propertize file-name 'dired-filename t)
+ (if (eq type t) "/" "@"))
(cdr filedata)))
((string-match "x" (nth 9 filedata))
(cons
- (concat file-name "*")
+ (concat (propertize file-name 'dired-filename t) "*")
(cdr filedata)))
- (t filedata))))
+ (t
+ (cons
+ (propertize file-name 'dired-filename t)
+ (cdr filedata))))))
(defun ls-lisp-extension (filename)
"Return extension of FILENAME (ignoring any version extension)
@@ -632,7 +636,9 @@
" "
(ls-lisp-format-time file-attr time-index now)
" "
- (propertize file-name 'dired-filename t)
+ (if (not (memq ?F switches)) ; ls-lisp-classify already did that
+ (propertize file-name 'dired-filename t)
+ file-name)
(if (stringp file-type) ; is a symbolic link
(concat " -> " file-type))
"\n"
--- End Message ---