From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Mathias Dahl" Newsgroups: gmane.emacs.devel Subject: Small bug in image-dired-track-original-file - suggestions wanted Date: Sun, 30 Mar 2008 02:48:27 +0100 Message-ID: <7dbe73ed0803291848u41641ea7q1ba2dd15feb156b3@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1206841725 6230 80.91.229.12 (30 Mar 2008 01:48:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2008 01:48:45 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 30 03:49:16 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jfmfa-0002OW-Hm for ged-emacs-devel@m.gmane.org; Sun, 30 Mar 2008 03:49:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jfmey-00049X-Sr for ged-emacs-devel@m.gmane.org; Sat, 29 Mar 2008 21:48:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jfmev-00049S-Q2 for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:48:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jfmer-00049C-Bz for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:48:32 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jfmer-000492-5m for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:48:29 -0400 Original-Received: from rv-out-0910.google.com ([209.85.198.186]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jfmeq-0008I1-NS for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:48:28 -0400 Original-Received: by rv-out-0910.google.com with SMTP id c27so1020482rvf.6 for ; Sat, 29 Mar 2008 18:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=NNDHoqua0eZAZF49j6Qk1T0oOXr/xKRk92kcZ1bs1j0=; b=ADrJXp7Jsyhlad6dmBeBnmER5gls/fl5yxPsCvX7Np/o87ZTQJKMt3eGlUSUIolUZqk8meAmBUtpBqoQxggHlHmIvn+PZob/xOXYUvLSIlxC6de2PLQ86xQTS3j0TlhnBmSKuJRBKje6XTQbmlVPtF69Cn6GpMyqfwLEGyBhJG0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=RwUXeB5aJO5iw5uHUuJmo1Mp9an28fXiDVyOy+qjR7XDGZxHyqoz0oHdHDk9OzJJzul9DX+G48GbtT3eUh+c3BvqGcFFeB9ZGEuTbiu4e9lTNQEn5kBLTfbnodIufx0g+CKWj6f7QEGJWfoKn8nHDn7pVFzfXAeM7YaML/BOTQA= Original-Received: by 10.114.158.1 with SMTP id g1mr6979163wae.111.1206841707800; Sat, 29 Mar 2008 18:48:27 -0700 (PDT) Original-Received: by 10.114.146.9 with HTTP; Sat, 29 Mar 2008 18:48:27 -0700 (PDT) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:93861 Archived-At: 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?