all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Search in filled text does not work correctly
@ 2012-02-25 12:59 linuxfever
  2012-02-25 14:10 ` Peter Dyballa
  2012-02-26  1:59 ` Gregory (Greg) Benjamin
  0 siblings, 2 replies; 14+ messages in thread
From: linuxfever @ 2012-02-25 12:59 UTC (permalink / raw)
  To: Help-gnu-emacs


Hello everyone,

I am not sure if this is a bug or a missing functionality, so I thought to
try here first before reporting as a bug. I have noticed that when searching
for an expression in a filled text, then the search function (C-s) does not
find the expression when it is broken between lines. Try the example below
in your scratch buffer by copying and pasting it and searching for such an
expression.

Example for checking that when the text is filled the search
function does not work correctly. After filling this
paragraph (M-x fill-paragraph), try to search for two words that
are broken between lines. In my scratch buffer, this was 'the
search' and should be found at the end of the first line, but was
not found by the command.

Does the same happen in your Emacs as well? Thanks in advance!
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33390451.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Search in filled text does not work correctly
  2012-02-25 12:59 Search in filled text does not work correctly linuxfever
@ 2012-02-25 14:10 ` Peter Dyballa
  2012-02-25 14:54   ` linuxfever
  2012-02-26  1:59 ` Gregory (Greg) Benjamin
  1 sibling, 1 reply; 14+ messages in thread
From: Peter Dyballa @ 2012-02-25 14:10 UTC (permalink / raw)
  To: linuxfever; +Cc: Help-gnu-emacs


Am 25.2.2012 um 13:59 schrieb linuxfever:

> Does the same happen in your Emacs as well?

Yes, of course! The text is broken, there is no SPACE character between the two words but a LINE FEED. So try to search for two words separated by a LINE FEED:

	C-s f i r s t C-q C-j s e c o n d

Or try isearch-forward-regexp!

--
Greetings

  Pete

I wouldn't recommend sex, drugs or insanity for everyone, but they've always worked for me.
				– Hunter S. Thompson




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

* Re: Search in filled text does not work correctly
  2012-02-25 14:10 ` Peter Dyballa
@ 2012-02-25 14:54   ` linuxfever
  2012-02-25 15:03     ` linuxfever
  0 siblings, 1 reply; 14+ messages in thread
From: linuxfever @ 2012-02-25 14:54 UTC (permalink / raw)
  To: Help-gnu-emacs


Thanks, I just tried that out and it works. However, is there a way to change
the default behaviour of search (C-s) so that it automatically searches for
the expression including line feeds as well?
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33390812.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Search in filled text does not work correctly
  2012-02-25 14:54   ` linuxfever
@ 2012-02-25 15:03     ` linuxfever
  2012-02-25 23:17       ` bitterspetey
  0 siblings, 1 reply; 14+ messages in thread
From: linuxfever @ 2012-02-25 15:03 UTC (permalink / raw)
  To: Help-gnu-emacs


Ok, never mind, I found that incremental word search does what I need (M-s
w)! Thanks for the help!
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33390841.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Search in filled text does not work correctly
  2012-02-25 15:03     ` linuxfever
@ 2012-02-25 23:17       ` bitterspetey
  2012-02-25 23:22         ` Drew Adams
  2012-02-26  0:30         ` linuxfever
  0 siblings, 2 replies; 14+ messages in thread
From: bitterspetey @ 2012-02-25 23:17 UTC (permalink / raw)
  To: Help-gnu-emacs


But suppose you wanted to replace the phrase?  Then it looks like incremental
word search will not help, and you need the fancy regexp with the literal
line feed character.

Given that in the short time I've been watching this list the issue has come
up twice, does it make sense to call this a bug of sorts? It's a little
disappointing that it's difficult to do something as straightforward as
searching / replacing a phrase. It seems in search contexts emacs should
read a space as whitespace or feed, unless it's escaped or something.


linuxfever wrote:
> 
> Ok, never mind, I found that incremental word search does what I need (M-s
> w)! Thanks for the help!
> 

-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33392628.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* RE: Search in filled text does not work correctly
  2012-02-25 23:17       ` bitterspetey
@ 2012-02-25 23:22         ` Drew Adams
  2012-02-26  0:30         ` linuxfever
  1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2012-02-25 23:22 UTC (permalink / raw)
  To: 'bitterspetey', Help-gnu-emacs

> But suppose you wanted to replace the phrase?  Then it looks 
> like incremental word search will not help, and you need the
> fancy regexp with the literal line feed character.
> 
> Given that in the short time I've been watching this list
> the issue has come up twice, does it make sense to call
> this a bug of sorts? It's a little disappointing that it's
> difficult to do something as straightforward as
> searching / replacing a phrase. It seems in search contexts 
> emacs should read a space as whitespace or feed, unless
> it's escaped or something.

The way to register an enhancement request is to use `M-x report-emacs-bug'.
(That's for enhancement requests, not just for bugs.)




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

* Re: Search in filled text does not work correctly
  2012-02-25 23:17       ` bitterspetey
  2012-02-25 23:22         ` Drew Adams
@ 2012-02-26  0:30         ` linuxfever
  2012-02-26  1:05           ` linuxfever
  1 sibling, 1 reply; 14+ messages in thread
From: linuxfever @ 2012-02-26  0:30 UTC (permalink / raw)
  To: Help-gnu-emacs




bitterspetey wrote:
> 
> It seems in search contexts emacs should read a space as whitespace or
> feed, unless it's escaped or something.
> 

I completely agree. I will check to see first if a similar request has been
made, and if not, I will submit one.
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33392770.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Search in filled text does not work correctly
  2012-02-26  0:30         ` linuxfever
@ 2012-02-26  1:05           ` linuxfever
  2012-02-26  1:18             ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: linuxfever @ 2012-02-26  1:05 UTC (permalink / raw)
  To: Help-gnu-emacs


Ok, I just filed a report here:

http://old.nabble.com/Replace-expressions%3A-enhance-functionality-when-searching-in-filled-paragraphs-td33392837.html

Regards
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33392844.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* RE: Search in filled text does not work correctly
  2012-02-26  1:05           ` linuxfever
@ 2012-02-26  1:18             ` Drew Adams
  2012-02-26  1:31               ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2012-02-26  1:18 UTC (permalink / raw)
  To: 'linuxfever', Help-gnu-emacs

> Ok, I just filed a report here:
> http://old.nabble.com/Replace-expressions%3A-enhance-functiona
> lity-when-searching-in-filled-paragraphs-td33392837.html

I could be wrong, but I don't think that that files a bug report (enhancement
request).  That post, at least, does not (yet) seem to have an associated bug
number.  (Someone will correct me if I'm wrong about this.)

My guess is that you need to report the bug using email to
`bug-gnu-emacs@gnu.org', preferably via `M-x report-emacs-bug'.

That's what it's for.  If you invoke that Emacs command it will tell you how to
file a bug report.  See also the Emacs manual: `C-h r g checklist'.




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

* RE: Search in filled text does not work correctly
  2012-02-26  1:18             ` Drew Adams
@ 2012-02-26  1:31               ` Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2012-02-26  1:31 UTC (permalink / raw)
  To: 'linuxfever', Help-gnu-emacs

> I could be wrong, but I don't think that that files a bug 
> report (enhancement request).  That post, at least, does not
> (yet) seem to have an associated bug number.

I stand corrected.  It showed up as bug #10885.
Sorry for the noise.




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

* Re: Search in filled text does not work correctly
@ 2012-02-26  1:59 ` Gregory (Greg) Benjamin
  2012-02-26 19:41   ` bitterspetey
  0 siblings, 1 reply; 14+ messages in thread
From: Gregory (Greg) Benjamin @ 2012-02-26  1:59 UTC (permalink / raw)
  To: Help-gnu-emacs


I happened to want to convert a list like this:

"apple" "banana" "cherry"

to this format:

apple
banana
cherry

the other day. I started our with 'replace-regexp' and learned about
C-q C-j in a matter of minutes after first trying \n, \\n, C-j,
etc. before googling. 

Perhaps it would be better to educate rather than change emacs'
behavior. The built-in tutorial could have a few words added about
using C-q C-j with respect to searching and replacing, or the single
tutorial now provided could be broken into several, with one dedicated
to searching, replacing, highlighting, displaying only the lines
containing a pattern, etc.





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

* Re: Search in filled text does not work correctly
  2012-02-26  1:59 ` Gregory (Greg) Benjamin
@ 2012-02-26 19:41   ` bitterspetey
  2012-02-26 19:58     ` bitterspetey
  0 siblings, 1 reply; 14+ messages in thread
From: bitterspetey @ 2012-02-26 19:41 UTC (permalink / raw)
  To: Help-gnu-emacs


Certainly you can learn to do it - but I found it a bit remarkable that such
a sophisticated regexp was required to allow for the possibility of breaking
over lines (and catch the other usual whitespace).  I'm not a power user by
a longshot (like I very rarely do any lisp) - but I've been a user for over
a decade, and I picked up some amount of regular expression stuff, and it
still took me some time to figure out that '\s-' does not match line feeds,
contrary to explicit statement in 
http://www.emacswiki.org/emacs/RegularExpression the manual :

Note also that \s- matches space, tab, newline and carriage return. This can
be handy in a [^ … ] construct.
If I had this trouble, I'm guessing a totally new user, curious about the
power of emacs, is going to be totally at sea.
So I think if the emacs community cares about new users, this is a default
that should be changed.  You should have the option to search for an
explicit space, of course, but the default in searches should be a
whitespace of any of the generic sorts.


gregben wrote:
> 
> I happened to want to convert a list like this:
> 
> "apple" "banana" "cherry"
> 
> to this format:
> 
> apple
> banana
> cherry
> 
> the other day. I started our with 'replace-regexp' and learned about
> C-q C-j in a matter of minutes after first trying \n, \\n, C-j,
> etc. before googling. 
> 
> Perhaps it would be better to educate rather than change emacs'
> behavior. The built-in tutorial could have a few words added about
> using C-q C-j with respect to searching and replacing, or the single
> tutorial now provided could be broken into several, with one dedicated
> to searching, replacing, highlighting, displaying only the lines
> containing a pattern, etc.
> 

-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33395942.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* Re: Search in filled text does not work correctly
  2012-02-26 19:41   ` bitterspetey
@ 2012-02-26 19:58     ` bitterspetey
  2012-02-27 13:26       ` Ludwig, Mark
  0 siblings, 1 reply; 14+ messages in thread
From: bitterspetey @ 2012-02-26 19:58 UTC (permalink / raw)
  To: Help-gnu-emacs


Oops.  Now this is working for me to find 'foo bar' across lines and such:

foo\s-*bar
I swear it wasn't before. I have no idea what could make the difference -
the major mode? Anyway I still think the space in a simple 'foo bar' should
be interpreted widely in search contexts, unless explicitly escaped or
something.
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33395991.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




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

* RE: Search in filled text does not work correctly
  2012-02-26 19:58     ` bitterspetey
@ 2012-02-27 13:26       ` Ludwig, Mark
  0 siblings, 0 replies; 14+ messages in thread
From: Ludwig, Mark @ 2012-02-27 13:26 UTC (permalink / raw)
  To: bitterspetey, Help-gnu-emacs@gnu.org

I've been using Emacs for >30 years, and I've always wished that searching for a specific sequence of characters and words including whitespace in a text file would automatically span lines.

Of course, early on, I learned how to form the regular expression that does this (this predates the "\s-" construct in today's GNU Emacs).  This request feels to me like a different sort of search.  Were I doing this 30 years ago, I would have called it Isearch-English or something like that.  (Mostly I work with computer languages, which is why I never got around to writing anything like this....)  In today's multi-lingual world, I'm not sure what to call it, and I also don't know which natural languages (outside of the obvious European-based languages) would work with this concept.

Cheers,

Mark

-----Original Message-----
From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of bitterspetey
Sent: Sunday, February 26, 2012 1:58 PM
To: Help-gnu-emacs@gnu.org
Subject: Re: Search in filled text does not work correctly


Oops.  Now this is working for me to find 'foo bar' across lines and such:

foo\s-*bar
I swear it wasn't before. I have no idea what could make the difference -
the major mode? Anyway I still think the space in a simple 'foo bar' should
be interpreted widely in search contexts, unless explicitly escaped or
something.
-- 
View this message in context: http://old.nabble.com/Search-in-filled-text-does-not-work-correctly-tp33390451p33395991.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





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

end of thread, other threads:[~2012-02-27 13:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-25 12:59 Search in filled text does not work correctly linuxfever
2012-02-25 14:10 ` Peter Dyballa
2012-02-25 14:54   ` linuxfever
2012-02-25 15:03     ` linuxfever
2012-02-25 23:17       ` bitterspetey
2012-02-25 23:22         ` Drew Adams
2012-02-26  0:30         ` linuxfever
2012-02-26  1:05           ` linuxfever
2012-02-26  1:18             ` Drew Adams
2012-02-26  1:31               ` Drew Adams
2012-02-26  1:59 ` Gregory (Greg) Benjamin
2012-02-26 19:41   ` bitterspetey
2012-02-26 19:58     ` bitterspetey
2012-02-27 13:26       ` Ludwig, Mark

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.