Oleh Krehel [Wed, 20 May 2015 11:05:03 +0000 (13:05 +0200)]
Fixup "C-u C-j" for `ivy-switch-buffer'
ivy.el (ivy-immediate-done): Since action-style call is used now,
`ivy--current' must be set to `ivy-test', since it's `ivy--current' that
will count as completion result.
Oleh Krehel [Wed, 13 May 2015 21:47:12 +0000 (23:47 +0200)]
ivy.el (ivy-partial-or-done): More predictability
* ivy.el (ivy-partial-or-done): Forward to `ivy-alt-done' only if
`ivy-partial' did nothing new, and either previous command was
`ivy-partial-or-done', or there's exactly one matching candidate.
Oleh Krehel [Wed, 13 May 2015 08:08:17 +0000 (10:08 +0200)]
Allow to recenter with "C-l" during counsel-git-grep
* counsel.el (counsel-git-grep-map): New defvar.
(counsel-git-grep-recenter): New command.
(counsel-git-grep-action): New defun.
(counsel-git-grep): Update.
Oleh Krehel [Tue, 12 May 2015 13:24:29 +0000 (15:24 +0200)]
counsel-git-grep now works with ivy-resume
* ivy.el (ivy-state): New field DYNAMIC-COLLECTION.
(ivy-resume): Update.
(ivy-read): New argument DYNAMIC-COLLECTION. When this is non-nil,
ignore collection and matchers etc, and just obtain the filtered
candidates by calling DYNAMIC-COLLECTION each time the input changes.
Oleh Krehel [Tue, 12 May 2015 12:55:18 +0000 (14:55 +0200)]
Introduce :matcher for counsel-git-grep
* ivy.el (ivy-state): Add MATCHER field.
(ivy-resume): Update.
(ivy-read): Add MATCHER argument. To make things faster, MATCHER can
reuse `ivy--old-re', but it's not required. MATCHER is a function that
takes a candidate and returns non-nil if it matches.
* counsel.el (counsel-git-grep): Use :matcher.
(counsel-git-grep-matcher): New defun. Skip the file name and line
number, then match as usual.
Oleh Krehel [Tue, 12 May 2015 09:17:46 +0000 (11:17 +0200)]
Fix the error switching to non-existent buffers
* ivy.el (ivy-read): Use `ivy-add-virtual-buffers'.
(ivy-buffer-list): Remove.
(ivy-add-virtual-buffers): New defun.
(ivy--switch-buffer-action): New defun, consider `ivy--current' being
zero length.
(ivy-switch-buffer): Use `ivy--switch-buffer-action'.
Oleh Krehel [Mon, 11 May 2015 14:02:57 +0000 (16:02 +0200)]
When completing file names, defer to `minibuffer-complete' for "TAB"
* ivy.el (ivy-partial-or-done): Call `minibuffer-complete'. If the
resulting text is a valid directory, move there.
(ivy-read): Setup `minibuffer-completion-table' and
`minibuffer-completion-predicate'. This makes `minibuffer-complete'
work.
Oleh Krehel [Mon, 11 May 2015 10:42:56 +0000 (12:42 +0200)]
Allow to customize the minibuffer formatter
* ivy.el (ivy-format-function): New defvar.
(ivy-format-function-default): New defun.
(ivy-format-function-arrow): New defun, alternative for
`ivy-format-function'.
Oleh Krehel [Mon, 11 May 2015 09:07:07 +0000 (11:07 +0200)]
Swiper should use the :re-builder argument
* ivy.el (ivy--transform-re): Remove defun, :re-builder should be used
for this logic.
(ivy--filter): Update.
* swiper.el (swiper-avy): Use `ivy--regex'.
(swiper--init): Don't set `ivy--regex-function' - it will be set by
:re-builder.
(swiper--re-builder): New defun.
(swiper--ivy): Use :re-builder in call to `ivy-read'.
(swiper--update-input-ivy): Use `ivy--regex'.
(swiper--action): Use `ivy--regex'.
Oleh Krehel [Fri, 8 May 2015 15:47:51 +0000 (17:47 +0200)]
Add support for virtual buffers
* ivy.el (ivy-mode-map): New defvar. Remap `switch-to-buffer' to
`ivy-switch-buffer'.
(ivy-mode): Use `ivy-mode-map'.
(ivy--virtual-buffers): New devar.
(ivy--virtual-buffers): New defun.
(ivy-buffer-list): Return a list of buffers, taking
`ido-use-virtual-buffers' into account.
(ivy-switch-buffer): New command.
Oleh Krehel [Wed, 6 May 2015 19:01:14 +0000 (21:01 +0200)]
Try to prevent the resize of minibuffer window
* ivy.el (ivy--insert-minibuffer): Temporarily bind
`resize-mini-windows' to nil.
From its doc:
A value of `grow-only', the default, means let mini-windows grow only;
they return to their normal size when the minibuffer is closed, or the
echo area becomes empty.
It could be that an update catches this minibuffer empty during
`ivy--insert-minibuffer'.
Oleh Krehel [Wed, 6 May 2015 09:49:01 +0000 (11:49 +0200)]
Add parents using 'display for `counsel-load-library'
* counsel.el (counsel--find-symbol): The argument string may have a
'full-name property.
(counsel-string-compose): New defun.
(counsel-load-library): Make libraries unique through text properties.
Oleh Krehel [Wed, 6 May 2015 08:42:17 +0000 (10:42 +0200)]
Add counsel-load-library
* counsel.el (counsel-directory-parent): New defun.
(counsel-load-library): New command.
Improve on `load-library':
- don't consider .*elc or .*pkg.elc?, they're usually useless
- resolve duplicates in a similar way to uniquify (prepend parent directory)
- allow to jump-to-library with "C-." (see `counsel-describe-map')
Oleh Krehel [Wed, 6 May 2015 07:09:04 +0000 (09:09 +0200)]
Work around grep-read-files
* ivy.el (ivy--done): If history is `grep-files-history', the caller is
`grep-read-files'. Don't expand the file name, since it's probably a
glob, and `find' doesn't work with expanded globs.
It should now be possible to simply "M-x" rgrep "RET" "RET" "RET".
Oleh Krehel [Tue, 5 May 2015 08:14:17 +0000 (10:14 +0200)]
Improve "TAB" interaction with `confirm-nonexistent-file-or-buffer'
* ivy.el (ivy-partial-or-done): When
`confirm-nonexistent-file-or-buffer' is t, and there are no
candidates, modify the prompt to "(confirm)" right after the first
"TAB".
Oleh Krehel [Mon, 4 May 2015 07:38:20 +0000 (09:38 +0200)]
ivy.el (ivy-tab-space): New defcustom
* ivy.el (ivy-partial-or-done): Insert an extra space when
`ivy-tab-space' is non-nil. This is useful to complete partially and
start a new group at once.
Oleh Krehel [Sun, 3 May 2015 14:31:47 +0000 (16:31 +0200)]
Add an option for out-of-order matching
* ivy.el (ivy--regex-ignore-order): New defun.
* swiper.el (swiper--init): Set `ivy--regex-function'.
(swiper--update-input-ivy): Use `ivy--regex-function'.
(swiper--action): Use `ivy--regex-function'.
Oleh Krehel [Fri, 1 May 2015 20:01:30 +0000 (22:01 +0200)]
ivy-resume now works for functions that supply action
ivy.el (ivy-resume): Use action
Functions like `counsel-describe-funtion' and `counsel-describe-varible'
are now resume-able: after finishing with "RET" or breaking out with
"C-g" it's possible to resume the query in the same state as it
was (same collection, input, index).
With:
(global-set-key (kbd "C-c C-r") 'ivy-resume)
it's possible to e.g.:
- "F1 f" info read "RET" to describe Info-breadcrumbs
- "C-c C-r" "C-n" to describe Info-read-node-name
- "C-c C-r" "C-n" to describe Info-read-node-name-1
...
Oleh Krehel [Fri, 1 May 2015 19:49:25 +0000 (21:49 +0200)]
Merge ivy--action into ivy-last
* ivy.el (ivy-state): Add action field.
(ivy-set-action): New defun. Just a shortcut to set action.
(ivy--action): Remove defvar.
(ivy-read): Add action argument. Check (ivy-state-action ivy-last) in
the end and call it, since the action can change during the completion.
(ivy--insert-prompt): Add `counsel-find-symbol' to the list.
(ivy--format): If there are no matches, set `ivy--current' to "".
Oleh Krehel [Fri, 1 May 2015 18:01:08 +0000 (20:01 +0200)]
Add ivy-state struct
* ivy.el (ivy-state): New defstruct.
(ivy-last): A single global to store an `ivy-state' struct.
(ivy-require-match): Move into `ivy-last'.
(ivy-done): Update.
(ivy-resume): New defun. Initial draft, kind of works for swiper. Need
to add a callback of what to do with the result as an argument.
(ivy-read): Store all arguments into `ivy-last'.
(ivy-completing-read): Update doc.
Oleh Krehel [Wed, 29 Apr 2015 15:00:54 +0000 (17:00 +0200)]
Update and improve faces
* ivy.el (ivy-subdir): Inherit from dired-directory.
* swiper.el (swiper-match-face-1): Update doc.
(swiper-match-face-2): Update doc.
(swiper-match-face-3): Update doc.
(swiper-match-face-4): Inherit from isearch-fail.
(swiper--add-overlays): Fix the faces order swapping on the second
match.
Now it finally works as planned: face-1 is the background (re group 0),
next it cycles: face-2, face-3, face-4, face-2, face-3, face-4.
Oleh Krehel [Wed, 29 Apr 2015 10:10:09 +0000 (12:10 +0200)]
ivy.el (ivy--exhibit): Fixup last commit
* ivy.el (ivy--old-text): Should always be a string.
(ivy-read): Update.
(ivy--exhibit): Recompute candidates on flip, always set `ivy--old-re'
to nil.
Oleh Krehel [Tue, 28 Apr 2015 08:46:28 +0000 (10:46 +0200)]
Store the preselect and use it for empty ivy-text
* ivy.el (ivy-def): New defvar.
(ivy-read): Store `ivy-def'.
(ivy-completing-read): Update.
(ivy--filter): When the input is empty, set `ivy--index' to select
`ivy-def'.
Oleh Krehel [Sat, 25 Apr 2015 11:44:52 +0000 (13:44 +0200)]
Improve completion history using the propertize trick
* ivy.el (ivy-previous-history-element): Update.
(ivy-next-history-element): Update.
(ivy--maybe-scroll-history): New defun. When the history element string
has ivy-index property, set `ivy--index' to that.
Oleh Krehel [Fri, 24 Apr 2015 10:52:40 +0000 (12:52 +0200)]
Improve the match confirm while completing files
* ivy.el (ivy-confirm-face): New face.
(ivy-match-required-face): New face.
(ivy--prompt-extra): New defvar, the prompt is concatenaded with this.
(ivy--extend-prompt): Remove.
(ivy-done): Update.
(ivy--insert-prompt): Use `ivy--prompt-extra'. Reset it unless the
`this-command' is appropriate.
(ivy--set-match-props): New defun.