emacs-devel
[Top][All Lists]
Advanced

[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: Sat, 08 Nov 2008 19:17:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> It would be useful for isearch in a dired buffer to match only file
>> names by default.  I think this would be a good feature -- if we can
>> come up with a natural way to request ordinary search of the entire
>> buffer.
>
> Emacs 23 has the M-s f C-s (dired-isearch-filenames) command which does
> just that, and the variable dired-isearch-filename which can be changed
> to non-nil to make C-s do the same as M-s f C-s.

When the variable `dired-isearch-filenames' is non-nil then it is not
possible to search the entire buffer because both `C-s' and `M-s f C-s'
start filename isearch.

The following patch changes `M-s f C-s' to start a non-default isearch,
i.e. isearch opposite (filenames vs entire buffer) to the value of
`dired-isearch-filenames' (that affects isearch started via `C-s'):

Index: lisp/dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.180
diff -u -r1.180 dired-aux.el
--- lisp/dired-aux.el   22 Oct 2008 20:21:21 -0000      1.180
+++ lisp/dired-aux.el   8 Nov 2008 17:16:27 -0000
@@ -2355,14 +2355,14 @@
 (defun dired-isearch-filenames ()
   "Search for a string using Isearch only in file names in the Dired buffer."
   (interactive)
-  (let ((dired-isearch-filenames t))
+  (let ((dired-isearch-filenames (not dired-isearch-filenames)))
     (isearch-forward)))
 
 ;;;###autoload
 (defun dired-isearch-filenames-regexp ()
   "Search for a regexp using Isearch only in file names in the Dired buffer."
   (interactive)
-  (let ((dired-isearch-filenames t))
+  (let ((dired-isearch-filenames (not dired-isearch-filenames)))
     (isearch-forward-regexp)))
 
 

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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