emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: propose: dired-isearch.el --- isearch in Dired


From: Stefan Monnier
Subject: Re: propose: dired-isearch.el --- isearch in Dired
Date: Wed, 08 Aug 2007 14:46:09 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]