From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Xu Newsgroups: gmane.emacs.devel Subject: Re: propose: dired-isearch.el --- isearch in Dired Date: Thu, 09 Aug 2007 11:46:46 +0900 Organization: the Church of Emacs Message-ID: <87zm11o25l.fsf@gmail.com> 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 1186627676 15982 80.91.229.12 (9 Aug 2007 02:47:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Aug 2007 02:47:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 09 04:47:55 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 1IIy43-00007g-4h for ged-emacs-devel@m.gmane.org; Thu, 09 Aug 2007 04:47:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIy42-0001US-PV for ged-emacs-devel@m.gmane.org; Wed, 08 Aug 2007 22:47:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IIy3z-0001Tp-QR for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:47:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IIy3x-0001RP-3V for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:47:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIy3w-0001RJ-Pf for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:47:48 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IIy3w-0003gN-Dm for emacs-devel@gnu.org; Wed, 08 Aug 2007 22:47:48 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IIy3o-0002TP-Bh for emacs-devel@gnu.org; Thu, 09 Aug 2007 04:47:40 +0200 Original-Received: from gw.community-engine.co.jp ([210.255.51.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Aug 2007 04:47:40 +0200 Original-Received: from william.xwl by gw.community-engine.co.jp with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Aug 2007 04:47:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gw.community-engine.co.jp User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) Cancel-Lock: sha1:8JVwJ+n47agcAnhINZZiW+REXsw= X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) 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:76234 Archived-At: Stefan Monnier writes: > 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))) It seems (isearch-search-fun) is problematic here. forward + backward search would fail. > 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)) I tried this trick, the bug is still there. Maybe need to look into isearch itself.. > 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? Although i think it's good enough, your idea is also very good. User can put it into some dired hooks. > 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. Checking 'dired-filename fails in tramp dired buffers. I'm not sure whether this is a bug or not. -- William