all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* can't tell if one is searching with appended whitespace
@ 2004-06-03 20:42 Dan Jacobson
  2004-06-04 21:40 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Jacobson @ 2004-06-03 20:42 UTC (permalink / raw)


Gentlemen, looking in the minibuffer, how can you tell the difference between
I-search: bla
and
I-search: bla 
Therefore, something must be done about it.
Why, one could miss important stuff if one doesn't realize he is
carrying around an appended blank in his search string!
Perhaps do something with color, or a " $" appearing, or turn on
show-trailing-whitespace in the minibuffer by default.
(setq-default show-trailing-whitespace t in .emacs isn't good enough.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't tell if one is searching with appended whitespace
  2004-06-03 20:42 can't tell if one is searching with appended whitespace Dan Jacobson
@ 2004-06-04 21:40 ` Kevin Rodgers
  2004-06-07  6:35   ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2004-06-04 21:40 UTC (permalink / raw)


Dan Jacobson wrote:
 > Gentlemen, looking in the minibuffer, how can you tell the difference between
 > I-search: bla
 > and
 > I-search: bla
 > Therefore, something must be done about it.
 > Why, one could miss important stuff if one doesn't realize he is
 > carrying around an appended blank in his search string!
 > Perhaps do something with color, or a " $" appearing, or turn on
 > show-trailing-whitespace in the minibuffer by default.
 > (setq-default show-trailing-whitespace t in .emacs isn't good enough.)

That may be because trailing whitespace is not highlighted when point is
at the end of a line in any buffer, even if the line is terminated by a
newline (and thus there is at least 1 [possibly empty] subsequent line).

Or perhaps that point is moot, because isearch.el displays the search
string in the echo area, not in the minibuffer (if so, perhaps the
message function should be changed to respect show-trailing-whitespace).

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't tell if one is searching with appended whitespace
  2004-06-04 21:40 ` Kevin Rodgers
@ 2004-06-07  6:35   ` Juri Linkov
  2004-06-07 19:17     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2004-06-07  6:35 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes in bug-gnu-emacs:
> Dan Jacobson wrote:
>  > Gentlemen, looking in the minibuffer, how can you tell the difference between
>  > I-search: bla
>  > and
>  > I-search: bla 
>  > Therefore, something must be done about it.
>  > Why, one could miss important stuff if one doesn't realize he is
>  > carrying around an appended blank in his search string!
>  > Perhaps do something with color, or a " $" appearing, or turn on
>  > show-trailing-whitespace in the minibuffer by default.
>  > (setq-default show-trailing-whitespace t in .emacs isn't good enough.)
>
> That may be because trailing whitespace is not highlighted when point is
> at the end of a line in any buffer, even if the line is terminated by a
> newline (and thus there is at least 1 [possibly empty] subsequent line).
>
> Or perhaps that point is moot, because isearch.el displays the search
> string in the echo area, not in the minibuffer (if so, perhaps the
> message function should be changed to respect show-trailing-whitespace).

I suspect it would be very annoying when trailing whitespace will be
highlighted in all messages.  But highlighting it only in failed
isearch (i.e. in the message "Failing I-search: ...") may be good.
Or another solution is to add explicit text about whitespace as the
suffix of the failed string.  I included both solutions below:

Index: lisp/isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.228
diff -u -r1.228 isearch.el
--- lisp/isearch.el	6 Jun 2004 13:57:39 -0000	1.228
+++ lisp/isearch.el	7 Jun 2004 00:29:14 -0000
@@ -1764,7 +1786,13 @@
   (let ((cursor-in-echo-area ellipsis)
 	(m (concat
 	    (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
-	    isearch-message
+	    (if (and (not isearch-success)
+                     (string-match " +$" isearch-message))
+                (concat
+                 (substring isearch-message 0 (match-beginning 0))
+                 (propertize (substring isearch-message (match-beginning 0))
+                             'face 'trailing-whitespace))
+              isearch-message)
 	    (isearch-message-suffix c-q-hack ellipsis)
 	    )))
     (if c-q-hack
@@ -1806,7 +1834,10 @@
   (concat (if c-q-hack "^Q" "")
 	  (if isearch-invalid-regexp
 	      (concat " [" isearch-invalid-regexp "]")
-	    "")))
+	    "")
+          (if (and (not isearch-success)
+                   (string-match " $" isearch-message))
+              "[whitespace]")))
 
 \f
 ;; Searching

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't tell if one is searching with appended whitespace
  2004-06-07  6:35   ` Juri Linkov
@ 2004-06-07 19:17     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-06-07 19:17 UTC (permalink / raw)
  Cc: emacs-devel

    I suspect it would be very annoying when trailing whitespace will be
    highlighted in all messages.  But highlighting it only in failed
    isearch (i.e. in the message "Failing I-search: ...") may be good.

Could people please try that change for a week and then we
can discuss whether we like it?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-06-07 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03 20:42 can't tell if one is searching with appended whitespace Dan Jacobson
2004-06-04 21:40 ` Kevin Rodgers
2004-06-07  6:35   ` Juri Linkov
2004-06-07 19:17     ` Richard Stallman

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.