[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Isearch in dired
From: |
Juri Linkov |
Subject: |
Re: Isearch in dired |
Date: |
Tue, 11 Nov 2008 23:35:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
> However, one possibility is to define a standard "dwim search" key
> binding, and try to use that key binding everywhere we want a command
> that tries to guess where the user wants to search. Then we can make a
> "dwim search" in Dired mean searching filenames.
>
> It's a reasonable idea, in principle. If we wanted a special dwim
> search in several modes, this could be a good way to invoke it -- if we
> can't find an even better interface.
>
> Right now we know of only one mode where we want a sort of dwim
> search, and we have an even better interface suggestion. I think we
> should use it.
This is implemented by the following patch. It seems it provides a good
default behavior, so we could install it now and wait for a feedback.
Index: lisp/dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.181
diff -c -r1.181 dired-aux.el
*** lisp/dired-aux.el 11 Nov 2008 20:12:44 -0000 1.181
--- lisp/dired-aux.el 11 Nov 2008 21:35:18 -0000
***************
*** 2303,2312 ****
;; Search only in file names in the Dired buffer.
! (defcustom dired-isearch-filenames nil
"*If non-nil, Isearch in Dired matches only file names."
:type '(choice (const :tag "No restrictions" nil)
! (const :tag "Isearch only in file names" dired-filename))
:group 'dired
:version "23.1")
--- 2303,2313 ----
;; Search only in file names in the Dired buffer.
! (defcustom dired-isearch-filenames 'dwim
"*If non-nil, Isearch in Dired matches only file names."
:type '(choice (const :tag "No restrictions" nil)
! (const :tag "When point is on a file name search in file
names" dwim)
! (const :tag "Always search in file names" dired-filename))
:group 'dired
:version "23.1")
***************
*** 2330,2336 ****
(defun dired-isearch-filenames-setup ()
"Set up isearch to search in Dired file names.
Intended to be added to `isearch-mode-hook'."
! (when dired-isearch-filenames
(define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle)
(setq dired-isearch-orig-success-function
(default-value 'isearch-success-function))
--- 2331,2340 ----
(defun dired-isearch-filenames-setup ()
"Set up isearch to search in Dired file names.
Intended to be added to `isearch-mode-hook'."
! (when (or (eq dired-isearch-filenames 'dired-filename)
! (and (eq dired-isearch-filenames 'dwim)
! (get-text-property (point) 'dired-filename)))
! (setq isearch-message-prefix-add "filename ")
(define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle)
(setq dired-isearch-orig-success-function
(default-value 'isearch-success-function))
***************
*** 2339,2344 ****
--- 2343,2349 ----
(defun dired-isearch-filenames-end ()
"Clean up the Dired file name search after terminating isearch."
+ (setq isearch-message-prefix-add nil)
(define-key isearch-mode-map "\M-sf" nil)
(setq-default isearch-success-function dired-isearch-orig-success-function)
(remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t))
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: Isearch in dired, (continued)
- Re: Isearch in dired, Richard M. Stallman, 2008/11/12
- Re: Isearch in dired, Juri Linkov, 2008/11/12
- Re: Isearch in dired, Chong Yidong, 2008/11/12
- Re: Isearch in dired, Juri Linkov, 2008/11/13
- Re: Isearch in dired, Juri Linkov, 2008/11/16
Re: Isearch in dired, Richard M. Stallman, 2008/11/09
- Re: Isearch in dired,
Juri Linkov <=