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 19:26:23 +0000 (21:26 +0200)]
Stop 'at-full from shifting text
* avy.el (avy-read): Call DISPLAY-FN in buffer's reverse order.
(avy--overlay-at-full): When there's an avy overlay after point, shorten
the current overlay to one letter.
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 [Sat, 9 May 2015 16:14:50 +0000 (18:14 +0200)]
Allow to break from `avy-goto-line' into `goto-line'
* avy.el (avy-handler-default): New defun.
(avy-handler-function): New variable. Bind this temporarily to catch bad chars.
(avy-read): Forward to `avy-handler-default'.
* avy-jump.el (avy--goto): Consider the case of 'exit symbol being
returned.
(avy-goto-line): Bind `avy-handler-function' to catch digits and call
`goto-line' in that case.
Oleh Krehel [Sat, 9 May 2015 11:38:05 +0000 (13:38 +0200)]
Update and document the style customization
* avy-jump.el (avy-style): New defcustom. Replaces `avy-goto-char-style'
and `avy-goto-word-style'.
(avy-styles-alist): New defcustom. Allows to customize the style for
each command separately.
(avy--with-avy-keys): Update.
(avy-goto-char-style): Obsolete.
(avy-goto-word-style): Obsolete.
Tassilo Horn [Fri, 8 May 2015 20:56:33 +0000 (22:56 +0200)]
Always default to avy-keys but allow for per-command overrides
Using the new `avy-keys-alist` one can override the default `avy-keys`
on a per-command basis. That's much better than hard-coding ?a-?z for
some commands and using the defaults for some others.
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.
Tassilo Horn [Thu, 7 May 2015 12:37:31 +0000 (14:37 +0200)]
Special-case char RET to allow for jumping to end-of-lines.
With this change you can use `avy-goto-char' also to jump to the end of
some currently visible line. E.g., C-c j <return> (assuming C-c j is
bound to `avy-goto-char') makes all line endings jump targets.
`avy--overlay-at' had to be adapted so that the overlay at \n doesn't
make the line-break disappear.
`avy--overlay' had to be adapted in order not to put an overlay on the
char after (point-max) in case `avy--overlay-post' is used. (Honestly,
this feature is a bit awkward with 'post overlays where the jump
location is visualized as first char in the next line.)
Oleh Krehel [Thu, 7 May 2015 11:28:27 +0000 (13:28 +0200)]
Abstract windows and rely on subword
* avy-jump.el (avy-dowindows): New macro.
(avy--regex-candidates): Use `avy-dowindows'.
(avy-goto-subword-0): Rely on `subword-backward'.
(avy--line): Use `avy-dowindows'.
Tassilo Horn [Thu, 7 May 2015 08:22:42 +0000 (10:22 +0200)]
Regexp-quote strings of avy-goto-char* functions.
Before this commit, avy-goto-char with char ^ would inf-loop because the
resulting string "^" is treated as a regular expressions. However, with
the avy-goto-char* function, the char should be treated literally. For
example, in Clojure ^:foo is treated as metadata annotation and thus ^
is a likely jump target.
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".
Kaushal Modi [Tue, 5 May 2015 13:14:07 +0000 (09:14 -0400)]
Add `avi-word-punc-regexp` defcustom
- Setting this to nil will disable jumping to punctuation chars during
`avi-goto-word-1`.
- Set this to a regexp of punctuation chars you want to match otherwise.
- "[!-/:-@[-`{-~]" will match all printable punctuation chars.