This function should only care about producing a list of strings from
the process buffer.
A new function should take this list and take care of everything else.
justbur [Mon, 7 Mar 2016 20:05:09 +0000 (15:05 -0500)]
Add optional exit-code table to counsel--async-cmd
This argument can be used to associate exit codes with the underlying
reason. Used in counsel-ag-function to signal that an exit code of 1
means that no matches were found.
Oleh Krehel [Mon, 7 Mar 2016 16:40:49 +0000 (17:40 +0100)]
counsel.el (counsel-git-grep-map): Bind "C-c C-m" to counsel-git-grep-switch-cmd
* counsel.el (counsel-git-grep-switch-cmd): New command.
The initial command always runs on all files.
To run only on *.el files, "C-c C-m" followed by "M-i" -- *.el.
To run on *.c and *.h files, "C-c C-m" followed by "M-i" -- *.c *.h.
To switch to all files again, "C-c C-m" and select the appropriate
entry.
justbur [Mon, 7 Mar 2016 01:59:14 +0000 (20:59 -0500)]
counsel-ag: Fix escaping problem
Before this it is not possible to pass the string "string1\|string2" to
ag, because inputing string1\|string2 gets translated into
"string1\\|string2" via %S.
Instead I use %s and shell-quote-argument to take care of escaping for
the command line, which fixes the issue for me.
Please test.
Also see https://github.com/syl20bnr/spacemacs/issues/5378
Oleh Krehel [Fri, 4 Mar 2016 13:58:50 +0000 (14:58 +0100)]
New command ivy-occur-revert-buffer bound to "g"
* ivy.el (ivy-occur-mode-map): Move `ivy-occur-press' from "g" to "f".
Bind "g" to `ivy-occur-revert-buffer'.
(ivy-occur-revert-buffer): New command. Does what e.g. `revert-buffer'
does for *Help* buffers.
* swiper.el (swiper-faces): Add :group and :type.
(swiper-occur): Try to avoid calling `ivy-occur-grep-mode' as it will
kill all local variables.
(swiper--action): Update so that `ivy-occur-toggle-calling' works properly.
Oleh Krehel [Wed, 2 Mar 2016 11:17:05 +0000 (12:17 +0100)]
ivy-occur-mode: new commands on "j", "k", "c"
* ivy.el (ivy-calling): Make variable buffer-local.
(ivy-occur-toggle-calling): New command bound to "c".
(ivy-occur-next-line): New command bound to "j".
(ivy-occur-previous-line): New command bound to "k".
This makes `ivy-occur' much more convenient, instead of "gjgjgjg", just
"cjjj". Especially good for commands that change the contents of the
other window, like `describe-function' or `counsel-git-grep'.
Oleh Krehel [Tue, 1 Mar 2016 18:30:38 +0000 (19:30 +0100)]
ivy.el (ivy-next-history-element): No "\\_<" for dynamic-collection
"\\_<" regex is Emacs-specific and should only be done if
:dynamic-collection is nil.
It is nil for `counsel-git-grep' with repositories < 20000 lines, but
non-nil for larger ones.
Oleh Krehel [Tue, 1 Mar 2016 15:53:30 +0000 (16:53 +0100)]
ivy-dispatching-done should not permanently modify default action index
* ivy.el (ivy-read):
When (numberp (car-safe (ivy-state-action ivy-last))), reset it to 1.
This was an issue for `ivy-read' calls that specified :action as a
list (`counsel-rhythmbox' and `counsel-list-processes'), instead using a
single function and `ivy-set-actions'.
Oleh Krehel [Mon, 29 Feb 2016 08:20:33 +0000 (09:20 +0100)]
"C-x C-f" can un-ignore dotfiles with a leading dot input
* counsel.el (counsel-find-file-ignore-regexp): Add a recommended value,
all dotfiles.
(counsel--find-file-matcher): When `ivy-text' starts with a dot, don't
use `counsel-find-file-ignore-regexp'. The generic way to do this is
with "C-c C-a" (`ivy-toggle-ignore'), but this is faster and more convenient.
Oleh Krehel [Sat, 27 Feb 2016 12:48:11 +0000 (13:48 +0100)]
Move read-file-name to :display-transformer-fn
* ivy.el (ivy-set-display-transformer): Set 'read-file-name-internal to
'ivy-read-file-transformer.
(ivy-read-file-transformer): New defun.
(ivy--format): Simplify.
Oleh Krehel [Sat, 27 Feb 2016 12:40:00 +0000 (13:40 +0100)]
Move switch-to-buffer to :display-transformer-fn
* ivy.el (ivy-read): Use also COLLECTION as a key for
`display-transformer-fn'.
(ivy--format): Simplify.
(ivy-switch-buffer-transformer): New defun.
(ivy-set-display-transformer): Set 'ivy-switch-buffer and
'internal-complete-buffer to 'ivy-switch-buffer-transformer.
Oleh Krehel [Sat, 27 Feb 2016 07:53:57 +0000 (08:53 +0100)]
Simplify the ivy-format-function interface
* ivy.el (ivy--format-function-generic): Third arg is no longer a list
of cons cells, but a list of strings instead.
(ivy-format-function-default):
(ivy-format-function-arrow):
(ivy-format-function-line): Take a string instead of a cons cell.
(ivy--format): Feed strings instead of cons cells to
`ivy-format-function'.
* ivy-test.el (ivy--format): Update test.
* counsel.el (counsel--yank-pop-format-function): Take a string instead
of a cons cell.
Oleh Krehel [Sat, 27 Feb 2016 07:32:01 +0000 (08:32 +0100)]
New API function ivy-set-display-transformer
* ivy.el (ivy--display-transformers-list): New defvar.
(ivy-set-display-transformer): New defun. Keys are :caller, values are
str->str lambda.
(ivy-state): New field display-transformer-fn.
(ivy-read): Set :display-transformer-fn.
(ivy--format): Apply :display-transformer-fn to each displayed
candidate, in the context of ivy-window.
* counsel.el (ivy-set-display-transformer): Set for `counsel-M-x'.
(counsel-M-x-transformer): Promote from `counsel--M-x-transformer'.
Now takes a string instead of a cons cell.
(counsel-M-x): No more messing with `ivy-format-function'.
Oleh Krehel [Fri, 26 Feb 2016 13:27:28 +0000 (14:27 +0100)]
Give ivy-read-read-action enough minibuffer space
* ivy.el (ivy-read-action): Bind (resize-mini-windows 'grow-only).
Return non-nil when everything went OK.
(ivy-dispatching-done): Call `ivy-done' only if read-action went OK.
Previously, an action would be called after "M-o C-g".
justbur [Sun, 17 Jan 2016 19:20:06 +0000 (14:20 -0500)]
Add ivy-fixed-height-minibuffer
This option attempts to make the minibuffer stay at a fixed height
regardless of the number of candidates. Some people prefer this as
it can be annoying when quickly going through folders of different
sizes for example
Oleh Krehel [Tue, 23 Feb 2016 09:41:28 +0000 (10:41 +0100)]
swiper.el (swiper--ivy): Update signature
Now takes a list of candidates, produced by something like
`swiper--candidates'.
This means that a user can call `swiper--ivy' with a filter applied on
`swiper--candidates' to obtain narrowing.
`swiper--candidates' replaces "\t" with four spaces for a consistent
look in the minibuffer. By the domino effect, this affects
`swiper--re-builder' and `swiper--update-input-ivy'.
Oleh Krehel [Mon, 22 Feb 2016 15:32:31 +0000 (16:32 +0100)]
ivy.el (ivy--preselect-index): Don't use regexp-quote
I don't remember why `regexp-quote' was needed in the first place. But
it's useful to have it as a regex at least for `lispy--occur-preselet'
which returns things like "^42" to preselect line 42.
Oleh Krehel [Fri, 19 Feb 2016 14:29:36 +0000 (15:29 +0100)]
counsel.el (counsel-locate-options): Make obsolete
* counsel.el (counsel-locate-cmd): New defcustom that replaces
`counsel-locate-options'.
(counsel-locate-cmd-default): New defun. Corresponds to the default
value of `counsel-locate-options' on linux.
(counsel-locate-cmd-noregex): New defun. Corresponds to the default
value of `counsel-locate-options' on darwin.
(counsel-locate-function): Use `counsel-locate-cmd'.
Oleh Krehel [Sun, 14 Feb 2016 09:10:17 +0000 (10:10 +0100)]
Fix an extra action being called for `completing-read'
* ivy.el (ivy-read): `ivy-call' got confused for a combination of
`completing-read' and `ivy-set-actions t` - since there was no first
action, the first of the extra actions was assumed to be that.
Now put `identity' as the first action for `completing-read'.
Oleh Krehel [Thu, 11 Feb 2016 16:21:44 +0000 (17:21 +0100)]
Customize ivy-occur per command with ivy-set-occur
* ivy.el (ivy--occurs-list): New defvar.
(ivy-set-occur): New API function for defining custom occur behavior.
(ivy--occur-insert-lines): New defun.
(ivy-occur): Simplify, move counsel-git-grep specific stuff away.
* counsel.el (counsel-git-grep-occur): New defun. Sets up an occur
buffer with a mode that derives from `grep-mode' that means that the
error functions (`next-error' etc) etc are available. Also allows to
edit the contents with `wgrep' by pressing "C-x C-q".
* swiper.el (swiper-occur): New defun, similar to
`counsel-git-grep-occur'. Except it turns off `font-lock-mode' to keep
the original syntax-highlighted faces.
(swiper--action): Update to make it work from ivy-occur buffers.
Oleh Krehel [Tue, 9 Feb 2016 09:28:53 +0000 (10:28 +0100)]
doc/ivy.org: Improve the markup
* doc/ivy.org (defopt): Get rid of the macro.
(Writing this manual): New section.
Use a lot more definition lists - they look nice in both HTML and
Texinfo export.
(Hydra in the minibuffer): Extend the section.
(Saving the current completion session to a buffer): Extend.
* doc/ivy-ox.el (org-texinfo-plain-list): Improve the user-option
formatting.
Stephen Whipple [Mon, 8 Feb 2016 10:41:15 +0000 (03:41 -0700)]
Add ignore pattern toggling
* ivy.el (ivy-minibuffer-map): Bind "C-c C-a" to `ivy-toggle-ignore'.
(ivy-use-ignore): New defvar.
(ivy-toggle-ignore): New command to toggle ignore
patterns (user-configured filtering). If the ignore patterns are enabled
and there are zero candidates after ignoring, display the ones that
match the current text. This feature currently works for
`ivy-switch-buffer' and `counsel-find-file'.
(ivy--buffer-list): Simplify.
(ivy--switch-buffer-matcher): New defun.
(ivy-switch-buffer): Use `ivy--switch-buffer-matcher'.
* counsel.el (counsel--find-file-matcher): Use `ivy-use-ignore'.