From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: RE: propose: dired-isearch.el --- isearch in Dired Date: Thu, 09 Aug 2007 10:37:16 +0800 Message-ID: References: <874pjaiv45.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1186627058 14784 80.91.229.12 (9 Aug 2007 02:37:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Aug 2007 02:37:38 +0000 (UTC) To: william.xwl@gmail.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 09 04:37:36 2007 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 1IIxtx-0006Yp-EF for ged-emacs-devel@m.gmane.org; Thu, 09 Aug 2007 04:37:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIxtw-0007Yq-Gd for ged-emacs-devel@m.gmane.org; Wed, 08 Aug 2007 22:37:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IIxtt-0007Yb-Ns for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:37:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IIxts-0007YP-3r for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:37:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIxts-0007YM-0i for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:37:24 -0400 Original-Received: from bay0-omc3-s30.bay0.hotmail.com ([65.54.246.230]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IIxtr-0002OZ-K7 for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:37:23 -0400 Original-Received: from hotmail.com ([65.55.154.118]) by bay0-omc3-s30.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 8 Aug 2007 19:37:23 -0700 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 8 Aug 2007 19:37:22 -0700 Original-Received: from 65.55.154.123 by by143fd.bay143.hotmail.msn.com with HTTP; Thu, 09 Aug 2007 02:37:16 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: <874pjaiv45.fsf@gmail.com> X-OriginalArrivalTime: 09 Aug 2007 02:37:22.0513 (UTC) FILETIME=[36BE2410:01C7DA2E] X-Detected-Kernel: Windows 2000 SP4, XP SP1+ 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:76232 Archived-At: Without applying Juri's proposal, this is an implementation that resolves both the two bugs mentioned in my previous message: the regexp "^" bug and searching goes into fields other than file names bug. I think other functions (e.g. dired-re-search-backward) can be implemented this way too. (defun dired-next-file-name (point bound) (let* ((start (cond ((= point 1) (if (get-char-property point 'help-echo) point (next-single-property-change point 'help-echo))) ((get-char-property point 'help-echo) (if (get-char-property (1- point) 'help-echo) (progn (setq point (next-single-property-change point 'help-echo)) (next-single-property-change point 'help-echo)) point)) (t (next-single-property-change point 'help-echo)))) (end (when start (next-single-property-change start 'help-echo)))) (when (and end (< end bound)) (goto-char start) (buffer-substring start end)))) (defun dired-re-search-forward (regexp &optional bound noerror count) "In Dired, run `re-search-forward' but match only at file names." (let ((start (point)) (not-found nil) name match-data) (save-excursion (unless bound (setq bound (point-max))) (while (and (prog1 (setq name (dired-next-file-name start bound)) (unless name (setq not-found t))) (not (string-match regexp name))) (setq start (1+ (point)))) (unless not-found (setq match-data (list (+ (point) (match-beginning 0)) (+ (point) (match-end 0)))) (set-match-data match-data) (nth 1 match-data))))) Please consider rewriting other functions this way. Regards, Guanpeng Xu _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/