unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers
@ 2016-03-22 11:22 Tino Calancha
  2016-03-25  8:39 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-03-22 11:22 UTC (permalink / raw)
  To: 23089

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


Dired buffers output from `find-dired' commands, usually contains
filename including '/'.  Command `dired-goto-file' fails
on those files.

; emacs-lisp: 
emacs -Q $emacs-lisp
M-x find-name-dired RET *.el RET
j language/thai-word.el RET

;It cannot find the file.


In GNU Emacs 25.0.92.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30)
  of 2016-03-22 built on calancha-pc
Repository revision: dbfbedd3d0f3afcfb811eae0e1a7b1c33fb27735

[-- Attachment #2: Type: text/plain, Size: 897 bytes --]

diff --git a/lisp/dired.el b/lisp/dired.el
index 24b128f..3c66a8e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2746,7 +2746,20 @@ dired-goto-file
 				(dired-goto-subdir dir)))
 		     (dired-goto-file-1 (file-name-nondirectory file)
 					file
-					(dired-subdir-max)))))))
+					(dired-subdir-max))))
+		 ;; Handle Dired buffers from `find-dired' commands.  The
+		 ;; filename includes '/' if the file belongs to a subdir
+		 ;; of `default-directory'.
+		 (save-excursion
+		   (let ((name-len   (length file))
+				 (defdir-len (length (expand-file-name default-directory))))
+			 (goto-char (point-min))
+			 (and (not (cdr dired-subdir-alist))
+				  (> name-len defdir-len)
+				  (dired-goto-file-1 (substring file defdir-len)
+									 file
+									 (point-max))))))))
+
     ;; Return buffer position, if found.
     (if found
 	(goto-char found))))

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

* bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers
  2016-03-22 11:22 bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers Tino Calancha
@ 2016-03-25  8:39 ` Eli Zaretskii
  2016-03-25 11:21   ` Tino Calancha
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2016-03-25  8:39 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 23089

> Date: Tue, 22 Mar 2016 20:22:51 +0900 (JST)
> From: Tino Calancha <f92capac@gmail.com>
> 
> Dired buffers output from `find-dired' commands, usually contains
> filename including '/'.  Command `dired-goto-file' fails
> on those files.
> 
> ; emacs-lisp: 
> emacs -Q $emacs-lisp
> M-x find-name-dired RET *.el RET
> j language/thai-word.el RET
> 
> ;It cannot find the file.

Thanks for the report and the patch.  Does the alternative patch below
look correct, and does it give good results?

diff --git a/lisp/dired.el b/lisp/dired.el
index ef22d45..5741872 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2736,9 +2736,18 @@ dired-goto-file
 		 (save-excursion
 		   (goto-char (point-min))
 		   (dired-goto-file-1 file file (point-max)))
-		 ;; Otherwise, look for it as a relative name.  The
-		 ;; hair is to get the result of `dired-goto-subdir'
-		 ;; without calling it if we don't have any subdirs.
+                 ;; Next, look for it as a relative name with leading
+                 ;; subdirectories.  (This happens in Dired buffers
+                 ;; created by find-dired, for example.)
+                 (save-excursion
+                   (goto-char (point-min))
+                   (dired-goto-file-1 (file-relative-name file
+                                                          default-directory)
+                                      file (point-max)))
+		 ;; Otherwise, look for it as a relative name, a base
+		 ;; name only.  The hair is to get the result of
+		 ;; `dired-goto-subdir' without calling it if we don't
+		 ;; have any subdirs.
 		 (save-excursion
 		   (when (if (string= dir (expand-file-name default-directory))
 			     (goto-char (point-min))





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

* bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers
  2016-03-25  8:39 ` Eli Zaretskii
@ 2016-03-25 11:21   ` Tino Calancha
  2016-03-25 14:20     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-03-25 11:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Tino Calancha, 23089


> Does the alternative patch below
> look correct, and does it give good results?
Yes, your alternative patch also fix the problem, and it's more elegant.





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

* bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers
  2016-03-25 11:21   ` Tino Calancha
@ 2016-03-25 14:20     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2016-03-25 14:20 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 23089-done

> Date: Fri, 25 Mar 2016 20:21:06 +0900 (JST)
> From: Tino Calancha <f92capac@gmail.com>
> cc: Tino Calancha <f92capac@gmail.com>, 23089@debbugs.gnu.org
> 
> > Does the alternative patch below
> > look correct, and does it give good results?
> Yes, your alternative patch also fix the problem, and it's more elegant.

Thanks, I pushed it to emacs-25 branch.





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

end of thread, other threads:[~2016-03-25 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 11:22 bug#23089: 25.0.92; dired-goto-file in `find-dired' buffers Tino Calancha
2016-03-25  8:39 ` Eli Zaretskii
2016-03-25 11:21   ` Tino Calancha
2016-03-25 14:20     ` Eli Zaretskii

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).