all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: rms@gnu.org
Cc: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
Subject: Re: Isearch in dired
Date: Tue, 11 Nov 2008 23:35:55 +0200	[thread overview]
Message-ID: <87y6zqc6yk.fsf@jurta.org> (raw)
In-Reply-To: <E1KzNBC-0004t9-Uv@fencepost.gnu.org> (Richard M. Stallman's message of "Sun, 09 Nov 2008 22:11:06 -0500")

>     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 ****
  \f
  ;; 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 ----
  \f
  ;; 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/




  reply	other threads:[~2008-11-11 21:35 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-08  9:56 Isearch in dired Richard M. Stallman
2008-11-08 10:59 ` Juri Linkov
2008-11-08 11:33   ` Lennart Borgman
2008-11-08 12:23     ` Alan Mackenzie
2008-11-08 15:22       ` Lennart Borgman
2008-11-08 17:07       ` Juri Linkov
2008-11-09  0:26   ` Richard M. Stallman
2008-11-09 21:57     ` Juri Linkov
2008-11-08 12:19 ` Alan Mackenzie
2008-11-08 17:08   ` Juri Linkov
2008-11-08 14:10 ` Chong Yidong
2008-11-08 16:05   ` joakim
2008-11-08 17:27     ` Juri Linkov
2008-11-08 17:17   ` Juri Linkov
2008-11-09  0:26   ` Richard M. Stallman
2008-11-08 21:57 ` Lazy " Juri Linkov
2008-11-09 20:54   ` recursive-edit in Isearch Juri Linkov
2008-11-09 21:09   ` Occur in Word Isearch Juri Linkov
2008-11-13 15:29     ` Chong Yidong
2008-11-13 15:30   ` Lazy Isearch in dired Chong Yidong
2008-11-13 15:32     ` Chong Yidong
2008-11-13 16:30       ` Juri Linkov
2008-11-13 17:07         ` Chong Yidong
2008-11-09 14:22 ` Chong Yidong
2008-11-09 15:08   ` Stefan Monnier
2008-11-09 17:59   ` Juri Linkov
2008-11-11 22:55     ` Chong Yidong
2008-11-12  2:59       ` Stefan Monnier
2008-11-12 11:59         ` René Kyllingstad
2008-11-12 15:13           ` Drew Adams
2008-11-12 15:53         ` Richard M. Stallman
2008-11-12  7:55       ` Juri Linkov
2008-11-12 15:08         ` Chong Yidong
2008-11-13 16:57           ` Juri Linkov
2008-11-16 22:22             ` Juri Linkov
2008-11-10  3:11   ` Richard M. Stallman
2008-11-11 21:35     ` Juri Linkov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-08  3:05 propose: dired-isearch.el --- isearch in Dired William Xu
2007-08-08 18:46 ` Stefan Monnier
2007-08-08 22:54   ` Juri Linkov
2008-07-23 20:34     ` Juri Linkov
2008-07-24  6:41       ` Mathias Dahl
2008-07-25  0:32         ` Juri Linkov
2008-07-24 13:53       ` Stefan Monnier
2008-07-24 15:52         ` Drew Adams
2008-07-24 17:20           ` Stefan Monnier
2008-07-25  0:33         ` Juri Linkov
2008-07-25  0:40           ` Lennart Borgman (gmail)
2008-07-29 15:45           ` Juri Linkov
2008-07-29 17:56             ` Stefan Monnier
2008-07-30 14:29               ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y6zqc6yk.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.