From: Drew Adams <drew.adams@oracle.com>
To: 20776@debbugs.gnu.org
Subject: bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error
Date: Tue, 9 Jun 2015 08:05:24 -0700 (PDT) [thread overview]
Message-ID: <cdb2ac4b-f2ae-4576-b1b6-41329460f636@default> (raw)
[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]
This bug was described as part of bug #20739, and the fix was mentioned
there. A patch for the fix is attached.
The bug is that when `dired' is called with a cons DIRNAME argument and
with switch -B you get a wrong-type-argument error. For example:
(dired-other-window '("foo" "toto.el" "foo.el") "-B")
The problem is at the beginning of `ls-lisp-insert-directory. There we
see this code on the first line:
(if (or wildcard-regexp full-directory-p)
But that is incorrect, because when switch `B' is used the code does
this (ugly hack) in `ls-lisp--insert-directory':
(if (memq ?B switches) (setq wildcard-regexp "[^~]\\'"))
and this, similarly:
(setq wildcard-regexp (if (memq ?B switches) "[^~]\\'")
file (file-relative-name orig-file))
IOW, we use a pseudo wildcard-regexp, "[^~]\\'", to handle the case of
backup files.
And that doesn't work with this call:
(directory-files-and-attributes
dir nil wildcard-regexp t (if (memq ?n switches) 'integer 'string))
Debugger entered--Lisp error: (file-error "Opening directory"
"No such file or directory" "d:/the/path/to/foo.el/foo.el/")
directory-files-and-attributes("foo.el/" nil "[^~]\\'" t string)
ls-lisp-insert-directory("foo.el" (66) nil "[^~]\\'" nil)
ls-lisp--insert-directory(...
The attached patch changes the (if (or wildcard-regexp full-directory-p)
to this, which fixes the problem of raising an error:
(if (or (and wildcard-regexp
(not (string= "[^~]\\'" wildcard-regexp)))
full-directory-p)
(Note that this does not fix bug #20739, which requires that when
DIRNAME is a cons the switches actually do what they are supposed to do.
This patch merely allows Dired to list the files normally without
raising an error, but ignoring the still unsupported -B switch.)
In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
of 2014-10-20 on LEG570
Bzr revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
[-- Attachment #2: ls-lisp-2015-06-09.patch --]
[-- Type: application/octet-stream, Size: 726 bytes --]
diff -u ls-lisp.el ls-lisp-patched-2015-06-09.el
--- ls-lisp.el 2015-06-09 07:41:35.603589300 -0700
+++ ls-lisp-patched-2015-06-09.el 2015-06-09 07:48:22.306333500 -0700
@@ -348,7 +348,9 @@
file-attributes according to SWITCHES. WILDCARD-REGEXP is nil or an *Emacs
regexp*. FULL-DIRECTORY-P means file is a directory and SWITCHES does
not contain `d', so that a full listing is expected."
- (if (or wildcard-regexp full-directory-p)
+ (if (or (and wildcard-regexp
+ (not (string= "[^~]\\'" wildcard-regexp))) ; Switch -B pseudo-wildcard regexp
+ full-directory-p)
(let* ((dir (file-name-as-directory file))
(default-directory dir) ; so that file-attributes works
(file-alist
next reply other threads:[~2015-06-09 15:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 15:05 Drew Adams [this message]
2016-02-23 10:13 ` bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cdb2ac4b-f2ae-4576-b1b6-41329460f636@default \
--to=drew.adams@oracle.com \
--cc=20776@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.