unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Displaying the state of isearch toggles [was Re: ASCII-folded search]
@ 2015-06-28 10:47 Artur Malabarba
  2015-06-28 14:37 ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Artur Malabarba @ 2015-06-28 10:47 UTC (permalink / raw)
  To: Juri Linkov
  Cc: Eli Zaretskii, emacs-devel, Stephen J. Turnbull, Stefan Monnier,
	Kaushal

2015-06-27 23:48 GMT+01:00 Juri Linkov <juri@linkov.net>:
> Whether to display verbose indicators (like currently are used, e.g.
> “Regexp I-search”) or 1-letter cryptic ones (e.g. “I-search(r/c/')”
> like in C-mode with its indicators such as “C/lahw”) is a matter of taste
> and could be customizable.

Here's a suggestion on how verbose toggles could be done, following
Kaushal's previous mention of multi-line echo areas.
It shows the state of all toggles on a line above the prompt. This is
given the usual `minibuffer-prompt' face and it stays fixed while the
user is typing/searching, so it's not a distraction.

-------- the usual modeline here ---------
case-fold: ON   regexp: OFF  word: ON   symbol: OFF  lax-space: ON
char-fold: OFF  invisible: ON
Isearch:

We can discuss which toggles to display by default, of course, this is
just an example.

---
 lisp/isearch.el | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 45c6d97..b0f4321 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2521,6 +2521,26 @@ If there is no completion possible, say so and
continue searching."
          (isearch-message-suffix c-q-hack)))
     (if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))

+(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."
+  (concat
+   (mapconcat (lambda (x) (propertize (concat (car x) ": " (if (cadr
x) "ON " "OFF"))
+                                 'face 'minibuffer-prompt))
+              `(("case-fold" ,isearch-case-fold-search)
+                ("regexp"    ,isearch-regexp)
+                ("word"      ,(eq isearch-word t))
+                ("symbol"    ,(eq isearch-word #'isearch-symbol-regexp))
+                ("lax-space" ,isearch-lax-whitespace)
+                ("char-fold" ,(eq isearch-word #'character-fold-to-regexp))
+                ("invisible" ,isearch-invisible))
+              "  ")
+   "\n"))
+
 (defun isearch-message-prefix (&optional ellipsis nonincremental)
   ;; If about to search, and previous search regexp was invalid,
   ;; check that it still is.  If it is valid now,
@@ -2569,8 +2589,9 @@ If there is no completion possible, say so and
continue searching."
             (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.4.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-06-30 17:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <<CAAdUY-K3x4i+7wFvbEstvKVKuSZyM-DL4wB+Pe7ZbsHcVYXOfw@mail.gmail.com>
     [not found] ` <<831tgv7vbr.fsf@gnu.org>
2015-06-28 17:02   ` Displaying the state of isearch toggles [was Re: ASCII-folded search] Drew Adams
2015-06-28 17:29     ` Drew Adams
2015-06-29 22:03     ` Juri Linkov
2015-06-29 22:26       ` Drew Adams
2015-06-30 15:03         ` Eli Zaretskii
2015-06-30  2:43       ` Eli Zaretskii
2015-06-30  7:53         ` Oleh Krehel
     [not found]   ` <<ddcd0bf6-a60e-406b-a79d-088c13c2ac61@default>
     [not found]     ` <<87h9pq18ae.fsf@mail.linkov.net>
     [not found]       ` <<83a8vh5316.fsf@gnu.org>
2015-06-30  4:39         ` Drew Adams
2015-06-30  6:25           ` Artur Malabarba
2015-06-30 14:04             ` Drew Adams
2015-06-30 14:41               ` Artur Malabarba
2015-06-30 15:06           ` Eli Zaretskii
     [not found]         ` <<9da72b40-0236-4edd-983e-90c54ca7f827@default>
     [not found]           ` <<83616544o3.fsf@gnu.org>
2015-06-30 17:17             ` Drew Adams
     [not found]       ` <<d9b5bdf0-9a8f-48b8-b24f-1b7ead67220f@default>
     [not found]         ` <<837fql44s9.fsf@gnu.org>
2015-06-30 17:14           ` Drew Adams
2015-06-30 17:22             ` Eli Zaretskii
2015-06-28 10:47 Artur Malabarba
2015-06-28 14:37 ` Eli Zaretskii
2015-06-28 15:08   ` Kaushal

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).