Oleh Krehel [Wed, 25 Mar 2015 18:36:47 +0000 (19:36 +0100)]
Allow to cancel "M-q" with "C-g"
swiper.el (swiper-query-replace): If the TO argument to
`perform-replace' isn't read, don't exit minibuffer.
If the user called `swiper-query-replace' and isn't happy with the
current input being the FROM arg of `perform-replace', it's possible to
cancel with "C-g", and edit the input once again.
Oleh Krehel [Wed, 25 Mar 2015 11:53:51 +0000 (12:53 +0100)]
Add swiper-query-replace
* ivy.el (ivy-read): Update signature - a keymap is also accepted and
the argument order has changed.
The keymap is composed with `ivy-minibuffer-map'.
Update for `ivy--action'.
(ivy--action): New defvar. If a function sets it, `ivy-read' will call it.
* swiper.el (swiper-map): New defvar.
(swiper-query-replace): New defun.
(swiper--ivy): Use swiper-map in the call to `ivy-read'.
* counsel.el (couns-git): Fix one empty candidate.
Oleh Krehel [Mon, 23 Mar 2015 20:20:03 +0000 (21:20 +0100)]
Ensure that inserted candidates don't have read-only property
* ivy.el (ivy-completions): Update.
Fixes #28.
The issue was that the whole text of erc buffer has (read-only t)
property. That means if I copy some of those strings and insert them
into the minibuffer, I can't delete them unless I set
`inhibit-read-only' to t. Instead, I set the read-only to nil for the
string that I insert. It doesn't affect the original buffer string.
John Mastro [Sat, 21 Mar 2015 22:23:40 +0000 (15:23 -0700)]
ivy.el (ivy-wrap): New defcustom
(ivy-next-line): Wrap around if `ivy-wrap' is non-nil
(ivy-next-line-or-history): Wrap around if `ivy-wrap' is non-nil
(ivy-previous-line): Wrap around if `ivy-wrap' is non-nil
(ivy-previous-line-or-history): Wrap around if `ivy-wrap' is non-nil
Oleh Krehel [Sat, 21 Mar 2015 16:47:50 +0000 (17:47 +0100)]
Update "C-n" and "C-p" bindings
* ivy.el (ivy-next-line): Don't touch history.
(ivy-next-line-or-history): Select previous history element if there's
no input.
(ivy-previous-line): Don't touch history.
(ivy-previous-line-or-history): Select previous history element if
there's no input.
Oleh Krehel [Sat, 21 Mar 2015 15:35:54 +0000 (16:35 +0100)]
Use `font-lock-append-text-property' to non-destructively modify a
string
* ivy.el (ivy--add-face): Improve.
`font-lock-append-text-property' non-destructively changes properties in
a string, which means if a string was copied from another and modified,
the original will not be changed.
In this way, it's better than `add-face-text-property'; and still better
than `propertize' that simply erases all properties before applying.
Oleh Krehel [Fri, 20 Mar 2015 14:27:00 +0000 (15:27 +0100)]
Call :post for :timeout
* hydra.el (hydra--make-defun): When both :timeout and :post are given,
if `hydra-timeout' runs out, it will call :post before
`hydra-keyboard-quit'.
(hydra-timeout): Update to call function if it's given. Always call
`hydra-keyboard-quit' afterwards.
- on "x" or "y", after one of them has started the timer, and the timer
ran out. The timer is set to 2.0 seconds, and is reset each time "x"
or "y" is pressed.
Oleh Krehel [Thu, 19 Mar 2015 18:11:06 +0000 (19:11 +0100)]
ivy.el (ivy-read): Allow for format-style PROMPT
* ivy.el (ivy-read): When given a prompt of e.g. "%d pattern: ", update
the number of candidates in the prompt.
(ivy--prompt): New defvar.
(ivy--insert-prompt): New defun.
(ivy--exhibit): Call `ivy--insert-prompt'.
(ivy-completions): Fix a bug of `ivy--index' becoming -1 when the number
of matches becomes zero.
* swiper.el (swiper--format-spec): New defvar.
(swiper--candidates): Update.
(swiper--ivy): Use `swiper--format-spec' to make the prompt.
Oleh Krehel [Thu, 19 Mar 2015 17:44:36 +0000 (18:44 +0100)]
ivy.el (ivy-read): Change index to preselect
* ivy.el (ivy-read): Update signature. Instead of giving the integer
index of what to preselect, give a string to preselect.
(ivy--preselect-index): New defun.
* swiper.el (swiper--index-at-point): Rename to `ivy--preselect-index'.
(swiper--ivy): Simplify.
Oleh Krehel [Wed, 18 Mar 2015 18:04:15 +0000 (19:04 +0100)]
Add isearch-like history behavior
* ivy.el (ivy-next-line): Select previous history element for empty
input.
(ivy-previous-line): Select previous history element for empty input.
(ivy-previous-history-element): New defun.
(ivy-next-history-element): New defun.