From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Exposing Isearch toggleable options Date: Thu, 29 Oct 2015 00:20:41 +0000 Message-ID: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01228934fc773f05233347d7 X-Trace: ger.gmane.org 1446078053 14630 80.91.229.3 (29 Oct 2015 00:20:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2015 00:20:53 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 29 01:20:52 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZraxX-00075n-JY for ged-emacs-devel@m.gmane.org; Thu, 29 Oct 2015 01:20:51 +0100 Original-Received: from localhost ([::1]:41256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZraxX-000650-HM for ged-emacs-devel@m.gmane.org; Wed, 28 Oct 2015 20:20:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZraxR-00064t-6D for emacs-devel@gnu.org; Wed, 28 Oct 2015 20:20:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZraxO-0004G0-WE for emacs-devel@gnu.org; Wed, 28 Oct 2015 20:20:45 -0400 Original-Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]:33084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZraxO-0004Fv-FJ for emacs-devel@gnu.org; Wed, 28 Oct 2015 20:20:42 -0400 Original-Received: by lbbec13 with SMTP id ec13so17750885lbb.0 for ; Wed, 28 Oct 2015 17:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to :content-type; bh=6EOhXbhC93P5ffzjLbnac+6x6ijYG0z+yzE8aDdIbH4=; b=dlM4/a8F6NXhXAbY6cKoSMn86A/alkvdc6bFQ7QOFDrpTOx71YhFr1pjChSi4vS7UY Uyw6egI2Vs0+ZlQ/LKkyRlVNVfIANVBZ/K9zujb+kj7J74B+TXSXGxDY58ZDJKTtWowr 7TCeri2oxQtcIYKpDcQvnzdAD8sNyOd7NId+MZVBsnSvrIPEZfAlAqlsHz8c29+K/3P3 Qs93VtTodop2oxB/viLAasI5WUaQ2IIORgTjMe+GmJD+ARcz7zWQ+zCFd+XzNjv5i6di RsWwKD1e87B9icVdunfEPFkkAG9wbosg2l0ywUmQbA+VbLtDfDLmGRU3BZ6JKR04Hg9k p9wQ== X-Received: by 10.112.135.233 with SMTP id pv9mr24839257lbb.42.1446078041583; Wed, 28 Oct 2015 17:20:41 -0700 (PDT) Original-Received: by 10.112.91.106 with HTTP; Wed, 28 Oct 2015 17:20:41 -0700 (PDT) X-Google-Sender-Auth: jYfqbjdvpgTMeJ6UW6YZMHKmRpw X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:192839 Archived-At: --089e01228934fc773f05233347d7 Content-Type: text/plain; charset=UTF-8 I just pushed a branch called scratch/isearch-show-toggles, which implements a way of exposing some of isearch options to the user. Basically, as soon as isearch starts, you should see something like this. Toggles [M-s]: [w] Word OFF [_] Symbol OFF ['] Character-Fold ON [r] Regexp OFF I-search: search string here If your window is wide enough, you'll also see toggles for Lax-Whitespace, Case-Fold, and Invisibe (it auto-ajusts the number of toggles displayed so as to not take more than one line). I'm not yet sure if this is worth merging to master, so I'd very much appreciate opinions. Here's the (two-commit) patch for those who prefer: >From 1ddd546be001116024dbbb0afe74d137ff8c679f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 29 Oct 2015 00:28:14 +0000 Subject: [PATCH 1/2] * lisp/isearch.el (isearch-define-mode-toggle): Add keyword args (isearch--toggles): New variable. --- lisp/isearch.el | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index e9eec01..6ec5c7f 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1488,20 +1488,31 @@ isearch-repeat-backward ;;; Toggles for `isearch-regexp-function' and `search-default-regexp-mode'. -(defmacro isearch-define-mode-toggle (mode key function &optional docstring &rest body) +(defvar isearch--toggles nil + "List of toggles defined with `isearch-define-mode-toggle'. +Each element is a list of (NAME KEY PRED-FORM).") + +(cl-defmacro isearch-define-mode-toggle (mode key &rest body &key function + doc pred-form &allow-other-keys) "Define a command called `isearch-toggle-MODE' and bind it to `M-s KEY'. The first line of the docstring is auto-generated, the remainder -may be provided in DOCSTRING. +may be provided in DOC. If FUNCTION is a symbol, this command first toggles the value of `isearch-regexp-function' between nil and FUNCTION. Also set the `isearch-message-prefix' property of FUNCTION. -The command then executes BODY and updates the isearch prompt." +The command then executes BODY and updates the isearch prompt. + +PRED-FORM, when evaluated should return non-nil if the mode is +active. It is mandatory only if FUNCTION is not provided." (declare (indent defun)) - (let ((command-name (intern (format "isearch-toggle-%s" mode)))) + (let ((command-name (intern (format "isearch-toggle-%s" mode))) + (pred-form (or pred-form `(eq isearch-regexp-function #',function)))) + (while (keywordp (car body)) + (setq body (cdr (cdr body)))) `(progn (defun ,command-name () ,(format "Toggle %s searching on or off.%s" mode - (if docstring (concat "\n" docstring) "")) + (if doc (concat "\n" doc) "")) (interactive) ,@(when function `((setq isearch-regexp-function @@ -1512,6 +1523,7 @@ isearch-define-mode-toggle (setq isearch-success t isearch-adjusted t) (isearch-update)) (define-key isearch-mode-map ,(concat "\M-s" key) #',command-name) + (setf (alist-get ',mode isearch--toggles) '(,key (lambda () ,pred-form))) ,@(when (symbolp function) `((put ',function 'isearch-message-prefix ,(format "%s " mode)) (cl-callf (lambda (types) (cons 'choice @@ -1519,12 +1531,12 @@ isearch-define-mode-toggle (cdr types)))) (get 'search-default-regexp-mode 'custom-type))))))) -(isearch-define-mode-toggle word "w" word-search-regexp) -(isearch-define-mode-toggle symbol "_" isearch-symbol-regexp) -(isearch-define-mode-toggle character-fold "'" character-fold-to-regexp) +(isearch-define-mode-toggle word "w" :function word-search-regexp) +(isearch-define-mode-toggle symbol "_" :function isearch-symbol-regexp) +(isearch-define-mode-toggle character-fold "'" :function character-fold-to-regexp) (put 'character-fold-to-regexp 'isearch-message-prefix "char-fold ") -(isearch-define-mode-toggle regexp "r" nil nil +(isearch-define-mode-toggle regexp "r" :pred-form isearch-regexp (setq isearch-regexp (not isearch-regexp)) (if isearch-regexp (setq isearch-regexp-function nil))) @@ -1537,8 +1549,9 @@ isearch--momentary-message string)) (sit-for 1)) -(isearch-define-mode-toggle lax-whitespace " " nil - "In ordinary search, toggles the value of the variable +(isearch-define-mode-toggle lax-whitespace " " + :pred-form (if isearch-regexp isearch-regexp-lax-whitespace isearch-lax-whitespace) + :doc "In ordinary search, toggles the value of the variable `isearch-lax-whitespace'. In regexp search, toggles the value of the variable `isearch-regexp-lax-whitespace'." (isearch--momentary-message @@ -1548,20 +1561,21 @@ isearch--momentary-message "match spaces loosely" "match spaces literally"))) -(isearch-define-mode-toggle case-fold "c" nil - "Toggles the value of the variable `isearch-case-fold-search'." +(isearch-define-mode-toggle case-fold "c" + :pred-form isearch-case-fold-search + :doc "Toggles the value of the variable `isearch-case-fold-search'." (isearch--momentary-message (if (setq isearch-case-fold-search (if isearch-case-fold-search nil 'yes)) "case insensitive" "case sensitive"))) -(isearch-define-mode-toggle invisible "i" nil - "This determines whether to search inside invisible text or not. +(isearch-define-mode-toggle invisible "i" + :pred-form isearch-invisible + :doc "This determines whether to search inside invisible text or not. 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)." - "match %svisible text" (isearch--momentary-message (if (setq isearch-invisible (if isearch-invisible -- 2.5.3 >From 37d169df4433be1869eac9c916e548b9bd66ff04 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 29 Oct 2015 00:51:21 +0000 Subject: [PATCH 2/2] * lisp/isearch.el: Display toggles and their keys (isearch--describe-toggles): New function. (isearch-show-toggles): New user option. (isearch-message-prefix): Use them. --- lisp/isearch.el | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 6ec5c7f..6327068 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1583,6 +1583,30 @@ isearch--momentary-message "match invisible text" "match visible text"))) +(defcustom isearch-show-toggles t + "Non-nil means to list options above input prompt." + :type 'boolean + :version "25.1") + +(defun isearch--describe-toggles () + "Return a propertized description of isearch toggles." + (let ((toggles + (concat + #("Toggles [M-s]: " 0 9 (face minibuffer-prompt) 12 16 (face minibuffer-prompt)) + (mapconcat (lambda (x) (format (propertize "[%s] %s %s" 'face 'minibuffer-prompt) + (propertize (elt x 1) 'face 'default) + (capitalize (symbol-name (car x))) + (if (funcall (elt x 2)) + (propertize "ON " 'face 'default) "OFF"))) + (reverse isearch--toggles) + " ") + "\n")) + (width (window-width (minibuffer-window)))) + (if (> width (string-width toggles)) + toggles + (replace-regexp-in-string "\\[[^[]*\\'" "\n" + (substring toggles 0 width))))) + ;; Word search @@ -2592,8 +2616,9 @@ isearch-message-prefix (concat " [" current-input-method-title "]: ")) ": ") ))) - (propertize (concat (upcase (substring m 0 1)) (substring m 1)) - 'face 'minibuffer-prompt))) + (concat (when isearch-show-toggles (isearch--describe-toggles)) + (propertize (concat (upcase (substring m 0 1)) (substring m 1)) + 'face 'minibuffer-prompt)))) (defun isearch-message-suffix (&optional c-q-hack) (concat (if c-q-hack "^Q" "") -- 2.5.3 --089e01228934fc773f05233347d7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I just pushed a branch called scratch/isearch-show-to= ggles, which implements a way of exposing some of isearch options to the us= er.

Basically, as soon as isearch starts, you should see somet= hing like this.

Toggles [M-s]:=C2=A0 [w] Word OFF=C2=A0 [_] Sym= bol OFF=C2=A0 ['] Character-Fold ON=C2=A0=C2=A0 [r] Regexp OFF
I-sea= rch: search string here

If your window is wide enough, yo= u'll also see toggles for Lax-Whitespace, Case-Fold, and Invisibe (it = auto-ajusts the number of toggles displayed so as to not take more than one= line).

I'm not yet sure if this is worth merging to master, so = I'd very much appreciate opinions.

Here's the (tw= o-commit) patch for those who prefer:

From 1ddd546be001116024dbbb0af= e74d137ff8c679f Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am@gmail.com>Date: Thu, 29 Oct 2015 00:28:14 +0000
Subject: [PATCH 1/2] * lisp/isea= rch.el (isearch-define-mode-toggle): Add
=C2=A0keyword args

(isea= rch--toggles): New variable.
---
=C2=A0lisp/isearch.el | 46 +++++++++= +++++++++++++++++++++----------------
=C2=A01 file changed, 30 insertion= s(+), 16 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el=
index e9eec01..6ec5c7f 100644
--- a/lisp/isearch.el
+++ b/lisp/is= earch.el
@@ -1488,20 +1488,31 @@ isearch-repeat-backward
=C2=A0
= =C2=A0=0C
=C2=A0;;; Toggles for `isearch-regexp-function' and `searc= h-default-regexp-mode'.
-(defmacro isearch-define-mode-toggle (mode = key function &optional docstring &rest body)
+(defvar isearch--t= oggles nil
+=C2=A0 "List of toggles defined with `isearch-define-mo= de-toggle'.
+Each element is a list of (NAME KEY PRED-FORM).")<= br>+
+(cl-defmacro isearch-define-mode-toggle (mode key &rest body &= amp;key function
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 doc pred= -form &allow-other-keys)
=C2=A0=C2=A0 "Define a command called = `isearch-toggle-MODE' and bind it to `M-s KEY'.
=C2=A0The first = line of the docstring is auto-generated, the remainder
-may be provided = in DOCSTRING.
+may be provided in DOC.
=C2=A0If FUNCTION is a symbol,= this command first toggles the value of
=C2=A0`isearch-regexp-function&= #39; between nil and FUNCTION.=C2=A0 Also set the
=C2=A0`isearch-message= -prefix' property of FUNCTION.
-The command then executes BODY and u= pdates the isearch prompt."
+The command then executes BODY and upd= ates the isearch prompt.
+
+PRED-FORM, when evaluated should return n= on-nil if the mode is
+active.=C2=A0 It is mandatory only if FUNCTION is= not provided."
=C2=A0=C2=A0 (declare (indent defun))
-=C2=A0 (l= et ((command-name (intern (format "isearch-toggle-%s" mode))))+=C2=A0 (let ((command-name (intern (format "isearch-toggle-%s" = mode)))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (pred-form (or pred-= form `(eq isearch-regexp-function #',function))))
+=C2=A0=C2=A0=C2= =A0 (while (keywordp (car body))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq b= ody (cdr (cdr body))))
=C2=A0=C2=A0=C2=A0=C2=A0 `(progn
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (defun ,command-name ()
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,(format "Toggle %s searching = on or off.%s" mode
-=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if docstring (co= ncat "\n" docstring) ""))
+=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (if doc (concat "\n" doc) ""))
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (interactive)
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,@(when function
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `((setq isearc= h-regexp-function
@@ -1512,6 +1523,7 @@ isearch-define-mode-toggle
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq isearch-succes= s t isearch-adjusted t)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (isearch-update))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (def= ine-key isearch-mode-map ,(concat "\M-s" key) #',command-name= )
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setf (alist-get ',mode isea= rch--toggles) '(,key (lambda () ,pred-form)))
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 ,@(when (symbolp function)
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `((put ',function 'is= earch-message-prefix ,(format "%s " mode))
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cl-callf (lam= bda (types) (cons 'choice
@@ -1519,12 +1531,12 @@ isearch-define-mod= e-toggle
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cdr types)= )))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (get 'search-default-regexp-mode &= #39;custom-type)))))))
=C2=A0
-(isearch-define-mode-toggle word "= ;w" word-search-regexp)
-(isearch-define-mode-toggle symbol "_= " isearch-symbol-regexp)
-(isearch-define-mode-toggle character-fol= d "'" character-fold-to-regexp)
+(isearch-define-mode-togg= le word "w"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 :function word-search-regexp)
+(isearch-define-mode-toggle symbol= "_"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :function is= earch-symbol-regexp)
+(isearch-define-mode-toggle character-fold "&= #39;" :function character-fold-to-regexp)
=C2=A0(put 'character= -fold-to-regexp 'isearch-message-prefix "char-fold ")
=C2= =A0
-(isearch-define-mode-toggle regexp "r" nil nil
+(isear= ch-define-mode-toggle regexp "r" :pred-form isearch-regexp
=C2= =A0=C2=A0 (setq isearch-regexp (not isearch-regexp))
=C2=A0=C2=A0 (if is= earch-regexp (setq isearch-regexp-function nil)))
=C2=A0
@@ -1537,8 += 1549,9 @@ isearch--momentary-message
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string))
=C2=A0=C2=A0 (sit= -for 1))
=C2=A0
-(isearch-define-mode-toggle lax-whitespace " &q= uot; nil
-=C2=A0 "In ordinary search, toggles the value of the vari= able
+(isearch-define-mode-toggle lax-whitespace " "
+=C2= =A0 :pred-form (if isearch-regexp isearch-regexp-lax-whitespace isearch-lax= -whitespace)
+=C2=A0 :doc "In ordinary search, toggles the value of= the variable
=C2=A0`isearch-lax-whitespace'.=C2=A0 In regexp search= , toggles the
=C2=A0value of the variable `isearch-regexp-lax-whitespace= '."
=C2=A0=C2=A0 (isearch--momentary-message
@@ -1548,20 +15= 61,21 @@ isearch--momentary-message
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 "match spaces loosely"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &= quot;match spaces literally")))
=C2=A0
-(isearch-define-mode-tog= gle case-fold "c" nil
-=C2=A0 "Toggles the value of the v= ariable `isearch-case-fold-search'."
+(isearch-define-mode-togg= le case-fold "c"
+=C2=A0 :pred-form isearch-case-fold-search+=C2=A0 :doc "Toggles the value of the variable `isearch-case-fold-s= earch'."
=C2=A0=C2=A0 (isearch--momentary-message
=C2=A0=C2= =A0=C2=A0 (if (setq isearch-case-fold-search
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if isearch-case-fold-s= earch nil 'yes))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "ca= se insensitive"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "case sensitive= ")))
=C2=A0
-(isearch-define-mode-toggle invisible "i"= nil
-=C2=A0 "This determines whether to search inside invisible te= xt or not.
+(isearch-define-mode-toggle invisible "i"
+=C2= =A0 :pred-form isearch-invisible
+=C2=A0 :doc "This determines whet= her to search inside invisible text or not.
=C2=A0Toggles the variable `= isearch-invisible' between values
=C2=A0nil and a non-nil value of t= he option `search-invisible'
=C2=A0\(or `open' if `search-invisi= ble' is nil)."
-=C2=A0 "match %svisible text"
=C2= =A0=C2=A0 (isearch--momentary-message
=C2=A0=C2=A0=C2=A0 (if (setq isear= ch-invisible
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (if isearch-invisible
--
2.5.3


From= 37d169df4433be1869eac9c916e548b9bd66ff04 Mon Sep 17 00:00:00 2001
From:= Artur Malabarba <bruce.con= nor.am@gmail.com>
Date: Thu, 29 Oct 2015 00:51:21 +0000
Subjec= t: [PATCH 2/2] * lisp/isearch.el: Display toggles and their keys

(is= earch--describe-toggles): New function.
(isearch-show-toggles): New user= option.
(isearch-message-prefix): Use them.
---
=C2=A0lisp/isearc= h.el | 29 +++++++++++++++++++++++++++--
=C2=A01 file changed, 27 inserti= ons(+), 2 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.e= l
index 6ec5c7f..6327068 100644
--- a/lisp/isearch.el
+++ b/lisp/i= search.el
@@ -1583,6 +1583,30 @@ isearch--momentary-message
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "match invisible text"
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 "match visible text")))
=C2=A0
= +(defcustom isearch-show-toggles t
+=C2=A0 "Non-nil means to list o= ptions above input prompt."
+=C2=A0 :type 'boolean
+=C2=A0 := version "25.1")
+
+(defun isearch--describe-toggles ()
+= =C2=A0 "Return a propertized description of isearch toggles."
= +=C2=A0 (let ((toggles
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (concat
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #("= ;Toggles [M-s]:=C2=A0 " 0 9 (face minibuffer-prompt) 12 16 (face minib= uffer-prompt))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (= mapconcat (lambda (x) (format (propertize "[%s] %s %s" 'face = 'minibuffer-prompt)
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (propertize (elt x 1) 'face 'default)
+=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (capitalize (symbol-nam= e (car x)))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (if (funcall (elt x 2))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (propertize "ON " '= ;face 'default) "OFF")))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (reverse isearch--toggles)
+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 "=C2=A0 ")
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 "\n"))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (width (window-width (minibuffer-window))))
+=C2=A0=C2= =A0=C2=A0 (if (> width (string-width toggles))
+=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 toggles
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (replace-r= egexp-in-string "\\[[^[]*\\'" "\n"
+=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (substring toggles 0 width)))))
+
=C2=A0=0C<= br>=C2=A0;; Word search
=C2=A0
@@ -2592,8 +2616,9 @@ isearch-message-= prefix
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (c= oncat " [" current-input-method-title "]: "))
=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ": &quo= t;)
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 )))
-=C2= =A0=C2=A0=C2=A0 (propertize (concat (upcase (substring m 0 1)) (substring m= 1))
-=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 'face 'minibuffer-pr= ompt)))
+=C2=A0=C2=A0=C2=A0 (concat (when isearch-show-toggles (isearch-= -describe-toggles))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (propertize (concat (upcase (substring m 0 1)) (substring m= 1))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &#= 39;face 'minibuffer-prompt))))
=C2=A0
=C2=A0(defun isearch-messag= e-suffix (&optional c-q-hack)
=C2=A0=C2=A0 (concat (if c-q-hack &quo= t;^Q" "")
--
2.5.3

--089e01228934fc773f05233347d7--