Commit 01dea85f authored by Juri Linkov's avatar Juri Linkov
Browse files

* lisp/isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible' to "\M-si".

(isearch-invisible): New variable.
(isearch-forward): Doc fix.
(isearch-mode): Set `isearch-invisible'
to the value of `search-invisible'.
(isearch-toggle-case-fold): Doc fix.
(isearch-toggle-invisible): New command.
(isearch-query-replace): Let-bind `search-invisible'
to the value of `isearch-invisible'.
(isearch-search): Use `isearch-invisible' instead of
`search-invisible'.  Let-bind `search-invisible'
to the value of `isearch-invisible'.

Fixes: debbugs:11378
parent 8accd027
...@@ -241,6 +241,9 @@ entries displayed by `Info-index-next', `Info-virtual-index' and ...@@ -241,6 +241,9 @@ entries displayed by `Info-index-next', `Info-virtual-index' and
*** `C-x 8 RET' in Isearch mode reads a character by its Unicode name *** `C-x 8 RET' in Isearch mode reads a character by its Unicode name
and adds it to the search string. and adds it to the search string.
*** `M-s i' toggles the variable `isearch-invisible' between nil and
the value of the option `search-invisible' (or `open' when it's nil).
*** `query-replace' skips invisible text when `search-invisible' is nil, *** `query-replace' skips invisible text when `search-invisible' is nil,
and opens overlays with hidden text when `search-invisible' is `open'. and opens overlays with hidden text when `search-invisible' is `open'.
......
2013-05-30 Juri Linkov <juri@jurta.org>
* isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible'
to "\M-si".
(isearch-invisible): New variable.
(isearch-forward): Doc fix.
(isearch-mode): Set `isearch-invisible'
to the value of `search-invisible'.
(isearch-toggle-case-fold): Doc fix.
(isearch-toggle-invisible): New command.
(isearch-query-replace): Let-bind `search-invisible'
to the value of `isearch-invisible'.
(isearch-search): Use `isearch-invisible' instead of
`search-invisible'. Let-bind `search-invisible'
to the value of `isearch-invisible'. (Bug#11378)
2013-05-30 Juri Linkov <juri@jurta.org> 2013-05-30 Juri Linkov <juri@jurta.org>
   
* replace.el (perform-replace): Avoid `isearch-range-invisible' * replace.el (perform-replace): Avoid `isearch-range-invisible'
......
...@@ -514,6 +514,7 @@ This is like `describe-bindings', but displays only Isearch keys." ...@@ -514,6 +514,7 @@ This is like `describe-bindings', but displays only Isearch keys."
(define-key map "\M-e" 'isearch-edit-string) (define-key map "\M-e" 'isearch-edit-string)
(define-key map "\M-sc" 'isearch-toggle-case-fold) (define-key map "\M-sc" 'isearch-toggle-case-fold)
(define-key map "\M-si" 'isearch-toggle-invisible)
(define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sr" 'isearch-toggle-regexp)
(define-key map "\M-sw" 'isearch-toggle-word) (define-key map "\M-sw" 'isearch-toggle-word)
(define-key map "\M-s_" 'isearch-toggle-symbol) (define-key map "\M-s_" 'isearch-toggle-symbol)
...@@ -602,6 +603,11 @@ Each set is a vector of the form: ...@@ -602,6 +603,11 @@ Each set is a vector of the form:
;; case in the search string is ignored. ;; case in the search string is ignored.
(defvar isearch-case-fold-search nil) (defvar isearch-case-fold-search nil)
;; search-invisible while searching.
;; either nil, t, or 'open. 'open means the same as t except that
;; opens hidden overlays.
(defvar isearch-invisible search-invisible)
(defvar isearch-last-case-fold-search nil) (defvar isearch-last-case-fold-search nil)
;; Used to save default value while isearch is active ;; Used to save default value while isearch is active
...@@ -700,6 +706,7 @@ If you try to exit with the search string still empty, it invokes ...@@ -700,6 +706,7 @@ If you try to exit with the search string still empty, it invokes
nonincremental search. nonincremental search.
Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
Type \\[isearch-toggle-invisible] to toggle search in invisible text.
Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-word] to toggle word mode.
Type \\[isearch-toggle-symbol] to toggle symbol mode. Type \\[isearch-toggle-symbol] to toggle symbol mode.
...@@ -836,6 +843,7 @@ convert the search string to a regexp used by regexp search functions." ...@@ -836,6 +843,7 @@ convert the search string to a regexp used by regexp search functions."
isearch-op-fun op-fun isearch-op-fun op-fun
isearch-last-case-fold-search isearch-case-fold-search isearch-last-case-fold-search isearch-case-fold-search
isearch-case-fold-search case-fold-search isearch-case-fold-search case-fold-search
isearch-invisible search-invisible
isearch-string "" isearch-string ""
isearch-message "" isearch-message ""
isearch-cmds nil isearch-cmds nil
...@@ -1474,7 +1482,8 @@ value of the variable `isearch-regexp-lax-whitespace'." ...@@ -1474,7 +1482,8 @@ value of the variable `isearch-regexp-lax-whitespace'."
(isearch-update)) (isearch-update))
(defun isearch-toggle-case-fold () (defun isearch-toggle-case-fold ()
"Toggle case folding in searching on or off." "Toggle case folding in searching on or off.
Toggles the value of the variable `isearch-case-fold-search'."
(interactive) (interactive)
(setq isearch-case-fold-search (setq isearch-case-fold-search
(if isearch-case-fold-search nil 'yes)) (if isearch-case-fold-search nil 'yes))
...@@ -1487,6 +1496,23 @@ value of the variable `isearch-regexp-lax-whitespace'." ...@@ -1487,6 +1496,23 @@ value of the variable `isearch-regexp-lax-whitespace'."
(sit-for 1) (sit-for 1)
(isearch-update)) (isearch-update))
(defun isearch-toggle-invisible ()
"Toggle searching in invisible text on or off.
Toggles the variable `isearch-invisible' between values
nil and a non-nil value of the option `search-invisible'
\(or `open' if `search-invisible' is nil)."
(interactive)
(setq isearch-invisible
(if isearch-invisible nil (or search-invisible 'open)))
(let ((message-log-max nil))
(message "%s%s [match %svisible text]"
(isearch-message-prefix nil isearch-nonincremental)
isearch-message
(if isearch-invisible "in" "")))
(setq isearch-success t isearch-adjusted t)
(sit-for 1)
(isearch-update))
;; Word search ;; Word search
...@@ -1622,6 +1648,7 @@ way to run word replacements from Isearch is `M-s w ... M-%'." ...@@ -1622,6 +1648,7 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
;; set `search-upper-case' to nil to not call ;; set `search-upper-case' to nil to not call
;; `isearch-no-upper-case-p' in `perform-replace' ;; `isearch-no-upper-case-p' in `perform-replace'
(search-upper-case nil) (search-upper-case nil)
(search-invisible isearch-invisible)
(replace-lax-whitespace (replace-lax-whitespace
isearch-lax-whitespace) isearch-lax-whitespace)
(replace-regexp-lax-whitespace (replace-regexp-lax-whitespace
...@@ -2638,9 +2665,10 @@ update the match data, and return point." ...@@ -2638,9 +2665,10 @@ update the match data, and return point."
(setq isearch-case-fold-search (setq isearch-case-fold-search
(isearch-no-upper-case-p isearch-string isearch-regexp))) (isearch-no-upper-case-p isearch-string isearch-regexp)))
(condition-case lossage (condition-case lossage
(let ((inhibit-point-motion-hooks search-invisible) (let ((inhibit-point-motion-hooks isearch-invisible)
(inhibit-quit nil) (inhibit-quit nil)
(case-fold-search isearch-case-fold-search) (case-fold-search isearch-case-fold-search)
(search-invisible isearch-invisible)
(retry t)) (retry t))
(setq isearch-error nil) (setq isearch-error nil)
(while retry (while retry
...@@ -2836,7 +2864,7 @@ determined by `isearch-range-invisible' unless invisible text can be ...@@ -2836,7 +2864,7 @@ determined by `isearch-range-invisible' unless invisible text can be
searched too when `search-invisible' is t." searched too when `search-invisible' is t."
(or (eq search-invisible t) (or (eq search-invisible t)
(not (isearch-range-invisible beg end)))) (not (isearch-range-invisible beg end))))
(make-obsolete 'isearch-filter-visible 'search-invisible "24.4") (make-obsolete 'isearch-filter-visible 'isearch-invisible "24.4")
;; General utilities ;; General utilities
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment