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: Re: Small bug in image-dired-track-original-file - suggestions wanted Date: Mon, 31 Mar 2008 20:08:51 +0200 Message-ID: <7dbe73ed0803311108s151f2857ld107316a14439613@mail.gmail.com> References: <7dbe73ed0803291848u41641ea7q1ba2dd15feb156b3@mail.gmail.com> <877ifjrhyv.fsf@jurta.org> <7dbe73ed0803310635r63cad9b9pdc04c4cf6b105733@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 1206986954 25883 80.91.229.12 (31 Mar 2008 18:09:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Mar 2008 18:09:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Juri Linkov" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 31 20:09:45 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 1JgORu-0002DJ-FW for ged-emacs-devel@m.gmane.org; Mon, 31 Mar 2008 20:09:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgORI-0000Fv-HY for ged-emacs-devel@m.gmane.org; Mon, 31 Mar 2008 14:09:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JgORE-0000Fg-Cf for emacs-devel@gnu.org; Mon, 31 Mar 2008 14:08:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JgORB-0000El-Tj for emacs-devel@gnu.org; Mon, 31 Mar 2008 14:08:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgORB-0000Ei-OI for emacs-devel@gnu.org; Mon, 31 Mar 2008 14:08:53 -0400 Original-Received: from rn-out-0910.google.com ([64.233.170.187]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JgORB-0005gr-4f for emacs-devel@gnu.org; Mon, 31 Mar 2008 14:08:53 -0400 Original-Received: by rn-out-0910.google.com with SMTP id e21so781812rng.6 for ; Mon, 31 Mar 2008 11:08:51 -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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=vAxdxQ0bnyO4FdDr1tqwi31poT6e3XGLj5hU1nZIFNk=; b=Mm2kX/CiBz3yfeqvLHKM249CoK3LOhVr4jsCqL8++2d+3I+2nmhVFN9J2+Y6IKMXgcKfG7zRMTcM28dXIU3IhGFHk9+bxDSbY1d/I9ARfr2h+9N5qmnLSfMcEviA/jjYUgguqxyQnbjwFGyq3sGs6ALedDKR770F6bqUNlQXG9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Te73Av0E8T/XNCaAo9bFrbfVW7h10UF+kZKqk01ZSSFXXM7zGTXJFQA/ucmWNnDFQf99sTQDnP4XZMRupfN26Lg2CEa/gezXggyZeW6t7z5QqZ1phWfgUFkjVoFnEB5eunPas1pa72p/CcUDKj7l6e4T4E0Wi75WKOix5x+RmE8= Original-Received: by 10.114.197.1 with SMTP id u1mr10567382waf.61.1206986931263; Mon, 31 Mar 2008 11:08:51 -0700 (PDT) Original-Received: by 10.114.146.9 with HTTP; Mon, 31 Mar 2008 11:08:51 -0700 (PDT) In-Reply-To: <7dbe73ed0803310635r63cad9b9pdc04c4cf6b105733@mail.gmail.com> 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:94051 Archived-At: > Thanks! I replaced some code with `dired-goto-file' and it seems to > solve the bug and it sems to have acceptable performance. And here is the fix: diff -c /home/mathias/image-dired.el /home/mathias/prj/emacs/lisp/image-dired.el *** /home/mathias/image-dired.el 2008-03-31 20:04:00.000000000 +0200 --- /home/mathias/prj/emacs/lisp/image-dired.el 2008-03-31 20:04:32.000000000 +0200 *************** *** 1030,1041 **** (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)))) --- 1030,1038 ---- (dired-buf (image-dired-associated-dired-buffer)) (file-name (image-dired-original-file-name))) (when (and (buffer-live-p dired-buf) file-name) (set-buffer dired-buf) ! (if (not (dired-goto-file file-name)) (message "Could not track file") (set-window-point (image-dired-get-buffer-window dired-buf) (point))) (set-buffer old-buf)))) *************** *** 1199,1206 **** (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 unmarking file in dired or 'flag for flagging file for delete in dired." (let ((file-name (image-dired-original-file-name)) --- 1196,1202 ---- (defun image-dired-modify-mark-on-thumb-original-file (command) "Modify mark in dired buffer. ! 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,1217 **** (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) (cond ((eq command 'mark) (dired-mark 1)) ((eq command 'unmark) (dired-unmark 1)) ((eq command 'toggle) --- 1205,1211 ---- (message "No image, or image with correct properties, at point.") (with-current-buffer dired-buf (message "%s" file-name) ! (if (dired-goto-file file-name) (cond ((eq command 'mark) (dired-mark 1)) ((eq command 'unmark) (dired-unmark 1)) ((eq command 'toggle) Diff finished. Mon Mar 31 20:04:47 2008 The change that has been done is to use `dired-goto-file file-name' instead of the too simple `search-forward', in both of these functions. Could someone commit this? /Mathias