all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Small bug in image-dired-track-original-file - suggestions wanted
@ 2008-03-30  1:48 Mathias Dahl
  2008-03-30 22:44 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Mathias Dahl @ 2008-03-30  1:48 UTC (permalink / raw)
  To: emacs-devel

There is a small bug in this code which is used to "track" the
original file name in the Dired buffer from inside the thumbnail
buffer.

(defun image-dired-track-original-file ()
  "Track the original file in the associated dired buffer.
See documentation for `image-dired-toggle-movement-tracking'.  Interactive
use only useful if `image-dired-track-movement' is nil."
  (interactive)
  (let ((old-buf (current-buffer))
        (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))
          (message "Could not track file")
        (dired-move-to-filename)
        (set-window-point
         (image-dired-get-buffer-window dired-buf) (point)))
      (set-buffer old-buf))))

To track (find) a file in the dired buffer, a very simple search is
done, but it can get false hits. For example if you have the files "00
07.jpg" and "07.jpg", the function will find "00 07.jpg" first, when
trying to track "07.jpg", thus tracking the wrong file. I see that
there exist the `directory-listing-before-filename-regexp' variable
but it is so large that I suspect it will affect performance. Tracking
needs to be fast, and it is quite fast now.

Any ideas?




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

end of thread, other threads:[~2008-03-31 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-30  1:48 Small bug in image-dired-track-original-file - suggestions wanted Mathias Dahl
2008-03-30 22:44 ` Juri Linkov
2008-03-31 13:35   ` Mathias Dahl
2008-03-31 18:08     ` Mathias Dahl

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.