bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error


From: Drew Adams
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)

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: ls-lisp-2015-06-09.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]