GNU bug report logs - #11378
24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible'

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Sun, 29 Apr 2012 06:11:02 UTC

Severity: minor

Merged with 18017

Found in versions 24.1.50, 24.4.50

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11378 <at> debbugs.gnu.org
Subject: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible'
Date: Wed, 29 May 2013 00:47:29 +0300
> I'll submit a new patch soon that adds a new variable
> `isearch-search-invisible' (or maybe just `isearch-invisible')
> to toggle its value without changing the value of the user option
> `search-invisible'.

Here is a patch that adds `isearch-toggle-invisible' that
toggles `isearch-invisible' between nil and a non-nil default value
of `search-invisible', i.e.

if search-invisible is `open' then toggles isearch-invisible
between `open' and `nil'

if search-invisible is `t' then toggles isearch-invisible
between `t' and `nil'

if search-invisible is `nil' then toggles isearch-invisible
between `nil' and `open'

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-05-27 22:42:11 +0000
+++ lisp/isearch.el	2013-05-28 21:41:15 +0000
@@ -514,6 +514,7 @@ (defvar isearch-mode-map
     (define-key map "\M-e" 'isearch-edit-string)
 
     (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-sw" 'isearch-toggle-word)
     (define-key map "\M-s_" 'isearch-toggle-symbol)
@@ -602,6 +607,11 @@ (defvar isearch-start-hscroll 0)	; hscro
 ;;   case in the search string is ignored.
 (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 'open)
+
 (defvar isearch-last-case-fold-search nil)
 
 ;; Used to save default value while isearch is active
@@ -700,6 +711,7 @@ (defun isearch-forward (&optional regexp
  nonincremental search.
 
 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-word] to toggle word mode.
 Type \\[isearch-toggle-symbol] to toggle symbol mode.
@@ -836,6 +867,7 @@ (defun isearch-mode (forward &optional r
 	isearch-op-fun op-fun
 	isearch-last-case-fold-search isearch-case-fold-search
 	isearch-case-fold-search case-fold-search
+	isearch-invisible search-invisible
 	isearch-string ""
 	isearch-message ""
 	isearch-cmds nil
@@ -1487,6 +1527,23 @@ (defun isearch-toggle-case-fold ()
   (sit-for 1)
   (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 default value of `search-invisible' (or `open'
+if `search-invisible' is nil by default)."
+  (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
 
@@ -1622,6 +1679,7 @@ (defun isearch-query-replace (&optional
 	;; set `search-upper-case' to nil to not call
 	;; `isearch-no-upper-case-p' in `perform-replace'
 	(search-upper-case nil)
+	(search-invisible isearch-invisible)
 	(replace-lax-whitespace
 	 isearch-lax-whitespace)
 	(replace-regexp-lax-whitespace
@@ -2634,9 +2739,10 @@ (defun isearch-search ()
       (setq isearch-case-fold-search
 	    (isearch-no-upper-case-p isearch-string isearch-regexp)))
   (condition-case lossage
-      (let ((inhibit-point-motion-hooks search-invisible)
+      (let ((inhibit-point-motion-hooks isearch-invisible)
 	    (inhibit-quit nil)
 	    (case-fold-search isearch-case-fold-search)
+	    (search-invisible isearch-invisible)
 	    (retry t))
 	(setq isearch-error nil)
 	(while retry





This bug report was last modified 3 years and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.