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: Sun, 09 Nov 2008 23:57:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>     I think the most convenient default behavior would be context-dependent,
>     i.e. match only file names when point is on the file name column - where
>     point stays most of the time: after opening a dired buffer and through
>     dired operations including navigation.  So it would be natural to do the
>     same for isearch - never let point leave the file name column.
>
>     To search of the entire buffer, the user can move point outside the
>     file name column.  Since this need is very rare, there's no hassle.
>
> That sounds quite convenient.  If the prompt says "File name Isearch"
> when appropriate, people will understand what's going on.

While this change is still under discussion, the patch below at least
implements the prompt that says "File name Isearch".  It adds two new
variables isearch-message-prefix and isearch-message-suffix to insert
search-specific text before and after the stardard isearch messages.

However, I think that one word would be better to understand in
the isearch message, because other indications are all one word:
"failing", "wrapped", "regexp".  Please compare which is more readble:

  Failing wrapped File name regexp I-search:

  Failing wrapped Filename regexp I-search:

Index: lisp/dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.180
diff -c -r1.180 dired-aux.el
*** lisp/dired-aux.el   22 Oct 2008 20:21:21 -0000      1.180
--- lisp/dired-aux.el   9 Nov 2008 21:54:14 -0000
***************
*** 2355,2368 ****
  (defun dired-isearch-filenames ()
    "Search for a string using Isearch only in file names in the Dired buffer."
    (interactive)
!   (let ((dired-isearch-filenames t))
      (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))
      (isearch-forward-regexp)))
  
  
--- 2355,2370 ----
  (defun dired-isearch-filenames ()
    "Search for a string using Isearch only in file names in the Dired buffer."
    (interactive)
!   (let ((dired-isearch-filenames t)
!       (isearch-message-prefix "File name "))
      (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)
!       (isearch-message-prefix "File name "))
      (isearch-forward-regexp)))
  
  

Index: lisp/isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.331
diff -c -r1.331 isearch.el
*** lisp/isearch.el     19 Oct 2008 22:33:17 -0000      1.331
--- lisp/isearch.el     9 Nov 2008 21:54:47 -0000
***************
*** 532,537 ****
--- 532,539 ----
  
  (defvar isearch-string "")  ; The current search string.
  (defvar isearch-message "") ; text-char-description version of isearch-string
+ (defvar isearch-message-prefix nil)
+ (defvar isearch-message-suffix nil)
  
  (defvar isearch-success t)    ; Searching is currently successful.
  (defvar isearch-error nil)    ; Error message for failed search.
***************
*** 2144,2149 ****
--- 2162,2168 ----
                              (< (point) isearch-opoint)))
                       "over")
                   (if isearch-wrapped "wrapped ")
+                  (or isearch-message-prefix "")
                   (if isearch-word "word " "")
                   (if isearch-regexp "regexp " "")
                   (if multi-isearch-next-buffer-current-function "multi " "")
***************
*** 2160,2166 ****
    (concat (if c-q-hack "^Q" "")
          (if isearch-error
              (concat " [" isearch-error "]")
!           "")))
  
  
  ;; Searching
--- 2179,2186 ----
    (concat (if c-q-hack "^Q" "")
          (if isearch-error
              (concat " [" isearch-error "]")
!           "")
!         (or isearch-message-suffix "")))
  
  
  ;; Searching

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




reply via email to

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