all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <7126@debbugs.gnu.org>
Subject: bug#7126: 24.0.50; [PATCH] `dired-goto-file' fails when `dired' is passed a cons with absolutefile names
Date: Tue, 28 Sep 2010 16:53:40 -0700	[thread overview]
Message-ID: <38695CE2A0AE429FA95C2BA34870B6F0@us.oracle.com> (raw)
In-Reply-To: <EBBFD3116B5B41E983AFFB8CADA1E6B1@us.oracle.com>

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

  reply	other threads:[~2010-09-28 23:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=38695CE2A0AE429FA95C2BA34870B6F0@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=7126@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.