[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: propose: dired-isearch.el --- isearch in Dired
From: |
Juri Linkov |
Subject: |
Re: propose: dired-isearch.el --- isearch in Dired |
Date: |
Thu, 09 Aug 2007 01:54:38 +0300 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
I think using isearch in Dired to match only at filenames is a very good idea.
> 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))
With patches (uninstalled due to feature freeze) from the thread
http://lists.gnu.org/archive/html/emacs-devel/2005-03/msg00785.html
this implementation can be collapsed even more:
(set (make-local-variable 'isearch-success-function)
(lambda () (get-text-property (1- point) 'help-echo)))
or with a new function `dired-pos-in-filename-p':
(set (make-local-variable 'isearch-success-function)
'dired-pos-in-filename-p)
> 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?
And to use the same key to activate other links-only searches like on
links in Info (filenames in dired buffers are links too).
> 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.
--
Juri Linkov
http://www.jurta.org/emacs/
- propose: dired-isearch.el --- isearch in Dired, William Xu, 2007/08/07
- Re: propose: dired-isearch.el --- isearch in Dired, Levin, 2007/08/07
- Re: propose: dired-isearch.el --- isearch in Dired, Miles Bader, 2007/08/08
- Re: propose: dired-isearch.el --- isearch in Dired, Stefan Monnier, 2007/08/08
- Re: propose: dired-isearch.el --- isearch in Dired, Richard Stallman, 2007/08/08
- Re: propose: dired-isearch.el --- isearch in Dired, William Xu, 2007/08/08
- Re: propose: dired-isearch.el --- isearch in Dired, Richard Stallman, 2007/08/09
- Re: propose: dired-isearch.el --- isearch in Dired, William Xu, 2007/08/09
- Re: propose: dired-isearch.el --- isearch in Dired, Mathias Dahl, 2007/08/10
- Re: propose: dired-isearch.el --- isearch in Dired, David Kastrup, 2007/08/10
- RE: propose: dired-isearch.el --- isearch in Dired, Drew Adams, 2007/08/10
- Re: propose: dired-isearch.el --- isearch in Dired, William Xu, 2007/08/11
- RE: propose: dired-isearch.el --- isearch in Dired, Drew Adams, 2007/08/11