all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7126: 24.0.50; `dired-goto-file' fails when `dired' is passed a cons with absolute file names
@ 2010-09-28 21:57 Drew Adams
  2010-09-28 23:53 ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons with absolutefile names Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2010-09-28 21:57 UTC (permalink / raw)
  To: 7126

emacs -Q
 
M-: (dired '("AAAAA" "c:/foo.c" "c:/bar.c"))
 
This opens a Dired buffer named `AAAAA' with the same
`default-directory' as before the `M-:'.  The Dired buffer has two
explicit entries, the files listed in the cons arg.  These are absolute
file names.
 
This is a normal, advertised behavior of `dired': you can pass it a cons
arg to have Dired list only explicit files.  And the file names can be
either relative or absolute.  It works for remote files as well as local
ones.  Generally, it works quite well.  There have been some oversights
in the code in the past, but most have now been fixed.
 
Now try `j c:/foo.c'.  (`j' is `dired-goto-file'.)  It fails.
 
The reason it fails is that `dired-goto-file' looks only for the
relative file name (e.g. `foo.c') with a space prepended.  This is so
even when you give it an absolute file name, such as `c:/foo.c'.
 
This is important not just for interactive use but because
`dired-goto-file' is a fundamental function.  It is used all over the
place in the Dired code.  This bug therefore breaks lots of things.  It
makes it impossible for 3rd-party developers to really take advantage of
the Dired feature of listing arbitrary files and directories.
 
Dired functions should make no assumptions about the listed file and
directory names.  In particular, it should not assume that the files and
dirs are in particular parent directories or that they are relative
names.
 
If a file name is absolute, then it must be respected.  If it is
relative, then it needs to be interpreted relative to the (sub)directory
heading that precedes it (as usual).
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-09-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
 






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

* bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons with absolutefile names
  2010-09-28 21:57 bug#7126: 24.0.50; `dired-goto-file' fails when `dired' is passed a cons with absolute file names Drew Adams
@ 2010-09-28 23:53 ` Drew Adams
  2012-03-07 17:23   ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons withabsolutefile names Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2010-09-28 23:53 UTC (permalink / raw)
  To: 7126

[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

I think the attached patch takes care of it.
But it would be good if others also tested it.

[-- Attachment #2: dired-2010-09-28.patch --]
[-- Type: application/octet-stream, Size: 2004 bytes --]

diff -cw dired.el dired-patched-2010-09-28.el
*** dired.el	Tue Sep 28 16:42:22 2010
--- dired-patched-2010-09-28.el	Tue Sep 28 16:48:48 2010
***************
*** 2480,2486 ****
--- 2480,2498 ----
      (setq dir (or (file-name-directory file)
  		  (error "File name `%s' is not absolute" file)))
      (save-excursion
+       (goto-char (point-min))
+       (let ((search-string  (replace-regexp-in-string "\^m" "\\^m" file nil t)))
+         (setq search-string  (replace-regexp-in-string "\\\\" "\\\\" search-string nil t))
+         (while (and (not (eobp)) (not found))
+           (if (search-forward (concat " " search-string) nil 'NO-ERROR)
+               ;; Must move to filename since an (actually correct) match could have been
+               ;; elsewhere on the line (e.g. "-" would match somewhere in permission bits).
+               (setq found  (dired-move-to-filename))
+             ;; If this isn't the right line, move forward to avoid trying this line again.
+             (forward-line 1)))))
+     (unless found
        ;; The hair here is to get the result of dired-goto-subdir
+       (save-excursion
          ;; without really calling it if we don't have any subdirs.
          (if (if (string= dir (expand-file-name default-directory))
                  (goto-char (point-min))
***************
*** 2509,2515 ****
  		  (setq found (dired-move-to-filename))
  		;; If this isn't the right line, move forward to avoid
  		;; trying this line again.
! 		(forward-line 1))))))
      (and found
  	 ;; return value of point (i.e., FOUND):
  	 (goto-char found))))
--- 2521,2527 ----
                      (setq found (dired-move-to-filename))
                    ;; If this isn't the right line, move forward to avoid
                    ;; trying this line again.
!                   (forward-line 1)))))))
      (and found
  	 ;; return value of point (i.e., FOUND):
  	 (goto-char found))))

Diff finished.  Tue Sep 28 16:49:01 2010

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

* bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons withabsolutefile names
  2010-09-28 23:53 ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons with absolutefile names Drew Adams
@ 2012-03-07 17:23   ` Drew Adams
  2012-03-10  5:21     ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2012-03-07 17:23 UTC (permalink / raw)
  To: 7126

> I think the attached patch takes care of it.
> But it would be good if others also tested it.

ping.  The bug is still there.

Tested again with emacs -Q:

In GNU Emacs 24.0.94.1 (i386-mingw-nt5.1.2600)
 of 2012-02-26 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include' 

The patch I sent 1 1/2 years ago would now need to be updated per the
introduction of `dired-switches-escape-p'.  IOW, the same use of that function
in the current save-excursion probably needs to also be added to the preliminary
save-excursion in the patch.

In any case - regardless of the patch, there has been NO response to this bug.






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

* bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons withabsolutefile names
  2012-03-07 17:23   ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons withabsolutefile names Drew Adams
@ 2012-03-10  5:21     ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2012-03-10  5:21 UTC (permalink / raw)
  To: Drew Adams; +Cc: 7126

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

> ping.  The bug is still there.

I've committed a more complete fix.  Thanks.





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

end of thread, other threads:[~2012-03-10  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 21:57 bug#7126: 24.0.50; `dired-goto-file' fails when `dired' is passed a cons with absolute file names Drew Adams
2010-09-28 23:53 ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons with absolutefile names Drew Adams
2012-03-07 17:23   ` bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons withabsolutefile names Drew Adams
2012-03-10  5:21     ` Chong Yidong

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.