changeset 94268:4cca1963bd37

(image-dired-track-original-file) (image-dired-modify-mark-on-thumb-original-file): Use `dired-goto-file' instead of `search-forward'. This solves a bug with finding files where the file name is a subset of other file names. Doc fix.
author Juri Linkov <juri@jurta.org>
date Tue, 22 Apr 2008 22:47:45 +0000
parents 8e1e3b9425df
children 6806318c3af6
files lisp/image-dired.el
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image-dired.el	Tue Apr 22 20:39:20 2008 +0000
+++ b/lisp/image-dired.el	Tue Apr 22 22:47:45 2008 +0000
@@ -1030,12 +1030,9 @@
         (dired-buf (image-dired-associated-dired-buffer))
         (file-name (image-dired-original-file-name)))
     (when (and (buffer-live-p dired-buf) file-name)
-      (setq file-name (file-name-nondirectory file-name))
       (set-buffer dired-buf)
-      (goto-char (point-min))
-      (if (not (search-forward file-name nil t))
+      (if (not (dired-goto-file file-name))
           (message "Could not track file")
-        (dired-move-to-filename)
         (set-window-point
          (image-dired-get-buffer-window dired-buf) (point)))
       (set-buffer old-buf))))
@@ -1199,8 +1196,7 @@
 
 (defun image-dired-modify-mark-on-thumb-original-file (command)
   "Modify mark in dired buffer.
-This is quite ugly but I don't know how to implemented in a better
-way.  COMMAND is one of 'mark for marking file in dired, 'unmark for
+COMMAND is one of 'mark for marking file in dired, 'unmark for
 unmarking file in dired or 'flag for flagging file for delete in
 dired."
   (let ((file-name (image-dired-original-file-name))
@@ -1209,9 +1205,7 @@
         (message "No image, or image with correct properties, at point.")
     (with-current-buffer dired-buf
         (message "%s" file-name)
-        (setq file-name (file-name-nondirectory file-name))
-        (goto-char (point-min))
-        (if (search-forward file-name nil t)
+        (if (dired-goto-file file-name)
             (cond ((eq command 'mark) (dired-mark 1))
                   ((eq command 'unmark) (dired-unmark 1))
                   ((eq command 'toggle)