bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22147: Obsolete search-forward-lax-whitespace


From: Artur Malabarba
Subject: bug#22147: Obsolete search-forward-lax-whitespace
Date: Mon, 14 Dec 2015 01:11:59 +0000

On 14 Dec 2015 12:23 am, "Juri Linkov" <address@hidden> wrote:
> >
> > True. I think it might also be possible to get what you want by just
> > setting the search-whitespace-regexp variable to "[ \t\r\n]+". That would
> > have the advantage of not removing char folding (and would reduce
> > everything to one line).
>
> This still doesn't allow ^J in the search string to match a newline.

Right. I always get confused about that variable.

> (maybe simpler
> would be to normalize the search string by turning all whitespace
> into space characters),

Yes, I think this should give you the behaviour you're looking for.
Try setting search-default-regexp-function to #'my-lax-with-char-fold, where

(defun my-lax-with-char-fold (s &optional l)
  (character-fold-to-regexp (replace-regexp-in-string "\t\n\r\s+" " " s) l))

And then also set search-whitespace-regexp like above.


reply via email to

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