Oleh Krehel [Fri, 27 Mar 2015 18:50:05 +0000 (19:50 +0100)]
swiper.el (swiper-map): Bind "C-l" to recenter
* swiper.el (swiper-map): Update.
(swiper-recenter-top-bottom): New defun.
(swiper--update-input-ivy): Use `<=' in order for `recenter-top-bottom'
to work.
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.
Oleh Krehel [Mon, 23 Mar 2015 17:29:49 +0000 (18:29 +0100)]
Fix blue/red heads with same cmd
* hydra.el (hydra--make-defun): Update.
(hydra--head-name): Change signature, since body is needed to determine
the color. When the head will exit, add "-and-exit" to its name (except
for the nil head and body).
(defhydra): Update the call to `hydra--head-name', since it's not valid
until the head has a hint.
João Távora [Mon, 23 Mar 2015 10:10:56 +0000 (10:10 +0000)]
Add useful development assertion
When debugging snippets after M-x toggle-debug-on-error, errors in the
`post-command-hook' might cause `yas--post-command-handler' to be
removed. That's OK, always check that it's there before attempting any
`yas-expand-snippet' calls, since it is essential to check snippet
movement.
* yasnippet.el (yas-expand-snippet): Assert `yas-minor-mode' and
`yas--post-command-handler' active.
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.
Stefan Monnier [Fri, 20 Mar 2015 10:34:33 +0000 (10:34 +0000)]
Getting rid of low-level assumptions in yasnippet
The main thrust is to get rid of the use of the `cl-struct-slots'
property which doesn't exist in Emacs-25 any more.
* yasnippet.el: Update copyright
(yas--template): Change constructor name from
`yas--make-blank-template' to `yas--make-template'
(yas--populate-template): Remove.
(yas--define-snippets-1): Use `yas--make-template'
(yas--define-snippets-1): Use `setf's
(yas-define-menu, yas--define-menu-1, yas-tryout-snippet): Use
`yas--make-template'
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.