From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: propose: dired-isearch.el --- isearch in Dired Date: Wed, 08 Aug 2007 14:46:09 -0400 Message-ID: References: <874pjaiv45.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1186598781 541 80.91.229.12 (8 Aug 2007 18:46:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2007 18:46:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: William Xu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 08 20:46:18 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 1IIqXy-0002V0-C1 for ged-emacs-devel@m.gmane.org; Wed, 08 Aug 2007 20:46:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIqXx-0004e6-Kw for ged-emacs-devel@m.gmane.org; Wed, 08 Aug 2007 14:46:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IIqXt-0004dq-TM for emacs-devel@gnu.org; Wed, 08 Aug 2007 14:46:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IIqXs-0004dR-I9 for emacs-devel@gnu.org; Wed, 08 Aug 2007 14:46:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIqXs-0004dO-BC for emacs-devel@gnu.org; Wed, 08 Aug 2007 14:46:12 -0400 Original-Received: from tomts10.bellnexxia.net ([209.226.175.54] helo=tomts10-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IIqXs-0004D8-0a for emacs-devel@gnu.org; Wed, 08 Aug 2007 14:46:12 -0400 Original-Received: from pastel.home ([70.53.193.128]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070808184610.TFCY9197.tomts10-srv.bellnexxia.net@pastel.home> for ; Wed, 8 Aug 2007 14:46:10 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id F23BD856B; Wed, 8 Aug 2007 14:46:09 -0400 (EDT) In-Reply-To: <874pjaiv45.fsf@gmail.com> (William Xu's message of "Wed\, 08 Aug 2007 12\:05\:30 +0900") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-Detected-Kernel: Solaris 8 (1) 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:76201 Archived-At: Actually all the search funs can be collapsed into one: (defun dired-isearch-search-fun-function () 'dired-isearch-search) (defun dired-isearch-search (&rest args) (let ((fun (let ((isearch-search-fun-function nil)) (isearch-search-fun))) ret) (while (and (setq ret (apply fun args)) ;; Use `help-echo' instead of `dired-filename' so as to ;; also work in Tramp dired buffers. (not (get-text-property (1- point) 'help-echo))) (forward-char 1)) ret)) But there are two problems left: 1 - find a UI for it: just providing N new commands doesn't seem good enough. Maybe just something like: (define-minor-mode dired-isearch-filenames-mode "Only match filenames in isearch." (if dired-isearch-filenames-mode (set (make-local-variable 'isearch-search-fun-function) 'dired-isearch-search-fun-function) (kill-local-variable 'isearch-search-fun-function))) and then bind it to a key? 2 - checking `help-echo' is bound to get us into trouble when we add help-echo to other elements such as access right bits, etc... We really should check `dired-filename'. And if that doesn't work, let's fix it so that it does. And/or add a dired-pos-in-filename-p predicate to abstract over it. -- Stefan PS: The above pieces of code are all guaranteed 100% untested.