From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Isearch in dired Date: Tue, 11 Nov 2008 23:35:55 +0200 Organization: JURTA Message-ID: <87y6zqc6yk.fsf@jurta.org> References: <87zlk90yjb.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226439838 22819 80.91.229.12 (11 Nov 2008 21:43:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Nov 2008 21:43:58 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 11 22:44:57 2008 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 1L012V-0008Jw-Al for ged-emacs-devel@m.gmane.org; Tue, 11 Nov 2008 22:44:47 +0100 Original-Received: from localhost ([127.0.0.1]:37777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L011N-00084w-74 for ged-emacs-devel@m.gmane.org; Tue, 11 Nov 2008 16:43:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L00yy-0006ph-CC for emacs-devel@gnu.org; Tue, 11 Nov 2008 16:41:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L00yw-0006op-Ks for emacs-devel@gnu.org; Tue, 11 Nov 2008 16:41:07 -0500 Original-Received: from [199.232.76.173] (port=59690 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L00yw-0006og-6U for emacs-devel@gnu.org; Tue, 11 Nov 2008 16:41:06 -0500 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]:54753) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L00yt-0002ef-Hk; Tue, 11 Nov 2008 16:41:04 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1L00yp-000LRz-Pe; Tue, 11 Nov 2008 23:41:00 +0200 In-Reply-To: (Richard M. Stallman's message of "Sun, 09 Nov 2008 22:11:06 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 33ca3efb02d57e4381ef3dfbedf9ea6a X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 5467 [Oct 22 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) 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:105586 Archived-At: > 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/