[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Displaying the state of isearch toggles [was Re: ASCII-folded search]
From: |
Artur Malabarba |
Subject: |
Displaying the state of isearch toggles [was Re: ASCII-folded search] |
Date: |
Sun, 28 Jun 2015 11:47:22 +0100 |
2015-06-27 23:48 GMT+01:00 Juri Linkov <address@hidden>:
> 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
- Displaying the state of isearch toggles [was Re: ASCII-folded search],
Artur Malabarba <=
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Eli Zaretskii, 2015/06/28
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Kaushal, 2015/06/28
- RE: Displaying the state of isearch toggles [was Re: ASCII-folded search], Drew Adams, 2015/06/28
- RE: Displaying the state of isearch toggles [was Re: ASCII-folded search], Drew Adams, 2015/06/28
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Juri Linkov, 2015/06/29
- RE: Displaying the state of isearch toggles [was Re: ASCII-folded search], Drew Adams, 2015/06/29
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Eli Zaretskii, 2015/06/30
- RE: Displaying the state of isearch toggles [was Re: ASCII-folded search], Drew Adams, 2015/06/30
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Eli Zaretskii, 2015/06/30
- Re: Displaying the state of isearch toggles [was Re: ASCII-folded search], Eli Zaretskii, 2015/06/29