[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying the state of isearch toggles [was Re: ASCII-folded search

From: Oleh Krehel
Subject: Re: Displaying the state of isearch toggles [was Re: ASCII-folded search]
Date: Tue, 30 Jun 2015 09:53:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> Do we want to go down this path?
> Maybe we do.  Are there good alternatives, when there are so many
> non-orthogonal options?

I have a good alternative for swiper.el (my isearch-replacement package
in GELPA).

Unlike the current isearch, which recently started displaying
"Char-fold I-search: " instead of the much better default "I-search: ",
swiper displays only "97 pattern: ", where "97" is the current number
of matches.

To see more options, I can press "C-o" to bring up a hydra - a keyboard
oriented menu, which is also a package of mine in GELPA. Pressing "C-o"
again hides this information.

I attach 3 screenshots.
First one: I only press "C-s" (`swiper') to get a minimal interface.
Second one: I press "C-o" to show me the options panel, which also
doubles as a command-mode:

- "C-n" becomes "j"
- "C-p" becomes "k"
- "M-<" becomes "h"
- "M->" becomes "l"

It's possible to toggle the matching function with "m", and the state
will be re-displayed to let the user know that the matcher has changed.
It's possible to re-size the minibuffer with "<" and ">".

Third one: I've re-sized the minibuffer to become smaller with "<<" and
changed the matcher to fuzzy with "m" (notice the number of candidates
grew from 97 to 543).

I could now dismiss the menu with "i" or "C-o" and go back to a minimal
interface, with the changes that I made.

Attachment: swiper-example-1.png
Description: PNG image

Attachment: swiper-example-2.png
Description: PNG image

Attachment: swiper-example-3.png
Description: PNG image

I'd like to also emphasize that the whole menu string is displayed with
the `lv-message' function, which mirrors `message', except it uses an
equivalent of the Echo Area above the actual Echo Area.  This removes
the drawback of the 2-second delay whenever new messages need to be
displayed in the minibuffer, and also it doesn't get overwritten by
other messages.

Hydra has a pretty easy interface, similar to `easy-menu-define', to
define this menu (here ^ are just alignment chars):

(defhydra hydra-ivy (:hint nil
                     :color pink)
^^^^^^          ^Yes^     ^No^     ^Maybe^
^ ^ _k_ ^ ^     _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" 
_h_ ^+^ _l_     _d_one    _o_ops   _m_: matcher %s(if (eq ivy--regex-function 
'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
^ ^ _j_ ^ ^     ^ ^       ^ ^      _<_/_>_: shrink/grow window
  ;; arrows
  ("h" ivy-beginning-of-buffer)
  ("j" ivy-next-line)
  ("k" ivy-previous-line)
  ("l" ivy-end-of-buffer)
  ;; actions
  ("o" keyboard-escape-quit :exit t)
  ("C-g" keyboard-escape-quit :exit t)
  ("i" nil)
  ("C-o" nil)
  ("f" ivy-alt-done :exit nil)
  ("C-j" ivy-alt-done :exit nil)
  ("d" ivy-done :exit t)
  ("C-m" ivy-done :exit t)
  ("c" ivy-toggle-calling)
  ("m" ivy-toggle-fuzzy)
  (">" ivy-minibuffer-grow)
  ("<" ivy-minibuffer-shrink))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]