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: Juri Linkov
Subject: bug#22147: Obsolete search-forward-lax-whitespace
Date: Sat, 12 Dec 2015 01:52:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu)

After commit e5ece322 that removed a layer of indirection for lax-whitespace
it's not possible anymore to override search-forward-lax-whitespace
with own implementation to ignore all possible whitespace instead of
just spaces in the search string.

For example, such customization as this one:

(setq  search-whitespace-regexp "\\(\\s-\\|\n\\)+")
(defun search-whitespace-regexp (string)
  "Return a regexp which ignores all possible whitespace in search string.
Uses the value of the variable `search-whitespace-regexp'."
  (if (or (not (stringp search-whitespace-regexp))
          (null (if isearch-regexp
                    isearch-regexp-lax-whitespace
                  isearch-lax-whitespace)))
      string
    (replace-regexp-in-string
     search-whitespace-regexp
     search-whitespace-regexp
     string nil t)))
(defun search-forward-lax-whitespace (string &optional bound noerror count)
  (re-search-forward (search-whitespace-regexp (regexp-quote string)) bound 
noerror count))
(defun search-backward-lax-whitespace (string &optional bound noerror count)
  (re-search-backward (search-whitespace-regexp (regexp-quote string)) bound 
noerror count))
(defun re-search-forward-lax-whitespace (regexp &optional bound noerror count)
  (re-search-forward (search-whitespace-regexp regexp) bound noerror count))
(defun re-search-backward-lax-whitespace (regexp &optional bound noerror count)
  (re-search-backward (search-whitespace-regexp regexp) bound noerror count))

allowed to search for a string with a newline like ‘C-s abc C-q C-j def’
and match the text “abc def”.

It's not clear what to do with this customization now using
a replacement recommended in (make-obsolete old "instead, use (let
((search-spaces-regexp search-whitespace-regexp)) (re-search-... ...))"





reply via email to

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