unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error
@ 2015-06-09 15:05 Drew Adams
  2016-02-23 10:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Adams @ 2015-06-09 15:05 UTC (permalink / raw)
  To: 20776

[-- 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

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

* bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error
  2015-06-09 15:05 bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error Drew Adams
@ 2016-02-23 10:13 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 10:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: 20776

Drew Adams <drew.adams@oracle.com> writes:

> This bug was described as part of bug #20739, and the fix was mentioned
> there.  A patch for the fix is attached.

Thanks; applied to emacs-25.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2016-02-23 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 15:05 bug#20776: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error Drew Adams
2016-02-23 10:13 ` 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).