emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 6f4e442 4/5: Remove ivy 0.9.0 to add it again with subtree


From: Oleh Krehel
Subject: [elpa] master 6f4e442 4/5: Remove ivy 0.9.0 to add it again with subtree
Date: Mon, 10 Apr 2017 03:33:24 -0400 (EDT)

branch: master
commit 6f4e442a66d625f647faa51e88e052c3d93e9657
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Remove ivy 0.9.0 to add it again with subtree
---
 packages/ivy/.dir-locals.el    |    5 -
 packages/ivy/.travis.yml       |   16 -
 packages/ivy/Makefile          |   27 -
 packages/ivy/README.md         |  117 --
 packages/ivy/colir.el          |  111 --
 packages/ivy/counsel.el        | 3350 ------------------------------------
 packages/ivy/doc/Changelog.org | 2896 -------------------------------
 packages/ivy/doc/ivy-help.org  |  138 --
 packages/ivy/doc/ivy-ox.el     |  193 ---
 packages/ivy/doc/ivy.org       | 1326 --------------
 packages/ivy/doc/ivy.texi      | 1702 ------------------
 packages/ivy/ivy-hydra.el      |  103 --
 packages/ivy/ivy-overlay.el    |  114 --
 packages/ivy/ivy-test.el       |  429 -----
 packages/ivy/ivy.el            | 3705 ----------------------------------------
 packages/ivy/swiper.el         |  953 -----------
 16 files changed, 15185 deletions(-)

diff --git a/packages/ivy/.dir-locals.el b/packages/ivy/.dir-locals.el
deleted file mode 100644
index 3bcda92..0000000
--- a/packages/ivy/.dir-locals.el
+++ /dev/null
@@ -1,5 +0,0 @@
-;;; Directory Local Variables
-;;; For more information see (info "(emacs) Directory Variables")
-
-((emacs-lisp-mode
-  (indent-tabs-mode . nil)))
diff --git a/packages/ivy/.travis.yml b/packages/ivy/.travis.yml
deleted file mode 100644
index 0af43c8..0000000
--- a/packages/ivy/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: emacs-lisp
-env:
-  - EVM_EMACS=emacs-24.3-travis
-  - EVM_EMACS=emacs-24.4-travis
-  - EVM_EMACS=emacs-24.5-travis
-  - EVM_EMACS=emacs-git-snapshot-travis
-
-before_install:
-  - git clone https://github.com/rejeep/evm.git $HOME/.evm
-  - export PATH=$HOME/.evm/bin:$PATH
-
-  - evm config path /tmp
-  - evm install $EVM_EMACS --use --skip
-
-script:
-  - make test
diff --git a/packages/ivy/Makefile b/packages/ivy/Makefile
deleted file mode 100644
index 902ce8a..0000000
--- a/packages/ivy/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-emacs ?= emacs
-elmake = $(emacs) -batch -l makefi.el -f
-
-LOAD = -l colir.el -l ivy-overlay.el -l ivy.el -l swiper.el -l counsel.el
-
-all: test
-
-test:
-       $(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
-
-compile:
-       $(emacs) -batch --eval "(progn (add-to-list 'load-path 
default-directory) (mapc #'byte-compile-file '(\"ivy.el\" \"swiper.el\" 
\"counsel.el\" \"colir.el\")))"
-
-plain:
-       $(emacs) --version
-       $(emacs) -Q $(LOAD) --eval "(progn (package-initialize) (ivy-mode))"
-
-obsolete:
-       $(emacs) -batch -l targets/obsolete-config.el
-
-update-issues:
-       $(elmake) update-issues
-
-clean:
-       rm -f *.elc
-
-.PHONY: all compile clean test update-issues
diff --git a/packages/ivy/README.md b/packages/ivy/README.md
deleted file mode 100644
index 7cdb9ac..0000000
--- a/packages/ivy/README.md
+++ /dev/null
@@ -1,117 +0,0 @@
-[![Build 
Status](https://travis-ci.org/abo-abo/swiper.svg?branch=master)](https://travis-ci.org/abo-abo/swiper)
-
-***flexible, simple tools for minibuffer completion in Emacs***
-
-This repository contains:
-
-**Ivy**, a generic completion mechanism for Emacs.
-
-**Counsel**, a collection of Ivy-enhanced versions of common Emacs
-commands.
-
-**Swiper**, an Ivy-enhanced alternative to isearch.
-
-# Ivy
-
-[![MELPA](http://melpa.org/packages/ivy-badge.svg)](http://melpa.org/#/ivy)
-
-Ivy is a generic completion mechanism for Emacs. While it operates
-similarly to other completion schemes such as `icomplete-mode`, Ivy
-aims to be more efficient, smaller, simpler, and smoother to use yet
-highly customizable.
-
-To try Ivy, just call <kbd>M-x</kbd> `ivy-mode`. This will enable
-generic Ivy completion, including specific completion for file and
-buffer names.
-
-### Installation
-
-Install the `ivy` package from MELPA / GNU ELPA.
-
-## Documentation
-
-### Manual
-The manual is available as [HTML](http://oremacs.com/swiper/).
-
-After installing from MELPA, the manual is also available through the `(ivy)` 
Info node.
-
-The source file for the Info page is
-[here](https://github.com/abo-abo/swiper/blob/master/doc/ivy.org).
-
-### Wiki
-Ivy and Swiper wiki is here: [the 
wiki](https://github.com/abo-abo/swiper/wiki).
-
-### Small config example
-```elisp
-(ivy-mode 1)
-(setq ivy-use-virtual-buffers t)
-(setq enable-recursive-minibuffers t)
-(global-set-key "\C-s" 'swiper)
-(global-set-key (kbd "C-c C-r") 'ivy-resume)
-(global-set-key (kbd "<f6>") 'ivy-resume)
-(global-set-key (kbd "M-x") 'counsel-M-x)
-(global-set-key (kbd "C-x C-f") 'counsel-find-file)
-(global-set-key (kbd "<f1> f") 'counsel-describe-function)
-(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
-(global-set-key (kbd "<f1> l") 'counsel-find-library)
-(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
-(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
-(global-set-key (kbd "C-c g") 'counsel-git)
-(global-set-key (kbd "C-c j") 'counsel-git-grep)
-(global-set-key (kbd "C-c k") 'counsel-ag)
-(global-set-key (kbd "C-x l") 'counsel-locate)
-(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
-(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
-```
-
-# Counsel
-
-`ivy-mode` ensures that any Emacs command using
-`completing-read-function` uses ivy for completion.
-
-Counsel takes this further, providing versions of common Emacs
-commands that are customised to make the best use of ivy. For example,
-`counsel-find-file` has some additional keybindings. Pressing
-<kbd>DEL</kbd> will move you to the parent directory.
-
-# Swiper
-
-[![MELPA](https://melpa.org/packages/swiper-badge.svg)](https://melpa.org/#/swiper)
-
-Swiper is an alternative to isearch that uses ivy to show an overview
-of all matches.
-
-![swiper.png](http://oremacs.com/download/swiper.png)
-
-A helm version of swiper is also available:
-[swiper-helm](https://github.com/abo-abo/swiper-helm).
-
-## Screenshots
-
-![ivy-swiper-1.png](http://oremacs.com/download/ivy-swiper-1.png)
-
-There's also a ten minute [video 
demo](https://www.youtube.com/watch?v=VvnJQpTFVDc).
-
-# Frequently asked questions
-
-Q: How do I enter an input that matches one of the candidates instead
-   of this candidate? Example: create a file `bar` when a file
-   `barricade` exists in the current directory.
-
-A: Press <kbd>C-M-j</kbd>.
-
-# Contributing
-
-## Copyright Assignment
-
-These package are subject to the same [copyright 
assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html) 
policy as Emacs itself, org-mode, CEDET and other packages in [GNU 
ELPA](http://elpa.gnu.org/packages/). Any [legally 
significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant)
 contributions can only be accepted after the author has completed their 
paperwork. Please see [the request form](http://git.savannah.gnu.org/cgit [...]
-
-The copyright assignment isn't a big deal, it just says that the copyright for 
your submitted changes to Emacs belongs to the FSF. This assignment works for 
all projects related to Emacs. To obtain it, you need to send one email, then 
send one letter (if you live in the US, it's digital), and wait for some time 
(in my case, I had to wait for one month).
-
-## Style
-
-The basic code style guide is to use `(setq indent-tabs-mode nil)`. It is 
provided for you in 
[.dir-locals.el](https://github.com/abo-abo/swiper/blob/master/.dir-locals.el), 
please obey it.
-
-Before submitting the change, run `make compile` and `make test` to make sure 
that it doesn't introduce new compile warnings or test failures. Also run 
<kbd>M-x</kbd> `checkdoc` to see that your changes obey the documentation 
guidelines.
-
-Use your own judgment for the commit messages, I recommend a verbose style 
using `magit-commit-add-log`.
diff --git a/packages/ivy/colir.el b/packages/ivy/colir.el
deleted file mode 100644
index 9ab724f..0000000
--- a/packages/ivy/colir.el
+++ /dev/null
@@ -1,111 +0,0 @@
-;;; colir.el --- Color blending library -*- lexical-binding: t -*-
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; This package solves the problem of adding a face with a background
-;; to text which may already have a background.  In all conflicting
-;; areas, instead of choosing either the original or the new
-;; background face, their blended sum is used.
-;;
-;; The blend mode functions are taken from 
http://en.wikipedia.org/wiki/Blend_modes.
-
-;;; Code:
-
-(require 'color)
-
-(defcustom colir-compose-method 'colir-compose-alpha
-  "Select a method to compose two color channels."
-  :type '(choice
-          (const colir-compose-alpha)
-          (const colir-compose-overlay)
-          (const colir-compose-soft-light))
-  :group 'ivy)
-
-(defun colir-compose-soft-light (a b)
-  "Compose A and B channels."
-  (if (< b 0.5)
-      (+ (* 2 a b) (* a a (- 1 b b)))
-    (+ (* 2 a (- 1 b)) (* (sqrt a) (- (* 2 b) 1)))))
-
-(defun colir-compose-overlay (a b)
-  "Compose A and B channels."
-  (if (< a 0.5)
-      (* 2 a b)
-    (- 1 (* 2 (- 1 a) (- 1 b)))))
-
-(defun colir-compose-alpha (a b &optional alpha gamma)
-  "Compose A and B channels."
-  (setq alpha (or alpha 0.5))
-  (setq gamma (or gamma 2.2))
-  (+ (* (expt a gamma) alpha) (* (expt b gamma) (- 1 alpha))))
-
-(defun colir-blend (c1 c2)
-  "Blend the two colors C1 and C2 using `colir-compose-method'.
-C1 and C2 are triples of floats in [0.0 1.0] range."
-  (apply #'color-rgb-to-hex
-         (cl-mapcar
-          (if (eq (frame-parameter nil 'background-mode) 'dark)
-              ;; this method works nicely for dark themes
-              'colir-compose-soft-light
-            colir-compose-method)
-          c1 c2)))
-
-(defun colir-color-parse (color)
-  "Convert string COLOR to triple of floats in [0.0 1.0]."
-  (if (string-match 
"#\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)" 
color)
-      (mapcar (lambda (v) (/ (string-to-number v 16) 255.0))
-              (list (match-string 1 color) (match-string 2 color) 
(match-string 3 color)))
-    ;; does not work properly in terminal (maps color to nearest color
-    ;; from available color palette).
-    (color-name-to-rgb color)))
-
-(defun colir-blend-face-background (start end face &optional object)
-  "Append to the face property of the text from START to END the face FACE.
-When the text already has a face with a non-plain background,
-blend it with the background of FACE.
-Optional argument OBJECT is the string or buffer containing the text.
-See also `font-lock-append-text-property'."
-  (let (next prev)
-    (while (/= start end)
-      (setq next (next-single-property-change start 'face object end))
-      (setq prev (get-text-property start 'face object))
-      (when (listp prev)
-        (setq prev (cl-find-if #'atom prev)))
-      (if (facep prev)
-          (let ((background-prev (face-background prev)))
-            (progn
-              (put-text-property
-               start next 'face
-               (if background-prev
-                   (cons `(background-color
-                           . ,(colir-blend
-                               (colir-color-parse background-prev)
-                               (colir-color-parse (face-background face nil 
t))))
-                         prev)
-                 (list face prev))
-               object)))
-        (put-text-property start next 'face face object))
-      (setq start next))))
-
-(provide 'colir)
-
-;;; colir.el ends here
diff --git a/packages/ivy/counsel.el b/packages/ivy/counsel.el
deleted file mode 100644
index 4f5b392..0000000
--- a/packages/ivy/counsel.el
+++ /dev/null
@@ -1,3350 +0,0 @@
-;;; counsel.el --- Various completion functions using Ivy -*- lexical-binding: 
t -*-
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.9.0
-;; Package-Requires: ((emacs "24.3") (swiper "0.9.0"))
-;; Keywords: completion, matching
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; Just call one of the interactive functions in this file to complete
-;; the corresponding thing using `ivy'.
-;;
-;; Currently available:
-;; - Symbol completion for Elisp, Common Lisp, Python and Clojure.
-;; - Describe fuctions for Elisp: function, variable, library, command,
-;;   bindings, theme.
-;; - Navigation functions: imenu, ace-line, semantic, outline
-;; - Git utilities: git-files, git-grep, git-log, git-stash.
-;; - Grep utitilies: grep, ag, pt, recoll.
-;; - System utilities: process list, rhythmbox, linux-app.
-;; - Many more.
-
-;;; Code:
-
-(require 'swiper)
-(require 'etags)
-(require 'esh-util)
-
-;;* Utility
-(defun counsel-more-chars (n)
-  "Return two fake candidates prompting for at least N input."
-  (list ""
-        (format "%d chars more" (- n (length ivy-text)))))
-
-(defun counsel-unquote-regex-parens (str)
-  (let ((start 0)
-        ms)
-    (while (setq start (string-match "\\\\)\\|\\\\(\\|[()]" str start))
-      (setq ms (match-string-no-properties 0 str))
-      (cond ((equal ms "\\(")
-             (setq str (replace-match "(" nil t str))
-             (setq start (+ start 1)))
-            ((equal ms "\\)")
-             (setq str (replace-match ")" nil t str))
-             (setq start (+ start 1)))
-            ((equal ms "(")
-             (setq str (replace-match "\\(" nil t str))
-             (setq start (+ start 2)))
-            ((equal ms ")")
-             (setq str (replace-match "\\)" nil t str))
-             (setq start (+ start 2)))
-            (t
-             (error "unexpected"))))
-    str))
-
-(defun counsel-directory-parent (dir)
-  "Return the directory parent of directory DIR."
-  (concat (file-name-nondirectory
-           (directory-file-name dir)) "/"))
-
-(defun counsel-string-compose (prefix str)
-  "Make PREFIX the display prefix of STR through text properties."
-  (let ((str (copy-sequence str)))
-    (put-text-property
-     0 1 'display
-     (concat prefix (substring str 0 1))
-     str)
-    str))
-
-;;* Async Utility
-(defvar counsel--async-time nil
-  "Store the time when a new process was started.
-Or the time of the last minibuffer update.")
-
-(defvar counsel--async-start nil
-  "Store the time when a new process was started.
-Or the time of the last minibuffer update.")
-
-(defvar counsel--async-duration nil
-  "Store the time in seconds between starting a process and
-  receiving all candidates.")
-
-(defvar counsel--async-exit-code-plist nil
-  "Associates exit codes with reasons.")
-
-(defun counsel-set-async-exit-code (cmd number str)
-  "For CMD, associate NUMBER exit code with STR."
-  (let ((plist (plist-get counsel--async-exit-code-plist cmd)))
-    (setq counsel--async-exit-code-plist
-          (plist-put
-           counsel--async-exit-code-plist
-           cmd
-           (plist-put plist number str)))))
-
-(defvar counsel-async-split-string-re "\n"
-  "Store the regexp for splitting shell command output.")
-
-(defun counsel--async-command (cmd &optional process-sentinel process-filter)
-  (let* ((counsel--process " *counsel*")
-         (proc (get-process counsel--process))
-         (buff (get-buffer counsel--process)))
-    (when proc
-      (delete-process proc))
-    (when buff
-      (kill-buffer buff))
-    (setq proc (start-process-shell-command
-                counsel--process
-                counsel--process
-                cmd))
-    (setq counsel--async-start
-          (setq counsel--async-time (current-time)))
-    (set-process-sentinel proc (or process-sentinel #'counsel--async-sentinel))
-    (set-process-filter proc (or process-filter #'counsel--async-filter))))
-
-(defvar counsel-grep-last-line nil)
-
-(defun counsel--async-sentinel (process event)
-  (let ((cands
-         (cond ((string= event "finished\n")
-                (with-current-buffer (process-buffer process)
-                  (split-string
-                   (buffer-string)
-                   counsel-async-split-string-re
-                   t)))
-               ((string-match "exited abnormally with code \\([0-9]+\\)\n" 
event)
-                (let* ((exit-code-plist (plist-get 
counsel--async-exit-code-plist
-                                                   (ivy-state-caller 
ivy-last)))
-                       (exit-num (read (match-string 1 event)))
-                       (exit-code (plist-get exit-code-plist exit-num)))
-                  (list
-                   (or exit-code
-                       (format "error code %d" exit-num))))))))
-    (cond ((string= event "finished\n")
-           (ivy--set-candidates
-            (ivy--sort-maybe
-             cands))
-           (setq counsel-grep-last-line nil)
-           (when counsel--async-start
-             (setq counsel--async-duration
-                   (time-to-seconds (time-since counsel--async-start))))
-           (let ((re (funcall ivy--regex-function ivy-text)))
-             (unless (stringp re)
-               (setq re (caar re)))
-             (if (null ivy--old-cands)
-                 (unless (ivy-set-index
-                          (ivy--preselect-index
-                           (ivy-state-preselect ivy-last)
-                           ivy--all-candidates))
-                   (ivy--recompute-index
-                    ivy-text re ivy--all-candidates))
-               (ivy--recompute-index
-                ivy-text re ivy--all-candidates)))
-           (setq ivy--old-cands ivy--all-candidates)
-           (if (null ivy--all-candidates)
-               (ivy--insert-minibuffer "")
-             (ivy--exhibit)))
-          ((string-match "exited abnormally with code \\([0-9]+\\)\n" event)
-           (setq ivy--all-candidates cands)
-           (setq ivy--old-cands ivy--all-candidates)
-           (ivy--exhibit)))))
-
-(defun counsel--async-filter (process str)
-  "Receive from PROCESS the output STR.
-Update the minibuffer with the amount of lines collected every
-0.5 seconds since the last update."
-  (with-current-buffer (process-buffer process)
-    (insert str))
-  (let (size)
-    (when (time-less-p
-           ;; 0.5s
-           '(0 0 500000 0)
-           (time-since counsel--async-time))
-      (with-current-buffer (process-buffer process)
-        (goto-char (point-min))
-        (setq size (- (buffer-size) (forward-line (buffer-size))))
-        (ivy--set-candidates
-         (split-string
-          (buffer-string)
-          counsel-async-split-string-re
-          t)))
-      (let ((ivy--prompt (format
-                          (concat "%d++ " (ivy-state-prompt ivy-last))
-                          size)))
-        (ivy--insert-minibuffer
-         (ivy--format ivy--all-candidates)))
-      (setq counsel--async-time (current-time)))))
-
-(defcustom counsel-prompt-function 'counsel-prompt-function-default
-  "A function to return a full prompt string from a basic prompt string."
-  :type
-  '(choice
-    (const :tag "Plain" counsel-prompt-function-default)
-    (const :tag "Directory" counsel-prompt-function-dir)
-    (function :tag "Custom"))
-  :group 'ivy)
-
-(make-obsolete-variable
- 'counsel-prompt-function
- "Use `ivy-set-prompt' instead"
- "0.8.0 <2016-06-20 Mon>")
-
-(defun counsel-prompt-function-default ()
-  "Return prompt appended with a semicolon."
-  (ivy-add-prompt-count
-   (format "%s: " (ivy-state-prompt ivy-last))))
-
-(defun counsel-delete-process ()
-  (let ((process (get-process " *counsel*")))
-    (when process
-      (delete-process process))))
-
-;;* Completion at point
-;;** `counsel-el'
-;;;###autoload
-(defun counsel-el ()
-  "Elisp completion at point."
-  (interactive)
-  (let* ((bnd (unless (and (looking-at ")")
-                           (eq (char-before) ?\())
-                (bounds-of-thing-at-point
-                 'symbol)))
-         (str (if bnd
-                  (buffer-substring-no-properties
-                   (car bnd)
-                   (cdr bnd))
-                ""))
-         (ivy-height 7)
-         (funp (eq (char-before (car bnd)) ?\())
-         symbol-names)
-    (if bnd
-        (progn
-          (setq ivy-completion-beg
-                (move-marker (make-marker) (car bnd)))
-          (setq ivy-completion-end
-                (move-marker (make-marker) (cdr bnd))))
-      (setq ivy-completion-beg nil)
-      (setq ivy-completion-end nil))
-    (if (string= str "")
-        (mapatoms
-         (lambda (x)
-           (when (symbolp x)
-             (push (symbol-name x) symbol-names))))
-      (setq symbol-names
-            (all-completions str obarray
-                             (and funp
-                                  (lambda (x)
-                                    (or (functionp x)
-                                        (macrop x)
-                                        (special-form-p x)))))))
-    (ivy-read "Symbol name: " symbol-names
-              :predicate (and funp #'functionp)
-              :initial-input str
-              :action #'ivy-completion-in-region-action)))
-
-;;** `counsel-cl'
-(declare-function slime-symbol-start-pos "ext:slime")
-(declare-function slime-symbol-end-pos "ext:slime")
-(declare-function slime-contextual-completions "ext:slime-c-p-c")
-
-;;;###autoload
-(defun counsel-cl ()
-  "Common Lisp completion at point."
-  (interactive)
-  (setq ivy-completion-beg (slime-symbol-start-pos))
-  (setq ivy-completion-end (slime-symbol-end-pos))
-  (ivy-read "Symbol name: "
-            (car (slime-contextual-completions
-                  ivy-completion-beg
-                  ivy-completion-end))
-            :action #'ivy-completion-in-region-action))
-
-;;** `counsel-jedi'
-(declare-function deferred:sync! "ext:deferred")
-(declare-function jedi:complete-request "ext:jedi-core")
-(declare-function jedi:ac-direct-matches "ext:jedi")
-
-(defun counsel-jedi ()
-  "Python completion at point."
-  (interactive)
-  (let ((bnd (bounds-of-thing-at-point 'symbol)))
-    (if bnd
-        (progn
-          (setq ivy-completion-beg (car bnd))
-          (setq ivy-completion-end (cdr bnd)))
-      (setq ivy-completion-beg nil)
-      (setq ivy-completion-end nil)))
-  (deferred:sync!
-      (jedi:complete-request))
-  (ivy-read "Symbol name: " (jedi:ac-direct-matches)
-            :action #'counsel--py-action))
-
-(defun counsel--py-action (symbol)
-  "Insert SYMBOL, erasing the previous one."
-  (when (stringp symbol)
-    (with-ivy-window
-      (when ivy-completion-beg
-        (delete-region
-         ivy-completion-beg
-         ivy-completion-end))
-      (setq ivy-completion-beg
-            (move-marker (make-marker) (point)))
-      (insert symbol)
-      (setq ivy-completion-end
-            (move-marker (make-marker) (point)))
-      (when (equal (get-text-property 0 'symbol symbol) "f")
-        (insert "()")
-        (setq ivy-completion-end
-              (move-marker (make-marker) (point)))
-        (backward-char 1)))))
-
-;;** `counsel-clj'
-(declare-function cider-sync-request:complete "ext:cider-client")
-(defun counsel--generic (completion-fn)
-  "Complete thing at point with COMPLETION-FN."
-  (let* ((bnd (or (bounds-of-thing-at-point 'symbol)
-                  (cons (point) (point))))
-         (str (buffer-substring-no-properties
-               (car bnd) (cdr bnd)))
-         (candidates (funcall completion-fn str))
-         (ivy-height 7)
-         (res (ivy-read (format "pattern (%s): " str)
-                        candidates)))
-    (when (stringp res)
-      (when bnd
-        (delete-region (car bnd) (cdr bnd)))
-      (insert res))))
-
-;;;###autoload
-(defun counsel-clj ()
-  "Clojure completion at point."
-  (interactive)
-  (counsel--generic
-   (lambda (str)
-     (mapcar
-      #'cl-caddr
-      (cider-sync-request:complete str ":same")))))
-
-;;** `counsel-unicode-char'
-(defvar counsel-unicode-char-history nil
-  "History for `counsel-unicode-char'.")
-
-;;;###autoload
-(defun counsel-unicode-char (&optional count)
-  "Insert a Unicode character at point."
-  (interactive "p")
-  (let ((minibuffer-allow-text-properties t)
-        (ivy-sort-max-size (expt 256 6)))
-    (setq ivy-completion-beg (point))
-    (setq ivy-completion-end (point))
-    (ivy-read "Unicode name: "
-              (mapcar (lambda (x)
-                        (propertize
-                         (format "%06X % -60s%c" (cdr x) (car x) (cdr x))
-                         'result (cdr x)))
-                      (ucs-names))
-              :action (lambda (char)
-                        (with-ivy-window
-                          (delete-region ivy-completion-beg ivy-completion-end)
-                          (setq ivy-completion-beg (point))
-                          (insert-char (get-text-property 0 'result char) 
count)
-                          (setq ivy-completion-end (point))))
-              :history 'counsel-unicode-char-history
-              :sort t)))
-
-;;* Elisp symbols
-;;** `counsel-describe-variable'
-(defvar counsel-describe-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-.") #'counsel-find-symbol)
-    (define-key map (kbd "C-,") #'counsel--info-lookup-symbol)
-    map))
-
-(ivy-set-actions
- 'counsel-describe-variable
- '(("i" counsel-info-lookup-symbol "info")
-   ("d" counsel--find-symbol "definition")))
-
-(defvar counsel-describe-symbol-history nil
-  "History for `counsel-describe-variable' and `counsel-describe-function'.")
-
-(defun counsel-find-symbol ()
-  "Jump to the definition of the current symbol."
-  (interactive)
-  (ivy-exit-with-action #'counsel--find-symbol))
-
-(defun counsel--info-lookup-symbol ()
-  "Lookup the current symbol in the info docs."
-  (interactive)
-  (ivy-exit-with-action #'counsel-info-lookup-symbol))
-
-(defun counsel--find-symbol (x)
-  "Find symbol definition that corresponds to string X."
-  (with-ivy-window
-    (with-no-warnings
-      (ring-insert find-tag-marker-ring (point-marker)))
-    (let ((full-name (get-text-property 0 'full-name x)))
-      (if full-name
-          (find-library full-name)
-        (let ((sym (read x)))
-          (cond ((and (eq (ivy-state-caller ivy-last)
-                          'counsel-describe-variable)
-                      (boundp sym))
-                 (find-variable sym))
-                ((fboundp sym)
-                 (find-function sym))
-                ((boundp sym)
-                 (find-variable sym))
-                ((or (featurep sym)
-                     (locate-library
-                      (prin1-to-string sym)))
-                 (find-library
-                  (prin1-to-string sym)))
-                (t
-                 (error "Couldn't find definition of %s"
-                        sym))))))))
-
-(define-obsolete-function-alias 'counsel-symbol-at-point
-    'ivy-thing-at-point "0.7.0")
-
-(defun counsel-variable-list ()
-  "Return the list of all currently bound variables."
-  (let (cands)
-    (mapatoms
-     (lambda (vv)
-       (when (or (get vv 'variable-documentation)
-                 (and (boundp vv) (not (keywordp vv))))
-         (push (symbol-name vv) cands))))
-    cands))
-
-;;;###autoload
-(defun counsel-describe-variable ()
-  "Forward to `describe-variable'."
-  (interactive)
-  (let ((enable-recursive-minibuffers t))
-    (ivy-read
-     "Describe variable: "
-     (counsel-variable-list)
-     :keymap counsel-describe-map
-     :preselect (ivy-thing-at-point)
-     :history 'counsel-describe-symbol-history
-     :require-match t
-     :sort t
-     :action (lambda (x)
-               (describe-variable
-                (intern x)))
-     :caller 'counsel-describe-variable)))
-
-;;** `counsel-describe-function'
-(ivy-set-actions
- 'counsel-describe-function
- '(("i" counsel-info-lookup-symbol "info")
-   ("d" counsel--find-symbol "definition")))
-
-;;;###autoload
-(defun counsel-describe-function ()
-  "Forward to `describe-function'."
-  (interactive)
-  (let ((enable-recursive-minibuffers t))
-    (ivy-read "Describe function: "
-              (let (cands)
-                (mapatoms
-                 (lambda (x)
-                   (when (fboundp x)
-                     (push (symbol-name x) cands))))
-                cands)
-              :keymap counsel-describe-map
-              :preselect (ivy-thing-at-point)
-              :history 'counsel-describe-symbol-history
-              :require-match t
-              :sort t
-              :action (lambda (x)
-                        (describe-function
-                         (intern x)))
-              :caller 'counsel-describe-function)))
-
-;;** `counsel-set-variable'
-(defvar counsel-set-variable-history nil
-  "Store history for `counsel-set-variable'.")
-
-(defun counsel-read-setq-expression (sym)
-  "Read and eval a setq expression for SYM."
-  (setq this-command 'eval-expression)
-  (let* ((minibuffer-completing-symbol t)
-         (sym-value (symbol-value sym))
-         (expr (minibuffer-with-setup-hook
-                   (lambda ()
-                     (add-function :before-until (local 
'eldoc-documentation-function)
-                                   #'elisp-eldoc-documentation-function)
-                     (add-hook 'completion-at-point-functions 
#'elisp-completion-at-point nil t)
-                     (run-hooks 'eval-expression-minibuffer-setup-hook)
-                     (goto-char (minibuffer-prompt-end))
-                     (forward-char 6)
-                     (insert (format "%S " sym)))
-                 (read-from-minibuffer "Eval: "
-                                       (format
-                                        (if (and sym-value (consp sym-value))
-                                            "(setq '%S)"
-                                          "(setq %S)")
-                                        sym-value)
-                                       read-expression-map t
-                                       'read-expression-history))))
-    (eval-expression expr)))
-
-(defun counsel--setq-doconst (x)
-  "Return a cons of description and value for X.
-X is an item of a radio- or choice-type defcustom."
-  (let (y)
-    (when (and (listp x)
-               (consp (setq y (last x))))
-      (setq x (car y))
-      (cons (prin1-to-string x)
-            (if (symbolp x)
-                (list 'quote x)
-              x)))))
-
-;;;###autoload
-(defun counsel-set-variable ()
-  "Set a variable, with completion.
-
-When the selected variable is a `defcustom' with the type boolean
-or radio, offer completion of all possible values.
-
-Otherwise, offer a variant of `eval-expression', with the initial
-input corresponding to the chosen variable."
-  (interactive)
-  (let ((sym (intern
-              (ivy-read "Variable: "
-                        (counsel-variable-list)
-                        :preselect (ivy-thing-at-point)
-                        :history 'counsel-set-variable-history)))
-        sym-type
-        cands)
-    (if (and (boundp sym)
-             (setq sym-type (get sym 'custom-type))
-             (cond
-               ((and (consp sym-type)
-                     (memq (car sym-type) '(choice radio)))
-                (setq cands (delq nil (mapcar #'counsel--setq-doconst (cdr 
sym-type)))))
-               ((eq sym-type 'boolean)
-                (setq cands '(("nil" . nil) ("t" . t))))
-               (t nil)))
-        (let* ((sym-val (symbol-value sym))
-               ;; Escape '%' chars if present
-               (sym-val-str (replace-regexp-in-string "%" "%%" (format "%s" 
sym-val)))
-               (res (ivy-read (format "Set (%S <%s>): " sym sym-val-str)
-                              cands
-                              :preselect (prin1-to-string sym-val))))
-          (when res
-            (setq res
-                  (if (assoc res cands)
-                      (cdr (assoc res cands))
-                    (read res)))
-            (eval `(setq ,sym ,res))))
-      (unless (boundp sym)
-        (set sym nil))
-      (counsel-read-setq-expression sym))))
-
-;;** `counsel-info-lookup-symbol'
-(defvar info-lookup-mode)
-(declare-function info-lookup->completions "info-look")
-(declare-function info-lookup->mode-value "info-look")
-(declare-function info-lookup-select-mode "info-look")
-(declare-function info-lookup-change-mode "info-look")
-(declare-function info-lookup "info-look")
-
-;;;###autoload
-(defun counsel-info-lookup-symbol (symbol &optional mode)
-  "Forward to (`info-lookup-symbol' SYMBOL MODE) with ivy completion."
-  (interactive
-   (progn
-     (require 'info-look)
-     (let* ((topic 'symbol)
-            (mode (cond (current-prefix-arg
-                         (info-lookup-change-mode topic))
-                        ((info-lookup->mode-value
-                          topic (info-lookup-select-mode))
-                         info-lookup-mode)
-                        ((info-lookup-change-mode topic))))
-            (completions (info-lookup->completions topic mode))
-            (enable-recursive-minibuffers t)
-            (value (ivy-read
-                    "Describe symbol: "
-                    (mapcar #'car completions)
-                    :preselect (ivy-thing-at-point)
-                    :sort t)))
-       (list value info-lookup-mode))))
-  (require 'info-look)
-  (info-lookup 'symbol symbol mode))
-
-;;** `counsel-M-x'
-(ivy-set-actions
- 'counsel-M-x
- '(("d" counsel--find-symbol "definition")
-   ("h" (lambda (x) (describe-function (intern x))) "help")))
-
-(ivy-set-display-transformer
- 'counsel-M-x
- 'counsel-M-x-transformer)
-
-(declare-function bookmark-all-names "bookmark")
-(declare-function bookmark-location "bookmark")
-
-(defcustom counsel-bookmark-avoid-dired nil
-  "If non-nil, choosing a directory in `counsel-bookmark'
-forwards the choice to `counsel-find-file' instead of opening a
-dired buffer."
-  :type 'boolean
-  :group 'ivy)
-
-;;;###autoload
-(defun counsel-bookmark ()
-  "Forward to `bookmark-jump' or `bookmark-set' if bookmark doesn't exist."
-  (interactive)
-  (require 'bookmark)
-  (ivy-read "Create or jump to bookmark: "
-            (bookmark-all-names)
-            :action (lambda (x)
-                      (cond ((and counsel-bookmark-avoid-dired
-                                  (member x (bookmark-all-names))
-                                  (file-directory-p (bookmark-location x)))
-                             (with-ivy-window
-                               (let ((default-directory (bookmark-location x)))
-                                 (counsel-find-file))))
-                            ((member x (bookmark-all-names))
-                             (with-ivy-window
-                               (bookmark-jump x)))
-                            (t
-                             (bookmark-set x))))
-            :caller 'counsel-bookmark))
-
-(ivy-set-actions
- 'counsel-bookmark
- '(("d" bookmark-delete "delete")
-   ("e" bookmark-rename "edit")))
-
-(defun counsel-M-x-transformer (cmd)
-  "Return CMD appended with the corresponding binding in the current window."
-  (let ((binding (substitute-command-keys (format "\\[%s]" cmd))))
-    (setq binding (replace-regexp-in-string "C-x 6" "<f2>" binding))
-    (if (string-match "^M-x" binding)
-        cmd
-      (format "%s (%s)"
-              cmd (propertize binding 'face 'font-lock-keyword-face)))))
-
-(defvar smex-initialized-p)
-(defvar smex-ido-cache)
-(declare-function smex-initialize "ext:smex")
-(declare-function smex-detect-new-commands "ext:smex")
-(declare-function smex-update "ext:smex")
-(declare-function smex-rank "ext:smex")
-
-(defun counsel--M-x-prompt ()
-  "M-x plus the string representation of `current-prefix-arg'."
-  (if (not current-prefix-arg)
-      "M-x "
-    (concat
-     (if (eq current-prefix-arg '-)
-         "- "
-       (if (integerp current-prefix-arg)
-           (format "%d " current-prefix-arg)
-         (if (= (car current-prefix-arg) 4)
-             "C-u "
-           (format "%d " (car current-prefix-arg)))))
-     "M-x ")))
-
-;;;###autoload
-(defun counsel-M-x (&optional initial-input)
-  "Ivy version of `execute-extended-command'.
-Optional INITIAL-INPUT is the initial input in the minibuffer."
-  (interactive)
-  (unless initial-input
-    (setq initial-input (cdr (assoc this-command
-                                    ivy-initial-inputs-alist))))
-  (let* ((cands obarray)
-         (pred 'commandp)
-         (sort t))
-    (when (require 'smex nil 'noerror)
-      (unless smex-initialized-p
-        (smex-initialize))
-      (smex-detect-new-commands)
-      (smex-update)
-      (setq cands smex-ido-cache)
-      (setq pred nil)
-      (setq sort nil))
-    ;; When `counsel-M-x' returns, `last-command' would be set to
-    ;; `counsel-M-x' because :action hasn't been invoked yet.
-    ;; Instead, preserve the old value of `this-command'.
-    (setq this-command last-command)
-    (setq real-this-command real-last-command)
-
-    (ivy-read (counsel--M-x-prompt) cands
-              :predicate pred
-              :require-match t
-              :history 'extended-command-history
-              :action
-              (lambda (cmd)
-                (when (featurep 'smex)
-                  (smex-rank (intern cmd)))
-                (let ((prefix-arg current-prefix-arg))
-                  (setq real-this-command
-                        (setq this-command (intern cmd)))
-                  (command-execute (intern cmd) 'record)))
-              :sort sort
-              :keymap counsel-describe-map
-              :initial-input initial-input
-              :caller 'counsel-M-x)))
-
-;;** `counsel-load-library'
-(defun counsel-library-candidates ()
-  "Return a list of completion candidates for `counsel-load-library'."
-  (interactive)
-  (let ((dirs load-path)
-        (suffix (concat (regexp-opt '(".el" ".el.gz") t) "\\'"))
-        (cands (make-hash-table :test #'equal))
-        short-name
-        old-val
-        dir-parent
-        res)
-    (dolist (dir dirs)
-      (when (file-directory-p dir)
-        (dolist (file (file-name-all-completions "" dir))
-          (when (string-match suffix file)
-            (unless (string-match "pkg.elc?$" file)
-              (setq short-name (substring file 0 (match-beginning 0)))
-              (if (setq old-val (gethash short-name cands))
-                  (progn
-                    ;; assume going up directory once will resolve name clash
-                    (setq dir-parent (counsel-directory-parent (cdr old-val)))
-                    (puthash short-name
-                             (cons
-                              (counsel-string-compose dir-parent (car old-val))
-                              (cdr old-val))
-                             cands)
-                    (setq dir-parent (counsel-directory-parent dir))
-                    (puthash (concat dir-parent short-name)
-                             (cons
-                              (propertize
-                               (counsel-string-compose
-                                dir-parent short-name)
-                               'full-name (expand-file-name file dir))
-                              dir)
-                             cands))
-                (puthash short-name
-                         (cons (propertize
-                                short-name
-                                'full-name (expand-file-name file dir))
-                               dir) cands)))))))
-    (maphash (lambda (_k v) (push (car v) res)) cands)
-    (nreverse res)))
-
-;;;###autoload
-(defun counsel-load-library ()
-  "Load a selected the Emacs Lisp library.
-The libraries are offered from `load-path'."
-  (interactive)
-  (let ((cands (counsel-library-candidates)))
-    (ivy-read "Load library: " cands
-              :action (lambda (x)
-                        (load-library
-                         (get-text-property 0 'full-name x)))
-              :keymap counsel-describe-map)))
-
-(ivy-set-actions
- 'counsel-load-library
- '(("d" counsel--find-symbol "definition")))
-
-;;** `counsel-find-library'
-;;;###autoload
-(defun counsel-find-library ()
-  "Visit a selected the Emacs Lisp library.
-The libraries are offered from `load-path'."
-  (interactive)
-  (let ((cands (counsel-library-candidates)))
-    (ivy-read "Find library: " cands
-              :action #'counsel--find-symbol
-              :keymap counsel-describe-map)))
-
-;;** `counsel-load-theme'
-(declare-function powerline-reset "ext:powerline")
-
-(defun counsel-load-theme-action (x)
-  "Disable current themes and load theme X."
-  (condition-case nil
-      (progn
-        (mapc #'disable-theme custom-enabled-themes)
-        (load-theme (intern x) t)
-        (when (fboundp 'powerline-reset)
-          (powerline-reset)))
-    (error "Problem loading theme %s" x)))
-
-;;;###autoload
-(defun counsel-load-theme ()
-  "Forward to `load-theme'.
-Usable with `ivy-resume', `ivy-next-line-and-call' and
-`ivy-previous-line-and-call'."
-  (interactive)
-  (ivy-read "Load custom theme: "
-            (mapcar 'symbol-name
-                    (custom-available-themes))
-            :action #'counsel-load-theme-action
-            :caller 'counsel-load-theme))
-
-;;** `counsel-descbinds'
-(ivy-set-actions
- 'counsel-descbinds
- '(("d" counsel-descbinds-action-find "definition")
-   ("i" counsel-descbinds-action-info "info")))
-
-(defvar counsel-descbinds-history nil
-  "History for `counsel-descbinds'.")
-
-(defun counsel--descbinds-cands (&optional prefix buffer)
-  (let ((buffer (or buffer (current-buffer)))
-        (re-exclude (regexp-opt
-                     '("<vertical-line>" "<bottom-divider>" "<right-divider>"
-                       "<mode-line>" "<C-down-mouse-2>" "<left-fringe>"
-                       "<right-fringe>" "<header-line>"
-                       "<vertical-scroll-bar>" "<horizontal-scroll-bar>")))
-        res)
-    (with-temp-buffer
-      (let ((indent-tabs-mode t))
-        (describe-buffer-bindings buffer prefix))
-      (goto-char (point-min))
-      ;; Skip the "Key translations" section
-      (re-search-forward "")
-      (forward-char 1)
-      (while (not (eobp))
-        (when (looking-at "^\\([^\t\n]+\\)\t+\\(.*\\)$")
-          (let ((key (match-string 1))
-                (fun (match-string 2))
-                cmd)
-            (unless (or (member fun '("??" "self-insert-command"))
-                        (string-match re-exclude key)
-                        (not (or (commandp (setq cmd (intern-soft fun)))
-                                 (member fun '("Prefix Command")))))
-              (push
-               (cons (format
-                      "%-15s %s"
-                      (propertize key 'face 'font-lock-builtin-face)
-                      fun)
-                     (cons key cmd))
-               res))))
-        (forward-line 1)))
-    (nreverse res)))
-
-(defun counsel-descbinds-action-describe (x)
-  (let ((cmd (cddr x)))
-    (describe-function cmd)))
-
-(defun counsel-descbinds-action-find (x)
-  (let ((cmd (cddr x)))
-    (counsel--find-symbol (symbol-name cmd))))
-
-(defun counsel-descbinds-action-info (x)
-  (let ((cmd (cddr x)))
-    (counsel-info-lookup-symbol (symbol-name cmd))))
-
-;;;###autoload
-(defun counsel-descbinds (&optional prefix buffer)
-  "Show a list of all defined keys, and their definitions.
-Describe the selected candidate."
-  (interactive)
-  (ivy-read "Bindings: " (counsel--descbinds-cands prefix buffer)
-            :action #'counsel-descbinds-action-describe
-            :history 'counsel-descbinds-history
-            :caller 'counsel-descbinds))
-;;** `counsel-describe-face'
-(defun counsel-describe-face ()
-  "Completion for `describe-face'."
-  (interactive)
-  (let (cands)
-    (mapatoms
-     (lambda (s)
-       (if (facep s)
-           (push (symbol-name s) cands))))
-    (ivy-read "Face: " cands
-              :preselect (symbol-name (face-at-point t))
-              :action #'describe-face)))
-;;* Git
-;;** `counsel-git'
-(defvar counsel-git-cmd "git ls-files --full-name --"
-  "Command for `counsel-git'.")
-
-(defvar counsel--git-dir nil
-  "Store the base git directory.")
-
-(ivy-set-actions
- 'counsel-git
- '(("j" find-file-other-window "other window")
-   ("x" counsel-find-file-extern "open externally")))
-
-;;;###autoload
-(defun counsel-git ()
-  "Find file in the current Git repository."
-  (interactive)
-  (setq counsel--git-dir (locate-dominating-file
-                          default-directory ".git"))
-  (ivy-set-prompt 'counsel-git counsel-prompt-function)
-  (if (null counsel--git-dir)
-      (error "Not in a git repository")
-    (setq counsel--git-dir (expand-file-name
-                            counsel--git-dir))
-    (let* ((default-directory counsel--git-dir)
-           (cands (split-string
-                   (shell-command-to-string counsel-git-cmd)
-                   "\n"
-                   t)))
-      (ivy-read "Find file" cands
-                :action #'counsel-git-action
-                :caller 'counsel-git))))
-
-(defun counsel-git-action (x)
-  (with-ivy-window
-    (let ((default-directory counsel--git-dir))
-      (find-file x))))
-
-;;** `counsel-git-grep'
-(defvar counsel-git-grep-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-l") 'counsel-git-grep-recenter)
-    (define-key map (kbd "M-q") 'counsel-git-grep-query-replace)
-    (define-key map (kbd "C-c C-m") 'counsel-git-grep-switch-cmd)
-    map))
-
-(ivy-set-occur 'counsel-git-grep 'counsel-git-grep-occur)
-(ivy-set-display-transformer 'counsel-git-grep 'counsel-git-grep-transformer)
-
-(defvar counsel-git-grep-cmd-default "git --no-pager grep --full-name -n 
--no-color -i -e '%s'"
-  "Initial command for `counsel-git-grep'.")
-
-(defvar counsel-git-grep-cmd nil
-  "Store the command for `counsel-git-grep'.")
-
-(defvar counsel--git-grep-dir nil
-  "Store the base git directory.")
-
-(defvar counsel--git-grep-count nil
-  "Store the line count in current repository.")
-
-(defvar counsel-git-grep-history nil
-  "History for `counsel-git-grep'.")
-
-(defvar counsel-git-grep-cmd-history
-  (list counsel-git-grep-cmd-default)
-  "History for `counsel-git-grep' shell commands.")
-
-(defcustom counsel-grep-post-action-hook nil
-  "Hook that runs after the point moves to the next candidate.
-Typical value: '(recenter)."
-  :type 'hook
-  :group 'ivy)
-
-(defun counsel-prompt-function-dir ()
-  "Return prompt appended with the parent directory."
-  (ivy-add-prompt-count
-   (let ((directory counsel--git-grep-dir))
-     (format "%s [%s]: "
-             (ivy-state-prompt ivy-last)
-             (let ((dir-list (eshell-split-path directory)))
-               (if (> (length dir-list) 3)
-                   (apply #'concat
-                          (append '("...")
-                                  (cl-subseq dir-list (- (length dir-list) 
3))))
-                 directory))))))
-
-(defun counsel-git-grep-function (string &optional _pred &rest _unused)
-  "Grep in the current git repository for STRING."
-  (if (and (> counsel--git-grep-count 20000)
-           (< (length string) 3))
-      (counsel-more-chars 3)
-    (let* ((default-directory counsel--git-grep-dir)
-           (cmd (format counsel-git-grep-cmd
-                        (setq ivy--old-re (ivy--regex string t)))))
-      (if (<= counsel--git-grep-count 20000)
-          (split-string (shell-command-to-string cmd) "\n" t)
-        (counsel--gg-candidates (ivy--regex string))
-        nil))))
-
-(defun counsel-git-grep-action (x)
-  (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x)
-    (with-ivy-window
-      (let ((file-name (match-string-no-properties 1 x))
-            (line-number (match-string-no-properties 2 x)))
-        (find-file (expand-file-name file-name counsel--git-grep-dir))
-        (goto-char (point-min))
-        (forward-line (1- (string-to-number line-number)))
-        (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
-        (swiper--ensure-visible)
-        (run-hooks 'counsel-grep-post-action-hook)
-        (unless (eq ivy-exit 'done)
-          (swiper--cleanup)
-          (swiper--add-overlays (ivy--regex ivy-text)))))))
-
-(defun counsel-git-grep-matcher (regexp candidates)
-  (or (and (equal regexp ivy--old-re)
-           ivy--old-cands)
-      (prog1
-          (setq ivy--old-cands
-                (cl-remove-if-not
-                 (lambda (x)
-                   (ignore-errors
-                     (when (string-match "^[^:]+:[^:]+:" x)
-                       (setq x (substring x (match-end 0)))
-                       (if (stringp regexp)
-                           (string-match regexp x)
-                         (let ((res t))
-                           (dolist (re regexp)
-                             (setq res
-                                   (and res
-                                        (ignore-errors
-                                          (if (cdr re)
-                                              (string-match (car re) x)
-                                            (not (string-match (car re) 
x)))))))
-                           res)))))
-                 candidates))
-        (setq ivy--old-re regexp))))
-
-(defun counsel-git-grep-transformer (str)
-  "Higlight file and line number in STR."
-  (when (string-match "\\`\\([^:]+\\):\\([^:]+\\):" str)
-    (set-text-properties (match-beginning 1)
-                         (match-end 1)
-                         '(face compilation-info)
-                         str)
-    (set-text-properties (match-beginning 2)
-                         (match-end 2)
-                         '(face compilation-line-number)
-                         str))
-  str)
-
-(defvar counsel-git-grep-projects-alist nil
-  "An alist of project directory to \"git-grep\" command.
-Allows to automatically use a custom \"git-grep\" command for all
-files in a project.")
-
-;;;###autoload
-(defun counsel-git-grep (&optional cmd initial-input)
-  "Grep for a string in the current git repository.
-When CMD is a string, use it as a \"git grep\" command.
-When CMD is non-nil, prompt for a specific \"git grep\" command.
-INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive "P")
-  (ivy-set-prompt 'counsel-git-grep counsel-prompt-function)
-  (let ((dd (expand-file-name default-directory))
-        proj)
-    (cond
-      ((stringp cmd)
-       (setq counsel-git-grep-cmd cmd))
-      (cmd
-       (if (setq proj
-                 (cl-find-if
-                  (lambda (x)
-                    (string-match (car x) dd))
-                  counsel-git-grep-projects-alist))
-           (setq counsel-git-grep-cmd (cdr proj))
-         (setq counsel-git-grep-cmd
-               (ivy-read "cmd: " counsel-git-grep-cmd-history
-                         :history 'counsel-git-grep-cmd-history
-                         :re-builder #'ivy--regex))
-         (setq counsel-git-grep-cmd-history
-               (delete-dups counsel-git-grep-cmd-history))))
-      (t
-       (setq counsel-git-grep-cmd counsel-git-grep-cmd-default)))
-    (setq counsel--git-grep-dir
-          (if proj
-              (car proj)
-            (locate-dominating-file default-directory ".git")))
-    (if (null counsel--git-grep-dir)
-        (error "Not in a git repository")
-      (unless proj
-        (setq counsel--git-grep-count
-              (if (eq system-type 'windows-nt)
-                  0
-                (counsel--gg-count "" t))))
-      (ivy-read "git grep" (if proj
-                               'counsel-git-grep-proj-function
-                             'counsel-git-grep-function)
-                :initial-input initial-input
-                :matcher #'counsel-git-grep-matcher
-                :dynamic-collection (or proj (> counsel--git-grep-count 20000))
-                :keymap counsel-git-grep-map
-                :action #'counsel-git-grep-action
-                :unwind #'swiper--cleanup
-                :history 'counsel-git-grep-history
-                :caller 'counsel-git-grep))))
-
-(defun counsel-git-grep-proj-function (str)
-  (if (< (length str) 3)
-      (counsel-more-chars 3)
-    (let ((regex (setq ivy--old-re
-                       (ivy--regex str t))))
-      (counsel--async-command (format counsel-git-grep-cmd regex))
-      nil)))
-
-(defun counsel-git-grep-switch-cmd ()
-  "Set `counsel-git-grep-cmd' to a different value."
-  (interactive)
-  (setq counsel-git-grep-cmd
-        (ivy-read "cmd: " counsel-git-grep-cmd-history
-                  :history 'counsel-git-grep-cmd-history))
-  (setq counsel-git-grep-cmd-history
-        (delete-dups counsel-git-grep-cmd-history))
-  (unless (ivy-state-dynamic-collection ivy-last)
-    (setq ivy--all-candidates
-          (all-completions "" 'counsel-git-grep-function))))
-
-(defvar counsel-gg-state nil
-  "The current state of candidates / count sync.")
-
-(defun counsel--gg-candidates (regex)
-  "Return git grep candidates for REGEX."
-  (setq counsel-gg-state -2)
-  (counsel--gg-count regex)
-  (let* ((default-directory counsel--git-grep-dir)
-         (counsel-gg-process " *counsel-gg*")
-         (proc (get-process counsel-gg-process))
-         (buff (get-buffer counsel-gg-process)))
-    (when proc
-      (delete-process proc))
-    (when buff
-      (kill-buffer buff))
-    (setq proc (start-process-shell-command
-                counsel-gg-process
-                counsel-gg-process
-                (concat
-                 (format counsel-git-grep-cmd regex)
-                 " | head -n 200")))
-    (set-process-sentinel
-     proc
-     #'counsel--gg-sentinel)))
-
-(defun counsel--gg-sentinel (process event)
-  (if (member event '("finished\n"
-                      "exited abnormally with code 141\n"))
-      (progn
-        (with-current-buffer (process-buffer process)
-          (setq ivy--all-candidates
-                (or (split-string (buffer-string) "\n" t)
-                    '("")))
-          (setq ivy--old-cands ivy--all-candidates))
-        (when (= 0 (cl-incf counsel-gg-state))
-          (ivy--exhibit)))
-    (if (string= event "exited abnormally with code 1\n")
-        (progn
-          (setq ivy--all-candidates '("Error"))
-          (setq ivy--old-cands ivy--all-candidates)
-          (ivy--exhibit)))))
-
-(defun counsel--gg-count (regex &optional no-async)
-  "Quickly and asynchronously count the amount of git grep REGEX matches.
-When NO-ASYNC is non-nil, do it synchronously."
-  (let ((default-directory counsel--git-grep-dir)
-        (cmd
-         (concat
-          (format
-           (replace-regexp-in-string
-            "--full-name" "-c"
-            counsel-git-grep-cmd)
-           ;; "git grep -i -c '%s'"
-           (replace-regexp-in-string
-            "-" "\\\\-"
-            (replace-regexp-in-string "'" "''" regex)))
-          " | sed 's/.*:\\(.*\\)/\\1/g' | awk '{s+=$1} END {print s}'"))
-        (counsel-ggc-process " *counsel-gg-count*"))
-    (if no-async
-        (string-to-number (shell-command-to-string cmd))
-      (let ((proc (get-process counsel-ggc-process))
-            (buff (get-buffer counsel-ggc-process)))
-        (when proc
-          (delete-process proc))
-        (when buff
-          (kill-buffer buff))
-        (setq proc (start-process-shell-command
-                    counsel-ggc-process
-                    counsel-ggc-process
-                    cmd))
-        (set-process-sentinel
-         proc
-         #'(lambda (process event)
-             (when (string= event "finished\n")
-               (with-current-buffer (process-buffer process)
-                 (setq ivy--full-length (string-to-number (buffer-string))))
-               (when (= 0 (cl-incf counsel-gg-state))
-                 (ivy--exhibit)))))))))
-
-(defun counsel-git-grep-occur ()
-  "Generate a custom occur buffer for `counsel-git-grep'.
-When REVERT is non-nil, regenerate the current *ivy-occur* buffer."
-  (unless (eq major-mode 'ivy-occur-grep-mode)
-    (ivy-occur-grep-mode)
-    (setq default-directory counsel--git-grep-dir))
-  (setq ivy-text
-        (and (string-match "\"\\(.*\\)\"" (buffer-name))
-             (match-string 1 (buffer-name))))
-  (let ((cands (split-string
-                (shell-command-to-string
-                 (format counsel-git-grep-cmd
-                         (setq ivy--old-re (ivy--regex ivy-text t))))
-                "\n"
-                t)))
-    ;; Need precise number of header lines for `wgrep' to work.
-    (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                    default-directory))
-    (insert (format "%d candidates:\n" (length cands)))
-    (ivy--occur-insert-lines
-     (mapcar
-      (lambda (cand) (concat "./" cand))
-      cands))))
-
-(defun counsel-git-grep-query-replace ()
-  "Start `query-replace' with string to replace from last search string."
-  (interactive)
-  (if (null (window-minibuffer-p))
-      (user-error
-       "Should only be called in the minibuffer through 
`counsel-git-grep-map'")
-    (let* ((enable-recursive-minibuffers t)
-           (from (ivy--regex ivy-text))
-           (to (query-replace-read-to from "Query replace" t)))
-      (ivy-exit-with-action
-       (lambda (_)
-         (let (done-buffers)
-           (dolist (cand ivy--old-cands)
-             (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" cand)
-               (with-ivy-window
-                 (let ((file-name (match-string-no-properties 1 cand)))
-                   (setq file-name (expand-file-name file-name 
counsel--git-grep-dir))
-                   (unless (member file-name done-buffers)
-                     (push file-name done-buffers)
-                     (find-file file-name)
-                     (goto-char (point-min)))
-                   (perform-replace from to t t nil)))))))))))
-
-(defun counsel-git-grep-recenter ()
-  (interactive)
-  (with-ivy-window
-    (counsel-git-grep-action (ivy-state-current ivy-last))
-    (recenter-top-bottom)))
-
-;;** `counsel-git-stash'
-(defun counsel-git-stash-kill-action (x)
-  (when (string-match "\\([^:]+\\):" x)
-    (kill-new (message (format "git stash apply %s" (match-string 1 x))))))
-
-;;;###autoload
-(defun counsel-git-stash ()
-  "Search through all available git stashes."
-  (interactive)
-  (let ((dir (locate-dominating-file default-directory ".git")))
-    (if (null dir)
-        (error "Not in a git repository")
-      (let ((cands (split-string (shell-command-to-string
-                                  "IFS=$'\n'
-for i in `git stash list --format=\"%gd\"`; do
-    git stash show -p $i | grep -H --label=\"$i\" \"$1\"
-done") "\n" t)))
-        (ivy-read "git stash: " cands
-                  :action 'counsel-git-stash-kill-action
-                  :caller 'counsel-git-stash)))))
-;;** `counsel-git-log'
-(defvar counsel-git-log-cmd "GIT_PAGER=cat git log --grep '%s'"
-  "Command used for \"git log\".")
-
-(defun counsel-git-log-function (input)
-  (if (< (length input) 3)
-      (counsel-more-chars 3)
-    ;; `counsel--yank-pop-format-function' uses this
-    (setq ivy--old-re (funcall ivy--regex-function input))
-    (counsel--async-command
-     ;; "git log --grep" likes to have groups quoted e.g. \(foo\).
-     ;; But it doesn't like the non-greedy ".*?".
-     (format counsel-git-log-cmd
-             (replace-regexp-in-string "\\.\\*\\?" ".*" ivy--old-re)))
-    nil))
-
-(defun counsel-git-log-action (x)
-  (message "%S" (kill-new x)))
-
-(defcustom counsel-yank-pop-truncate-radius 2
-  "When non-nil, truncate the display of long strings."
-  :type 'integer
-  :group 'ivy)
-
-;;;###autoload
-(defun counsel-git-log ()
-  "Call the \"git log --grep\" shell command."
-  (interactive)
-  (let ((counsel-async-split-string-re "\ncommit ")
-        (counsel-yank-pop-truncate-radius 5)
-        (ivy-format-function #'counsel--yank-pop-format-function)
-        (ivy-height 4))
-    (ivy-read "Grep log: " #'counsel-git-log-function
-              :dynamic-collection t
-              :action #'counsel-git-log-action
-              :unwind #'counsel-delete-process
-              :caller 'counsel-git-log)))
-
-;;* File
-;;** `counsel-find-file'
-(defvar counsel-find-file-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-DEL") 'counsel-up-directory)
-    (define-key map (kbd "C-<backspace>") 'counsel-up-directory)
-    map))
-
-(add-to-list 'ivy-ffap-url-functions 'counsel-github-url-p)
-(add-to-list 'ivy-ffap-url-functions 'counsel-emacs-url-p)
-(defun counsel-find-file-cd-bookmark-action (_)
-  "Reset `counsel-find-file' from selected directory."
-  (ivy-read "cd: "
-            (progn
-              (ivy--virtual-buffers)
-              (delete-dups
-               (mapcar (lambda (x) (file-name-directory (cdr x)))
-                       ivy--virtual-buffers)))
-            :action (lambda (x)
-                      (let ((default-directory (file-name-directory x)))
-                        (counsel-find-file)))))
-
-(defcustom counsel-root-command "sudo"
-  "Command to gain root privileges."
-  :type 'string
-  :group 'ivy)
-
-(defun counsel-find-file-as-root (x)
-  "Find file with root privileges."
-  (let* ((host (file-remote-p x 'host))
-         (file-name (format "/%s:%s:%s"
-                            counsel-root-command
-                            (or host "")
-                            (expand-file-name
-                             (if host
-                                 (file-remote-p x 'localname)
-                               x)))))
-    ;; If the current buffer visits the same file we are about to open,
-    ;; replace the current buffer with the new one.
-    (if (eq (current-buffer) (get-file-buffer x))
-        (find-alternate-file file-name)
-      (find-file file-name))))
-
-(ivy-set-actions
- 'counsel-find-file
- '(("j" find-file-other-window "other window")
-   ("b" counsel-find-file-cd-bookmark-action "cd bookmark")
-   ("x" counsel-find-file-extern "open externally")
-   ("r" counsel-find-file-as-root "open as root")))
-
-(defcustom counsel-find-file-at-point nil
-  "When non-nil, add file-at-point to the list of candidates."
-  :type 'boolean
-  :group 'ivy)
-
-(defcustom counsel-find-file-ignore-regexp nil
-  "A regexp of files to ignore while in `counsel-find-file'.
-These files are un-ignored if `ivy-text' matches them.  The
-common way to show all files is to start `ivy-text' with a dot.
-
-Example value: \"\\(?:\\`[#.]\\)\\|\\(?:[#~]\\'\\)\". This will hide
-temporary and lock files.
-\\<ivy-minibuffer-map>
-Choosing the dotfiles option, \"\\`\\.\", might be convenient,
-since you can still access the dotfiles if your input starts with
-a dot. The generic way to toggle ignored files is \\[ivy-toggle-ignore],
-but the leading dot is a lot faster."
-  :group 'ivy
-  :type '(choice
-          (const :tag "None" nil)
-          (const :tag "Dotfiles" "\\`\\.")
-          (regexp :tag "Regex")))
-
-(defun counsel--find-file-matcher (regexp candidates)
-  "Return REGEXP-matching CANDIDATES.
-Skip some dotfiles unless `ivy-text' requires them."
-  (let ((res (ivy--re-filter regexp candidates)))
-    (if (or (null ivy-use-ignore)
-            (null counsel-find-file-ignore-regexp)
-            (string-match "\\`\\." ivy-text))
-        res
-      (or (cl-remove-if
-           (lambda (x)
-             (and
-              (string-match counsel-find-file-ignore-regexp x)
-              (not (member x ivy-extra-directories))))
-           res)
-          res))))
-
-(declare-function ffap-guesser "ffap")
-
-(defvar counsel-find-file-speedup-remote t
-  "Speed up opening remote files by disabling `find-file-hook' for them.")
-
-;;;###autoload
-(defun counsel-find-file (&optional initial-input)
-  "Forward to `find-file'.
-When INITIAL-INPUT is non-nil, use it in the minibuffer during completion."
-  (interactive)
-  (ivy-read "Find file: " 'read-file-name-internal
-            :matcher #'counsel--find-file-matcher
-            :initial-input initial-input
-            :action
-            (lambda (x)
-              (with-ivy-window
-                (let ((find-file-hook (if (and
-                                           counsel-find-file-speedup-remote
-                                           (file-remote-p ivy--directory))
-                                          nil
-                                        find-file-hook)))
-                  (find-file (expand-file-name x ivy--directory)))))
-            :preselect (when counsel-find-file-at-point
-                         (require 'ffap)
-                         (let ((f (ffap-guesser)))
-                           (when f (expand-file-name f))))
-            :require-match 'confirm-after-completion
-            :history 'file-name-history
-            :keymap counsel-find-file-map
-            :caller 'counsel-find-file))
-
-(defun counsel-up-directory ()
-  "Go to the parent directory preselecting the current one."
-  (interactive)
-  (let ((dir-file-name
-         (directory-file-name (expand-file-name ivy--directory))))
-    (ivy--cd (file-name-directory dir-file-name))
-    (setf (ivy-state-preselect ivy-last)
-          (file-name-as-directory (file-name-nondirectory dir-file-name)))))
-
-(defun counsel-at-git-issue-p ()
-  "When point is at an issue in a Git-versioned file, return the issue string."
-  (and (looking-at "#[0-9]+")
-       (or
-        (eq (vc-backend (buffer-file-name)) 'Git)
-        (or
-         (memq major-mode '(magit-commit-mode))
-         (bound-and-true-p magit-commit-mode)))
-       (match-string-no-properties 0)))
-
-(defun counsel-github-url-p ()
-  "Return a Github issue URL at point."
-  (let ((url (counsel-at-git-issue-p)))
-    (when url
-      (let ((origin (shell-command-to-string
-                     "git remote get-url origin"))
-            user repo)
-        (cond ((string-match "address@hidden:\\([^/]+\\)/\\(.*\\)\\.git$"
-                             origin)
-               (setq user (match-string 1 origin))
-               (setq repo (match-string 2 origin)))
-              ((string-match "\\`https://github.com/\\([^/]+\\)/\\(.*\\)$"
-                             origin)
-               (setq user (match-string 1 origin))
-               (setq repo (match-string 2 origin))))
-        (when user
-          (setq url (format "https://github.com/%s/%s/issues/%s";
-                            user repo (substring url 1))))))))
-
-(defun counsel-emacs-url-p ()
-  "Return a Debbugs issue URL at point."
-  (let ((url (counsel-at-git-issue-p)))
-    (when url
-      (let ((origin (shell-command-to-string
-                     "git remote get-url origin")))
-        (when (string-match "git.sv.gnu.org:/srv/git/emacs.git" origin)
-          (format "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s";
-                  (substring url 1)))))))
-
-;;** `counsel-recentf'
-(defvar recentf-list)
-(declare-function recentf-mode "recentf")
-
-;;;###autoload
-(defun counsel-recentf ()
-  "Find a file on `recentf-list'."
-  (interactive)
-  (require 'recentf)
-  (recentf-mode)
-  (ivy-read "Recentf: " (mapcar #'substring-no-properties recentf-list)
-            :action (lambda (f)
-                      (with-ivy-window
-                       (find-file f)))
-            :caller 'counsel-recentf))
-(ivy-set-actions
- 'counsel-recentf
- '(("j" find-file-other-window "other window")
-   ("x" counsel-find-file-extern "open externally")))
-
-;;** `counsel-locate'
-(defcustom counsel-locate-cmd (cond ((eq system-type 'darwin)
-                                     'counsel-locate-cmd-noregex)
-                                    ((and (eq system-type 'windows-nt)
-                                          (executable-find "es.exe"))
-                                     'counsel-locate-cmd-es)
-                                    (t
-                                     'counsel-locate-cmd-default))
-  "The function for producing a locate command string from the input.
-
-The function takes a string - the current input, and returns a
-string - the full shell command to run."
-  :group 'ivy
-  :type '(choice
-          (const :tag "Default" counsel-locate-cmd-default)
-          (const :tag "No regex" counsel-locate-cmd-noregex)
-          (const :tag "mdfind" counsel-locate-cmd-mdfind)
-          (const :tag "everything" counsel-locate-cmd-es)))
-
-(ivy-set-actions
- 'counsel-locate
- '(("x" counsel-locate-action-extern "xdg-open")
-   ("d" counsel-locate-action-dired "dired")))
-
-(counsel-set-async-exit-code 'counsel-locate 1 "Nothing found")
-
-(defvar counsel-locate-history nil
-  "History for `counsel-locate'.")
-
-(defun counsel-locate-action-extern (x)
-  "Use xdg-open shell command, or corresponding system command, on X."
-  (interactive (list (read-file-name "File: ")))
-  (if (and (eq system-type 'windows-nt)
-           (fboundp 'w32-shell-execute))
-      (w32-shell-execute "open" x)
-    (call-process shell-file-name nil
-                  nil nil
-                  shell-command-switch
-                  (format "%s %s"
-                          (cl-case system-type
-                            (darwin "open")
-                            (t "xdg-open"))
-                          (shell-quote-argument x)))))
-
-(defalias 'counsel-find-file-extern 'counsel-locate-action-extern)
-
-(declare-function dired-jump "dired-x")
-
-(defun counsel-locate-action-dired (x)
-  "Use `dired-jump' on X."
-  (dired-jump nil x))
-
-(defun counsel-locate-cmd-default (input)
-  "Return a shell command based on INPUT."
-  (format "locate -i --regex '%s'"
-          (counsel-unquote-regex-parens
-           (ivy--regex input))))
-
-(defun counsel-locate-cmd-noregex (input)
-  "Return a shell command based on INPUT."
-  (format "locate -i '%s'" input))
-
-(defun counsel-locate-cmd-mdfind (input)
-  "Return a shell command based on INPUT."
-  (format "mdfind -name '%s'" input))
-
-(defun counsel-locate-cmd-es (input)
-  "Return a shell command based on INPUT."
-  (format "es.exe -i -r %s"
-          (counsel-unquote-regex-parens
-           (ivy--regex input t))))
-
-(defun counsel-locate-function (input)
-  (if (< (length input) 3)
-      (counsel-more-chars 3)
-    (counsel--async-command
-     (funcall counsel-locate-cmd input))
-    '("" "working...")))
-
-;;;###autoload
-(defun counsel-locate (&optional initial-input)
-  "Call the \"locate\" shell command.
-INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive)
-  (ivy-read "Locate: " #'counsel-locate-function
-            :initial-input initial-input
-            :dynamic-collection t
-            :history 'counsel-locate-history
-            :action (lambda (file)
-                      (with-ivy-window
-                        (when file
-                          (find-file file))))
-            :unwind #'counsel-delete-process
-            :caller 'counsel-locate))
-
-;;** `counsel-dpkg'
-;;;###autoload
-(defun counsel-dpkg ()
-  "Call the \"dpkg\" shell command."
-  (interactive)
-  (let ((cands (mapcar
-                (lambda (x)
-                  (let ((y (split-string x "  +")))
-                    (cons (format "%-40s   %s"
-                                  (ivy--truncate-string
-                                   (nth 1 y) 40)
-                                  (nth 4 y))
-                          (mapconcat #'identity y " "))))
-                (split-string
-                 (shell-command-to-string "dpkg -l | tail -n+6") "\n" t))))
-    (ivy-read "dpkg: " cands
-              :action (lambda (x)
-                        (message (cdr x)))
-              :caller 'counsel-dpkg)))
-
-;;** `counsel-rpm'
-;;;###autoload
-(defun counsel-rpm ()
-  "Call the \"rpm\" shell command."
-  (interactive)
-  (let ((cands (mapcar
-                (lambda (x)
-                  (let ((y (split-string x "|")))
-                    (cons (format "%-40s   %s"
-                                  (ivy--truncate-string
-                                   (nth 0 y) 40)
-                                  (nth 1 y))
-                          (mapconcat #'identity y " "))))
-                (split-string
-                 (shell-command-to-string "rpm -qa --qf 
\"%{NAME}|%{SUMMARY}\\n\"") "\n" t))))
-    (ivy-read "rpm: " cands
-              :action (lambda (x)
-                        (message (cdr x)))
-              :caller 'counsel-rpm)))
-
-;;** File Jump and Dired Jump
-
-;;;###autoload
-(defun counsel-file-jump (&optional initial-input initial-directory)
-  "Jump to a file from a list of all files directories
-below the current one.  INITIAL-INPUT can be given as the initial
-minibuffer input.  INITIAL-DIRECTORY, if non-nil, is used as the
-root directory for search."
-  (interactive
-   (list nil
-         (when current-prefix-arg
-           (read-directory-name "From directory: "))))
-  (let* ((default-directory (or initial-directory default-directory)))
-    (ivy-read "Find file: "
-              (split-string
-               (shell-command-to-string "find * -type f -not -path '*\/.git*'")
-               "\n" t)
-              :matcher #'counsel--find-file-matcher
-              :initial-input initial-input
-              :action (lambda (x)
-                        (with-ivy-window
-                          (find-file (expand-file-name x ivy--directory))))
-              :preselect (when counsel-find-file-at-point
-                           (require 'ffap)
-                           (let ((f (ffap-guesser)))
-                             (when f (expand-file-name f))))
-              :require-match 'confirm-after-completion
-              :history 'file-name-history
-              :keymap counsel-find-file-map
-              :caller 'counsel-file-jump)))
-
-;;;###autoload
-(defun counsel-dired-jump (&optional initial-input initial-directory)
-  "Jump to a directory (in dired) from a list of all directories
-below the current one.  INITIAL-INPUT can be given as the initial
-minibuffer input.  INITIAL-DIRECTORY, if non-nil, is used as the
-root directory for search."
-  (interactive
-   (list nil
-         (when current-prefix-arg
-           (read-directory-name "From directory: "))))
-  (let* ((default-directory (or initial-directory default-directory)))
-    (ivy-read "Directory: "
-              (split-string
-               (shell-command-to-string "find * -type d -not -path '*\/.git*'")
-               "\n" t)
-              :initial-input initial-input
-              :action (lambda (d) (dired-jump nil (expand-file-name d)))
-              :caller 'counsel-dired-jump)))
-
-;;* Grep
-;;** `counsel-ag'
-(defvar counsel-ag-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-l") 'counsel-git-grep-recenter)
-    (define-key map (kbd "M-q") 'counsel-git-grep-query-replace)
-    map))
-
-(defcustom counsel-ag-base-command "ag --nocolor --nogroup %s"
-  "Format string to use in `counsel-ag-function' to construct the
-command. The %s will be replaced by optional extra ag arguments followed by the
-regex string. The default is \"ag --nocolor --nogroup %s\"."
-  :type 'string
-  :group 'ivy)
-
-(counsel-set-async-exit-code 'counsel-ag 1 "No matches found")
-(ivy-set-occur 'counsel-ag 'counsel-ag-occur)
-(ivy-set-display-transformer 'counsel-ag 'counsel-git-grep-transformer)
-
-(defun counsel-ag-function (string base-cmd extra-ag-args)
-  "Grep in the current directory for STRING.
-If non-nil, EXTRA-AG-ARGS string is appended to BASE-CMD."
-  (when (null extra-ag-args)
-    (setq extra-ag-args ""))
-  (if (< (length string) 3)
-      (counsel-more-chars 3)
-    (let ((default-directory counsel--git-grep-dir)
-          (regex (counsel-unquote-regex-parens
-                  (setq ivy--old-re
-                        (ivy--regex string)))))
-      (let* ((args-end (string-match " -- " extra-ag-args))
-             (file (if args-end
-                       (substring-no-properties extra-ag-args (+ args-end 3))
-                     ""))
-             (extra-ag-args (if args-end
-                                (substring-no-properties extra-ag-args 0 
args-end)
-                              extra-ag-args))
-             (ag-cmd (format base-cmd
-                             (concat extra-ag-args
-                                     " -- "
-                                     (shell-quote-argument regex)
-                                     file))))
-        (if (file-remote-p default-directory)
-            (split-string (shell-command-to-string ag-cmd) "\n" t)
-          (counsel--async-command ag-cmd)
-          nil)))))
-
-;;;###autoload
-(defun counsel-ag (&optional initial-input initial-directory extra-ag-args 
ag-prompt)
-  "Grep for a string in the current directory using ag.
-  INITIAL-INPUT can be given as the initial minibuffer input.
-  INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
-  EXTRA-AG-ARGS string, if non-nil, is appended to `counsel-ag-base-command'.
-  AG-PROMPT, if non-nil, is passed as `ivy-read' prompt argument. "
-  (interactive)
-  (when current-prefix-arg
-    (setq initial-directory
-          (or initial-directory
-              (read-directory-name (concat
-                                    (car (split-string 
counsel-ag-base-command))
-                                    " in directory: "))))
-    (setq extra-ag-args
-          (or extra-ag-args
-              (let* ((pos (cl-position ?  counsel-ag-base-command))
-                     (command (substring-no-properties counsel-ag-base-command 
0 pos))
-                     (ag-args (replace-regexp-in-string
-                               "%s" "" (substring-no-properties 
counsel-ag-base-command pos))))
-                (read-string (format "(%s) args:" command) ag-args)))))
-  (ivy-set-prompt 'counsel-ag counsel-prompt-function)
-  (setq counsel--git-grep-dir (or initial-directory default-directory))
-  (ivy-read (or ag-prompt (car (split-string counsel-ag-base-command)))
-            (lambda (string)
-              (counsel-ag-function string counsel-ag-base-command 
extra-ag-args))
-            :initial-input initial-input
-            :dynamic-collection t
-            :keymap counsel-ag-map
-            :history 'counsel-git-grep-history
-            :action #'counsel-git-grep-action
-            :unwind (lambda ()
-                      (counsel-delete-process)
-                      (swiper--cleanup))
-            :caller 'counsel-ag))
-
-(defun counsel-ag-occur ()
-  "Generate a custom occur buffer for `counsel-ag'."
-  (unless (eq major-mode 'ivy-occur-grep-mode)
-    (ivy-occur-grep-mode))
-  (setq default-directory counsel--git-grep-dir)
-  (let* ((regex (counsel-unquote-regex-parens
-                 (setq ivy--old-re
-                       (ivy--regex
-                        (progn (string-match "\"\\(.*\\)\"" (buffer-name))
-                               (match-string 1 (buffer-name)))))))
-         (cands (split-string
-                 (shell-command-to-string
-                  (format counsel-ag-base-command (shell-quote-argument 
regex)))
-                 "\n"
-                 t)))
-    ;; Need precise number of header lines for `wgrep' to work.
-    (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                    default-directory))
-    (insert (format "%d candidates:\n" (length cands)))
-    (ivy--occur-insert-lines
-     (mapcar
-      (lambda (cand) (concat "./" cand))
-      cands))))
-
-;;** `counsel-pt'
-(defcustom counsel-pt-base-command "pt --nocolor --nogroup -e %s"
-  "Used to in place of `counsel-ag-base-command' to search with
-pt using `counsel-ag'."
-  :type 'string
-  :group 'ivy)
-
-;;;###autoload
-(defun counsel-pt (&optional initial-input)
-  "Grep for a string in the current directory using pt.
-This uses `counsel-ag' with `counsel-pt-base-command' replacing
-`counsel-ag-base-command'."
-  (interactive)
-  (let ((counsel-ag-base-command counsel-pt-base-command))
-    (counsel-ag initial-input)))
-
-;;** `counsel-rg'
-(defcustom counsel-rg-base-command "rg -i --no-heading --line-number %s ."
-  "Used to in place of `counsel-rg-base-command' to search with
-ripgrep using `counsel-rg'."
-  :type 'string
-  :group 'ivy)
-
-(counsel-set-async-exit-code 'counsel-rg 1 "No matches found")
-(ivy-set-occur 'counsel-rg 'counsel-rg-occur)
-(ivy-set-display-transformer 'counsel-rg 'counsel-git-grep-transformer)
-
-;;;###autoload
-(defun counsel-rg (&optional initial-input initial-directory extra-rg-args 
rg-prompt)
-  "Grep for a string in the current directory using rg.
-INITIAL-INPUT can be given as the initial minibuffer input.
-INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
-EXTRA-RG-ARGS string, if non-nil, is appended to `counsel-rg-base-command'.
-RG-PROMPT, if non-nil, is passed as `ivy-read' prompt argument. "
-  (interactive
-   (list nil
-         (when current-prefix-arg
-           (read-directory-name (concat
-                                 (car (split-string counsel-rg-base-command))
-                                 " in directory: ")))))
-  (ivy-set-prompt 'counsel-rg counsel-prompt-function)
-  (setq counsel--git-grep-dir (or initial-directory default-directory))
-  (ivy-read (or rg-prompt (car (split-string counsel-rg-base-command)))
-            (lambda (string)
-              (counsel-ag-function string counsel-rg-base-command 
extra-rg-args))
-            :initial-input initial-input
-            :dynamic-collection t
-            :keymap counsel-ag-map
-            :history 'counsel-git-grep-history
-            :action #'counsel-git-grep-action
-            :unwind (lambda ()
-                      (counsel-delete-process)
-                      (swiper--cleanup))
-            :caller 'counsel-rg))
-
-(defun counsel-rg-occur ()
-  "Generate a custom occur buffer for `counsel-rg'."
-  (unless (eq major-mode 'ivy-occur-grep-mode)
-    (ivy-occur-grep-mode))
-  (setq default-directory counsel--git-grep-dir)
-  (let* ((regex (counsel-unquote-regex-parens
-                 (setq ivy--old-re
-                       (ivy--regex
-                        (progn (string-match "\"\\(.*\\)\"" (buffer-name))
-                               (match-string 1 (buffer-name)))))))
-         (cands (split-string
-                 (shell-command-to-string
-                  (format counsel-rg-base-command (shell-quote-argument 
regex)))
-                 "\n"
-                 t)))
-    ;; Need precise number of header lines for `wgrep' to work.
-    (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                    default-directory))
-    (insert (format "%d candidates:\n" (length cands)))
-    (ivy--occur-insert-lines
-     (mapcar
-      (lambda (cand) (concat "./" cand))
-      cands))))
-
-;;** `counsel-grep'
-(defcustom counsel-grep-base-command "grep -nE '%s' %s"
-  "Format string to use in `cousel-grep-function' to construct
-the command."
-  :type 'string
-  :group 'ivy)
-
-(defun counsel-grep-function (string)
-  "Grep in the current directory for STRING."
-  (if (< (length string) 2)
-      (counsel-more-chars 2)
-    (let ((regex (counsel-unquote-regex-parens
-                  (setq ivy--old-re
-                        (ivy--regex string)))))
-      (counsel--async-command
-       (format counsel-grep-base-command regex
-               (shell-quote-argument counsel--git-grep-dir)))
-      nil)))
-
-(defun counsel-grep-action (x)
-  (with-ivy-window
-    (swiper--cleanup)
-    (let ((default-directory (file-name-directory counsel--git-grep-dir))
-          file-name line-number)
-      (when (cond ((string-match "\\`\\([0-9]+\\):\\(.*\\)\\'" x)
-                   (setq file-name counsel--git-grep-dir)
-                   (setq line-number (match-string-no-properties 1 x)))
-                  ((string-match "\\`\\([^:]+\\):\\([0-9]+\\):\\(.*\\)\\'" x)
-                   (setq file-name (match-string-no-properties 1 x))
-                   (setq line-number (match-string-no-properties 2 x)))
-                  (t nil))
-        (find-file file-name)
-        (setq line-number (string-to-number line-number))
-        (if (null counsel-grep-last-line)
-            (progn
-              (goto-char (point-min))
-              (forward-line (1- (setq counsel-grep-last-line line-number))))
-          (forward-line (- line-number counsel-grep-last-line))
-          (setq counsel-grep-last-line line-number))
-        (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
-        (run-hooks 'counsel-grep-post-action-hook)
-        (if (eq ivy-exit 'done)
-            (swiper--ensure-visible)
-          (isearch-range-invisible (line-beginning-position)
-                                   (line-end-position))
-          (swiper--add-overlays (ivy--regex ivy-text)))))))
-
-(defun counsel-grep-occur ()
-  "Generate a custom occur buffer for `counsel-grep'."
-  (unless (eq major-mode 'ivy-occur-grep-mode)
-    (ivy-occur-grep-mode))
-  (let ((cands
-         (split-string
-          (shell-command-to-string
-           (format counsel-grep-base-command
-                   (counsel-unquote-regex-parens
-                    (setq ivy--old-re
-                          (ivy--regex
-                           (progn (string-match "\"\\(.*\\)\"" (buffer-name))
-                                  (match-string 1 (buffer-name))) t)))
-                   (shell-quote-argument counsel--git-grep-dir)))
-          "\n" t))
-        (file (file-name-nondirectory counsel--git-grep-dir)))
-    ;; Need precise number of header lines for `wgrep' to work.
-    (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                    default-directory))
-    (insert (format "%d candidates:\n" (length cands)))
-    (ivy--occur-insert-lines
-     (mapcar
-      (lambda (cand) (concat "./" file ":" cand))
-      cands))))
-
-(ivy-set-occur 'counsel-grep 'counsel-grep-occur)
-(counsel-set-async-exit-code 'counsel-grep 1 "")
-
-;;;###autoload
-(defun counsel-grep ()
-  "Grep for a string in the current file."
-  (interactive)
-  (setq counsel-grep-last-line nil)
-  (setq counsel--git-grep-dir (buffer-file-name))
-  (let ((init-point (point))
-        res)
-    (unwind-protect
-         (setq res (ivy-read "grep: " 'counsel-grep-function
-                             :dynamic-collection t
-                             :preselect (format "%d:%s"
-                                                (line-number-at-pos)
-                                                (regexp-quote
-                                                 
(buffer-substring-no-properties
-                                                  (line-beginning-position)
-                                                  (line-end-position))))
-                             :history 'counsel-git-grep-history
-                             :update-fn (lambda ()
-                                          (counsel-grep-action 
(ivy-state-current ivy-last)))
-                             :re-builder #'ivy--regex
-                             :action #'counsel-grep-action
-                             :unwind (lambda ()
-                                       (counsel-delete-process)
-                                       (swiper--cleanup))
-                             :caller 'counsel-grep))
-      (unless res
-        (goto-char init-point)))))
-
-;;** `counsel-grep-or-swiper'
-(defcustom counsel-grep-swiper-limit 300000
-  "When the buffer is larger than this, use `counsel-grep' instead of 
`swiper'."
-  :type 'integer
-  :group 'ivy)
-
-(defvar counsel-compressed-file-regex
-  (progn
-    (require 'jka-compr nil t)
-    (jka-compr-build-file-regexp))
-  "Store the regex for compressed file names.")
-
-;;;###autoload
-(defun counsel-grep-or-swiper ()
-  "Call `swiper' for small buffers and `counsel-grep' for large ones."
-  (interactive)
-  (if (and (buffer-file-name)
-           (not (buffer-narrowed-p))
-           (not (ignore-errors
-                  (file-remote-p (buffer-file-name))))
-           (not (string-match
-                 counsel-compressed-file-regex
-                 (buffer-file-name)))
-           (> (buffer-size)
-              (if (eq major-mode 'org-mode)
-                  (/ counsel-grep-swiper-limit 4)
-                counsel-grep-swiper-limit)))
-      (progn
-        (save-buffer)
-        (counsel-grep))
-    (swiper--ivy (swiper--candidates))))
-
-;;** `counsel-recoll'
-(defun counsel-recoll-function (string)
-  "Run recoll for STRING."
-  (if (< (length string) 3)
-      (counsel-more-chars 3)
-    (counsel--async-command
-     (format "recoll -t -b %s"
-             (shell-quote-argument string)))
-    nil))
-
-;; This command uses the recollq command line tool that comes together
-;; with the recoll (the document indexing database) source:
-;;     http://www.lesbonscomptes.com/recoll/download.html
-;; You need to build it yourself (together with recoll):
-;;     cd ./query && make && sudo cp recollq /usr/local/bin
-;; You can try the GUI version of recoll with:
-;;     sudo apt-get install recoll
-;; Unfortunately, that does not install recollq.
-(defun counsel-recoll (&optional initial-input)
-  "Search for a string in the recoll database.
-You'll be given a list of files that match.
-Selecting a file will launch `swiper' for that file.
-INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive)
-  (ivy-read "recoll: " 'counsel-recoll-function
-            :initial-input initial-input
-            :dynamic-collection t
-            :history 'counsel-git-grep-history
-            :action (lambda (x)
-                      (when (string-match "file://\\(.*\\)\\'" x)
-                        (let ((file-name (match-string 1 x)))
-                          (find-file file-name)
-                          (unless (string-match "pdf$" x)
-                            (swiper ivy-text)))))
-            :unwind #'counsel-delete-process
-            :caller 'counsel-recoll))
-;;* Misc Emacs
-;;** `counsel-org-tag'
-(defvar counsel-org-tags nil
-  "Store the current list of tags.")
-
-(defvar org-outline-regexp)
-(defvar org-indent-mode)
-(defvar org-indent-indentation-per-level)
-(defvar org-tags-column)
-(declare-function org-get-tags-string "org")
-(declare-function org-move-to-column "org-compat")
-
-(defun counsel-org-change-tags (tags)
-  (let ((current (org-get-tags-string))
-        (col (current-column))
-        level)
-    ;; Insert new tags at the correct column
-    (beginning-of-line 1)
-    (setq level (or (and (looking-at org-outline-regexp)
-                         (- (match-end 0) (point) 1))
-                    1))
-    (cond
-      ((and (equal current "") (equal tags "")))
-      ((re-search-forward
-        (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$")
-        (point-at-eol) t)
-       (if (equal tags "")
-           (delete-region
-            (match-beginning 0)
-            (match-end 0))
-         (goto-char (match-beginning 0))
-         (let* ((c0 (current-column))
-                ;; compute offset for the case of org-indent-mode active
-                (di (if (bound-and-true-p org-indent-mode)
-                        (* (1- org-indent-indentation-per-level) (1- level))
-                      0))
-                (p0 (if (equal (char-before) ?*) (1+ (point)) (point)))
-                (tc (+ org-tags-column (if (> org-tags-column 0) (- di) di)))
-                (c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (string-width 
tags)))))
-                (rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags)))
-           (replace-match rpl t t)
-           (and c0 indent-tabs-mode (tabify p0 (point)))
-           tags)))
-      (t (error "Tags alignment failed")))
-    (org-move-to-column col)))
-
-(defun counsel-org--set-tags ()
-  (counsel-org-change-tags
-   (if counsel-org-tags
-       (format ":%s:"
-               (mapconcat #'identity counsel-org-tags ":"))
-     "")))
-
-(defvar org-agenda-bulk-marked-entries)
-
-(declare-function org-get-at-bol "org")
-(declare-function org-agenda-error "org-agenda")
-
-(defun counsel-org-tag-action (x)
-  (if (member x counsel-org-tags)
-      (progn
-        (setq counsel-org-tags (delete x counsel-org-tags)))
-    (unless (equal x "")
-      (setq counsel-org-tags (append counsel-org-tags (list x)))
-      (unless (member x ivy--all-candidates)
-        (setq ivy--all-candidates (append ivy--all-candidates (list x))))))
-  (let ((prompt (counsel-org-tag-prompt)))
-    (setf (ivy-state-prompt ivy-last) prompt)
-    (setq ivy--prompt (concat "%-4d " prompt)))
-  (cond ((memq this-command '(ivy-done
-                              ivy-alt-done
-                              ivy-immediate-done))
-         (if (eq major-mode 'org-agenda-mode)
-             (if (null org-agenda-bulk-marked-entries)
-                 (let ((hdmarker (or (org-get-at-bol 'org-hd-marker)
-                                     (org-agenda-error))))
-                   (with-current-buffer (marker-buffer hdmarker)
-                     (goto-char hdmarker)
-                     (counsel-org--set-tags)))
-               (let ((add-tags (copy-sequence counsel-org-tags)))
-                 (dolist (m org-agenda-bulk-marked-entries)
-                   (with-current-buffer (marker-buffer m)
-                     (save-excursion
-                       (goto-char m)
-                       (setq counsel-org-tags
-                             (delete-dups
-                              (append (split-string (org-get-tags-string) ":" 
t)
-                                      add-tags)))
-                       (counsel-org--set-tags))))))
-           (counsel-org--set-tags)))
-        ((eq this-command 'ivy-call)
-         (with-selected-window (active-minibuffer-window)
-           (delete-minibuffer-contents)))))
-
-(defun counsel-org-tag-prompt ()
-  (format "Tags (%s): "
-          (mapconcat #'identity counsel-org-tags ", ")))
-
-(defvar org-setting-tags)
-(defvar org-last-tags-completion-table)
-(defvar org-tag-persistent-alist)
-(defvar org-tag-alist)
-(defvar org-complete-tags-always-offer-all-agenda-tags)
-
-(declare-function org-at-heading-p "org")
-(declare-function org-back-to-heading "org")
-(declare-function org-get-buffer-tags "org")
-(declare-function org-global-tags-completion-table "org")
-(declare-function org-agenda-files "org")
-(declare-function org-agenda-set-tags "org-agenda")
-
-;;;###autoload
-(defun counsel-org-tag ()
-  "Add or remove tags in org-mode."
-  (interactive)
-  (save-excursion
-    (if (eq major-mode 'org-agenda-mode)
-        (if org-agenda-bulk-marked-entries
-            (setq counsel-org-tags nil)
-          (let ((hdmarker (or (org-get-at-bol 'org-hd-marker)
-                              (org-agenda-error))))
-            (with-current-buffer (marker-buffer hdmarker)
-              (goto-char hdmarker)
-              (setq counsel-org-tags
-                    (split-string (org-get-tags-string) ":" t)))))
-      (unless (org-at-heading-p)
-        (org-back-to-heading t))
-      (setq counsel-org-tags (split-string (org-get-tags-string) ":" t)))
-    (let ((org-setting-tags t)
-          (org-last-tags-completion-table
-           (append org-tag-persistent-alist
-                   (or org-tag-alist (org-get-buffer-tags))
-                   (and
-                    (or org-complete-tags-always-offer-all-agenda-tags
-                        (eq major-mode 'org-agenda-mode))
-                    (org-global-tags-completion-table
-                     (org-agenda-files))))))
-      (ivy-read (counsel-org-tag-prompt)
-                (lambda (str &rest _unused)
-                  (delete-dups
-                   (all-completions str 'org-tags-completion-function)))
-                :history 'org-tags-history
-                :action 'counsel-org-tag-action
-                :caller 'counsel-org-tag))))
-
-;;;###autoload
-(defun counsel-org-tag-agenda ()
-  "Set tags for the current agenda item."
-  (interactive)
-  (let ((store (symbol-function 'org-set-tags)))
-    (unwind-protect
-         (progn
-           (fset 'org-set-tags
-                 (symbol-function 'counsel-org-tag))
-           (org-agenda-set-tags nil nil))
-      (fset 'org-set-tags store))))
-
-;;** `counsel-mark-ring'
-(defun counsel--pad (string length)
-  "Pad string to length with spaces."
-  (let ((padding (max 0 (- length (length string)))))
-    (concat string (make-string padding ?\s))))
-
-(defun counsel-mark-ring ()
-  "Browse `mark-ring' interactively."
-  (interactive)
-  (let ((candidates
-         (with-current-buffer (current-buffer)
-           (let ((padding (length (format "%s: " (line-number-at-pos 
(eobp))))))
-             (save-mark-and-excursion
-              (goto-char (point-min))
-              (mapcar (lambda (mark)
-                        (let* ((position (marker-position mark))
-                               (line-number (line-number-at-pos position))
-                               (line-marker (counsel--pad (format "%s:" 
line-number) padding))
-                               (bol (point-at-bol line-number))
-                               (eol (point-at-eol line-number))
-                               (line (buffer-substring bol eol)))
-                          (cons (format "%s%s" line-marker line) position)))
-                      (cl-remove-duplicates mark-ring :test #'equal)))))))
-    (ivy-read "Marks: " candidates
-              :action (lambda (elem)
-                        (goto-char (cdr elem))))))
-
-;;** `counsel-package'
-(defvar package--initialized)
-(defvar package-archive-contents)
-(declare-function package-installed-p "package")
-(declare-function package-delete "package")
-
-(defun counsel-package ()
-  "Install or delete packages.
-
-Packages not currently installed have a \"+\"
-prepended. Selecting one of these will try to install
-it. Currently installed packages have a \"-\" prepended, and
-selecting one of these will delete the package.
-
-Additional Actions:
-
-  \\<ivy-minibuffer-map>\\[ivy-dispatching-done] d: describe package"
-  (interactive)
-  (unless package--initialized
-    (package-initialize t))
-  (unless package-archive-contents
-    (package-refresh-contents))
-  (let ((cands (mapcar #'counsel-package-make-package-cell
-                       package-archive-contents)))
-    (ivy-read "Packages (install +pkg or delete -pkg): "
-              (cl-sort cands #'counsel--package-sort)
-              :action #'counsel-package-action
-              :initial-input "^+ "
-              :require-match t
-              :caller 'counsel-package)))
-
-(defun counsel-package-make-package-cell (pkg)
-  (let* ((pkg-sym (car pkg))
-         (pkg-name (symbol-name pkg-sym)))
-    (cons (format "%s%s"
-                  (if (package-installed-p pkg-sym) "-" "+")
-                  pkg-name)
-          pkg)))
-
-(defun counsel-package-action (pkg-cons)
-  (let ((pkg (cadr pkg-cons)))
-    (if (package-installed-p pkg)
-        (package-delete pkg)
-      (package-install pkg))))
-
-(defun counsel-package-action-describe (pkg-cons)
-  "Call `describe-package' for package in PKG-CONS."
-  (describe-package (cadr pkg-cons)))
-
-(declare-function package-desc-extras "package")
-
-(defun counsel-package-action-homepage (pkg-cons)
-  "Open homepage for package in PKG-CONS."
-  (let* ((desc-list (cddr pkg-cons))
-         (desc (if (listp desc-list) (car desc-list) desc-list))
-         (url (cdr (assoc :url (package-desc-extras desc)))))
-    (when url
-      (require 'browse-url)
-      (browse-url url))))
-
-(defun counsel--package-sort (a b)
-  "Sort function for `counsel-package'."
-  (let* ((a (car a))
-         (b (car b))
-         (a-inst (equal (substring a 0 1) "+"))
-         (b-inst (equal (substring b 0 1) "+")))
-    (or (and a-inst (not b-inst))
-        (and (eq a-inst b-inst) (string-lessp a b)))))
-
-(ivy-set-actions 'counsel-package
-                 '(("d" counsel-package-action-describe "describe package")
-                   ("h" counsel-package-action-homepage "open package 
homepage")))
-
-;;** `counsel-tmm'
-(defvar tmm-km-list nil)
-(declare-function tmm-get-keymap "tmm")
-(declare-function tmm--completion-table "tmm")
-(declare-function tmm-get-keybind "tmm")
-
-(defun counsel-tmm-prompt (menu)
-  "Select and call an item from the MENU keymap."
-  (let (out
-        choice
-        chosen-string)
-    (setq tmm-km-list nil)
-    (map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu)
-    (setq tmm-km-list (nreverse tmm-km-list))
-    (setq out (ivy-read "Menu bar: " (tmm--completion-table tmm-km-list)
-                        :require-match t
-                        :sort nil))
-    (setq choice (cdr (assoc out tmm-km-list)))
-    (setq chosen-string (car choice))
-    (setq choice (cdr choice))
-    (cond ((keymapp choice)
-           (counsel-tmm-prompt choice))
-          ((and choice chosen-string)
-           (setq last-command-event chosen-string)
-           (call-interactively choice)))))
-
-(defvar tmm-table-undef)
-
-;;;###autoload
-(defun counsel-tmm ()
-  "Text-mode emulation of looking and choosing from a menubar."
-  (interactive)
-  (require 'tmm)
-  (run-hooks 'menu-bar-update-hook)
-  (setq tmm-table-undef nil)
-  (counsel-tmm-prompt (tmm-get-keybind [menu-bar])))
-
-;;** `counsel-yank-pop'
-(defun counsel--yank-pop-truncate (str)
-  (condition-case nil
-      (let* ((lines (split-string str "\n" t))
-             (n (length lines))
-             (first-match (cl-position-if
-                           (lambda (s) (string-match ivy--old-re s))
-                           lines))
-             (beg (max 0 (- first-match
-                            counsel-yank-pop-truncate-radius)))
-             (end (min n (+ first-match
-                            counsel-yank-pop-truncate-radius
-                            1)))
-             (seq (cl-subseq lines beg end)))
-        (if (null first-match)
-            (error "Could not match %s" str)
-          (when (> beg 0)
-            (setcar seq (concat "[...] " (car seq))))
-          (when (< end n)
-            (setcar (last seq)
-                    (concat (car (last seq)) " [...]")))
-          (mapconcat #'identity seq "\n")))
-    (error str)))
-
-(defcustom counsel-yank-pop-separator "\n"
-  "Separator for the kill ring strings in `counsel-yank-pop'."
-  :group 'ivy
-  :type 'string)
-
-(defun counsel--yank-pop-format-function (cand-pairs)
-  (ivy--format-function-generic
-   (lambda (str)
-     (mapconcat
-      (lambda (s)
-        (ivy--add-face s 'ivy-current-match))
-      (split-string
-       (counsel--yank-pop-truncate str) "\n" t)
-      "\n"))
-   (lambda (str)
-     (counsel--yank-pop-truncate str))
-   cand-pairs
-   counsel-yank-pop-separator))
-
-(defun counsel-yank-pop-action (s)
-  "Insert S into the buffer, overwriting the previous yank."
-  (with-ivy-window
-    (delete-region ivy-completion-beg
-                   ivy-completion-end)
-    (insert (substring-no-properties s))
-    (setq ivy-completion-end (point))))
-
-;;;###autoload
-(defun counsel-yank-pop ()
-  "Ivy replacement for `yank-pop'."
-  (interactive)
-  (if (eq last-command 'yank)
-      (progn
-        (setq ivy-completion-end (point))
-        (setq ivy-completion-beg
-              (save-excursion
-                (search-backward (car kill-ring))
-                (point))))
-    (setq ivy-completion-beg (point))
-    (setq ivy-completion-end (point)))
-  (let ((candidates
-         (mapcar #'ivy-cleanup-string
-                 (cl-remove-if
-                  (lambda (s)
-                    (or (< (length s) 3)
-                        (string-match "\\`[\n[:blank:]]+\\'" s)))
-                  (delete-dups kill-ring)))))
-    (let ((ivy-format-function #'counsel--yank-pop-format-function)
-          (ivy-height 5))
-      (ivy-read "kill-ring: " candidates
-                :action 'counsel-yank-pop-action
-                :caller 'counsel-yank-pop))))
-
-;;** `counsel-imenu'
-(defvar imenu-auto-rescan)
-(defvar imenu-auto-rescan-maxout)
-(declare-function imenu--subalist-p "imenu")
-(declare-function imenu--make-index-alist "imenu")
-
-(defun counsel-imenu-get-candidates-from (alist &optional prefix)
-  "Create a list of (key . value) from ALIST.
-PREFIX is used to create the key."
-  (cl-mapcan (lambda (elm)
-               (if (imenu--subalist-p elm)
-                   (counsel-imenu-get-candidates-from
-                    (cl-loop for (e . v) in (cdr elm) collect
-                         (cons e (if (integerp v) (copy-marker v) v)))
-                    ;; pass the prefix to next recursive call
-                    (concat prefix (if prefix ".") (car elm)))
-                 (let ((key (concat
-                             (when prefix
-                               (concat
-                                (propertize prefix 'face 'compilation-info)
-                                ": "))
-                             (car elm))))
-                   (list (cons key
-                               ;; create a imenu candidate here
-                               (cons key (if (overlayp (cdr elm))
-                                             (overlay-start (cdr elm))
-                                           (cdr elm))))))))
-             alist))
-
-;;;###autoload
-(defun counsel-imenu ()
-  "Jump to a buffer position indexed by imenu."
-  (interactive)
-  (unless (featurep 'imenu)
-    (require 'imenu nil t))
-  (let* ((imenu-auto-rescan t)
-         (imenu-auto-rescan-maxout (if current-prefix-arg
-                                       (buffer-size)
-                                     imenu-auto-rescan-maxout))
-         (items (imenu--make-index-alist t))
-         (items (delete (assoc "*Rescan*" items) items)))
-    (ivy-read "imenu items:" (counsel-imenu-get-candidates-from items)
-              :preselect (thing-at-point 'symbol)
-              :require-match t
-              :action (lambda (candidate)
-                        (with-ivy-window
-                          ;; In org-mode, (imenu candidate) will expand child 
node
-                          ;; after jump to the candidate position
-                          (imenu (cdr candidate))))
-              :caller 'counsel-imenu)))
-
-;;** `counsel-list-processes'
-(defun counsel-list-processes-action-delete (x)
-  (delete-process x)
-  (setf (ivy-state-collection ivy-last)
-        (setq ivy--all-candidates
-              (delete x ivy--all-candidates))))
-
-(defun counsel-list-processes-action-switch (x)
-  (let* ((proc (get-process x))
-         (buf (and proc (process-buffer proc))))
-    (if buf
-        (switch-to-buffer buf)
-      (message "Process %s doesn't have a buffer" x))))
-
-;;;###autoload
-(defun counsel-list-processes ()
-  "Offer completion for `process-list'
-The default action deletes the selected process.
-An extra action allows to switch to the process buffer."
-  (interactive)
-  (list-processes--refresh)
-  (ivy-read "Process: " (mapcar #'process-name (process-list))
-            :require-match t
-            :action
-            '(1
-              ("o" counsel-list-processes-action-delete "kill")
-              ("s" counsel-list-processes-action-switch "switch"))
-            :caller 'counsel-list-processes))
-
-;;** `counsel-ace-link'
-(defun counsel-ace-link ()
-  "Use Ivy completion for `ace-link'."
-  (interactive)
-  (let (collection action)
-    (cond ((eq major-mode 'Info-mode)
-           (setq collection 'ace-link--info-collect)
-           (setq action 'ace-link--info-action))
-          ((eq major-mode 'help-mode)
-           (setq collection 'ace-link--help-collect)
-           (setq action 'ace-link--help-action))
-          ((eq major-mode 'woman-mode)
-           (setq collection 'ace-link--woman-collect)
-           (setq action 'ace-link--woman-action))
-          ((eq major-mode 'eww-mode)
-           (setq collection 'ace-link--eww-collect)
-           (setq action 'ace-link--eww-action))
-          ((eq major-mode 'compilation-mode)
-           (setq collection 'ace-link--eww-collect)
-           (setq action 'ace-link--compilation-action))
-          ((eq major-mode 'org-mode)
-           (setq collection 'ace-link--org-collect)
-           (setq action 'ace-link--org-action)))
-    (if (null collection)
-        (error "%S is not supported" major-mode)
-      (ivy-read "Ace-Link: " (funcall collection)
-                :action (lambda (x) (funcall action (cdr x)))
-                :require-match t
-                :caller 'counsel-ace-link))))
-;;** `counsel-expression-history'
-;;;###autoload
-(defun counsel-expression-history ()
-  "Select an element of `read-expression-history'.
-And insert it into the minibuffer. Useful during
-`eval-expression'"
-  (interactive)
-  (let ((enable-recursive-minibuffers t))
-    (ivy-read "Expr: " (delete-dups read-expression-history)
-              :action #'insert)))
-
-;;** `counsel-shell-command-history'
-;;;###autoload
-(defun counsel-shell-command-history ()
-  (interactive)
-  (ivy-read "cmd: " shell-command-history
-            :action #'insert
-            :caller 'counsel-shell-command-history))
-
-;;** `counsel-esh-history'
-(defun counsel--browse-history (elements)
-  "Use Ivy to navigate through ELEMENTS."
-  (setq ivy-completion-beg (point))
-  (setq ivy-completion-end (point))
-  (ivy-read "Symbol name: "
-            (delete-dups
-             (ring-elements elements))
-            :action #'ivy-completion-in-region-action))
-
-(defvar eshell-history-ring)
-
-;;;###autoload
-(defun counsel-esh-history ()
-  "Browse Eshell history."
-  (interactive)
-  (require 'em-hist)
-  (counsel--browse-history eshell-history-ring))
-
-(defvar comint-input-ring)
-
-;;;###autoload
-(defun counsel-shell-history ()
-  "Browse shell history."
-  (interactive)
-  (require 'comint)
-  (counsel--browse-history comint-input-ring))
-
-;;** `counsel-hydra-heads'
-(defvar hydra-curr-body-fn)
-(declare-function hydra-keyboard-quit "ext:hydra")
-
-(defun counsel-hydra-heads ()
-  "Call a head of the current/last hydra."
-  (interactive)
-  (let* ((base (substring
-                (prin1-to-string hydra-curr-body-fn)
-                0 -4))
-         (heads (eval (intern (concat base "heads"))))
-         (keymap (eval (intern (concat base "keymap"))))
-         (head-names
-          (mapcar (lambda (x)
-                    (cons
-                     (if (nth 2 x)
-                         (format "[%s] %S (%s)" (nth 0 x) (nth 1 x) (nth 2 x))
-                       (format "[%s] %S" (nth 0 x) (nth 1 x)))
-                     (lookup-key keymap (kbd (nth 0 x)))))
-                  heads)))
-    (ivy-read "head: " head-names
-              :action (lambda (x) (call-interactively (cdr x))))
-    (hydra-keyboard-quit)))
-;;** `counsel-semantic'
-(declare-function semantic-tag-start "tag")
-(declare-function semantic-tag-of-class-p "tag")
-(declare-function semantic-fetch-tags "semantic")
-
-(defun counsel-semantic-action (tag)
-  (with-ivy-window
-    (goto-char (semantic-tag-start tag))))
-
-(defun counsel-semantic ()
-  "Jump to a semantic tag in the current buffer."
-  (interactive)
-  (let ((tags
-         (mapcar
-          (lambda (tag)
-            (if (semantic-tag-of-class-p tag 'function)
-                (cons
-                 (propertize
-                  (car tag)
-                  'face 'font-lock-function-name-face)
-                 (cdr tag))
-              tag))
-          (semantic-fetch-tags))))
-    (ivy-read "tag: " tags
-              :action 'counsel-semantic-action)))
-
-;;** `counsel-outline'
-(defun counsel-outline-candidates ()
-  (let (cands)
-    (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward outline-regexp nil t)
-        (skip-chars-forward " ")
-        (push (cons (buffer-substring-no-properties
-                     (point) (line-end-position))
-                    (line-beginning-position))
-              cands))
-      (nreverse cands))))
-
-(defun counsel-outline-action (x)
-  (with-ivy-window
-    (goto-char (cdr x))))
-
-(defun counsel-outline ()
-  "Jump to outline with completion."
-  (interactive)
-  (ivy-read "outline: " (counsel-outline-candidates)
-            :action #'counsel-outline-action))
-
-;;* Misc OS
-;;** `counsel-rhythmbox'
-(declare-function dbus-call-method "dbus")
-(declare-function dbus-get-property "dbus")
-
-(defun counsel-rhythmbox-play-song (song)
-  "Let Rhythmbox play SONG."
-  (let ((service "org.gnome.Rhythmbox3")
-        (path "/org/mpris/MediaPlayer2")
-        (interface "org.mpris.MediaPlayer2.Player"))
-    (dbus-call-method :session service path interface
-                      "OpenUri" (cdr song))))
-
-(defun counsel-rhythmbox-enqueue-song (song)
-  "Let Rhythmbox enqueue SONG."
-  (let ((service "org.gnome.Rhythmbox3")
-        (path "/org/gnome/Rhythmbox3/PlayQueue")
-        (interface "org.gnome.Rhythmbox3.PlayQueue"))
-    (dbus-call-method :session service path interface
-                      "AddToQueue" (cdr song))))
-
-(defvar counsel-rhythmbox-history nil
-  "History for `counsel-rhythmbox'.")
-
-(defvar counsel-rhythmbox-songs nil)
-
-(defun counsel-rhythmbox-current-song ()
-  "Return the currently playing song title."
-  (ignore-errors
-    (let* ((entry (dbus-get-property
-                   :session
-                   "org.mpris.MediaPlayer2.rhythmbox"
-                   "/org/mpris/MediaPlayer2"
-                   "org.mpris.MediaPlayer2.Player"
-                   "Metadata"))
-           (artist (caar (cadr (assoc "xesam:artist" entry))))
-           (album (cl-caadr (assoc "xesam:album" entry)))
-           (title (cl-caadr (assoc "xesam:title" entry))))
-      (format "%s - %s - %s" artist album title))))
-
-;;;###autoload
-(defun counsel-rhythmbox ()
-  "Choose a song from the Rhythmbox library to play or enqueue."
-  (interactive)
-  (require 'dbus)
-  (unless counsel-rhythmbox-songs
-    (let* ((service "org.gnome.Rhythmbox3")
-           (path "/org/gnome/UPnP/MediaServer2/Library/all")
-           (interface "org.gnome.UPnP.MediaContainer2")
-           (nb-songs (dbus-get-property
-                      :session service path interface "ChildCount")))
-      (if (not nb-songs)
-          (error "Couldn't connect to Rhythmbox")
-        (setq counsel-rhythmbox-songs
-              (mapcar (lambda (x)
-                        (cons
-                         (format
-                          "%s - %s - %s"
-                          (cl-caadr (assoc "Artist" x))
-                          (cl-caadr (assoc "Album" x))
-                          (cl-caadr (assoc "DisplayName" x)))
-                         (cl-caaadr (assoc "URLs" x))))
-                      (dbus-call-method
-                       :session service path interface "ListChildren"
-                       0 nb-songs '("*")))))))
-  (ivy-read "Rhythmbox: " counsel-rhythmbox-songs
-            :history 'counsel-rhythmbox-history
-            :preselect (counsel-rhythmbox-current-song)
-            :action
-            '(1
-              ("p" counsel-rhythmbox-play-song "Play song")
-              ("e" counsel-rhythmbox-enqueue-song "Enqueue song"))
-            :caller 'counsel-rhythmbox))
-
-;;** `counsel-linux-app'
-(defvar counsel-linux-apps-alist nil
-  "List of data located in /usr/share/applications.")
-
-(defvar counsel-linux-apps-faulty nil
-  "List of faulty data located in /usr/share/applications.")
-
-(defcustom counsel-linux-apps-directories
-  '("/usr/local/share/applications/" "/usr/share/applications/")
-  "Directories in which to search for applications (.desktop files)."
-  :group 'counsel
-  :type '(list directory))
-
-(defun counsel-linux-apps-list ()
-  (let ((files (apply 'append
-                      (mapcar
-                       (lambda (dir)
-                         (when (file-exists-p dir)
-                           (directory-files dir t ".*\\.desktop$")))
-                       counsel-linux-apps-directories))))
-    (dolist (file (cl-set-difference files (append (mapcar 'car 
counsel-linux-apps-alist)
-                                                   counsel-linux-apps-faulty)
-                                     :test 'equal))
-      (with-temp-buffer
-        (insert-file-contents file)
-        (let (name comment exec)
-          (goto-char (point-min))
-          (if (null (re-search-forward "^Name *= *\\(.*\\)$" nil t))
-              (message "Warning: File %s has no Name" file)
-            (setq name (match-string 1))
-            (goto-char (point-min))
-            (when (re-search-forward "^Comment *= *\\(.*\\)$" nil t)
-              (setq comment (match-string 1)))
-            (goto-char (point-min))
-            (when (re-search-forward "^Exec *= *\\(.*\\)$" nil t)
-              (setq exec (match-string 1)))
-            (if (and exec (not (equal exec "")))
-                (add-to-list
-                 'counsel-linux-apps-alist
-                 (cons (format "% -45s: %s%s"
-                               (propertize exec 'face 'font-lock-builtin-face)
-                               name
-                               (if comment
-                                   (concat " - " comment)
-                                 ""))
-                       file))
-              (add-to-list 'counsel-linux-apps-faulty file)))))))
-  counsel-linux-apps-alist)
-
-(defun counsel-linux-app-action-default (desktop-shortcut)
-  "Launch DESKTOP-SHORTCUT."
-  (setq desktop-shortcut (cdr desktop-shortcut))
-  (call-process-shell-command
-   (format "gtk-launch %s" (file-name-nondirectory desktop-shortcut))))
-
-(defun counsel-linux-app-action-file (desktop-shortcut)
-  "Launch DESKTOP-SHORTCUT with a selected file."
-  (setq desktop-shortcut (cdr desktop-shortcut))
-  (let* ((entry (rassoc desktop-shortcut counsel-linux-apps-alist))
-         (short-name (and entry
-                          (string-match "\\([^ ]*\\) " (car entry))
-                          (match-string 1 (car entry))))
-         (file (and short-name
-                    (read-file-name
-                     (format "Run %s on: " short-name)))))
-    (if file
-        (call-process-shell-command
-         (format "gtk-launch %s \"%s\""
-                 (file-name-nondirectory desktop-shortcut)
-                 file))
-      (user-error "cancelled"))))
-
-(ivy-set-actions
- 'counsel-linux-app
- '(("f" counsel-linux-app-action-file "run on a file")))
-
-;;;###autoload
-(defun counsel-linux-app ()
-  "Launch a Linux desktop application, similar to Alt-<F2>."
-  (interactive)
-  (ivy-read "Run a command: " (counsel-linux-apps-list)
-            :action #'counsel-linux-app-action-default
-            :caller 'counsel-linux-app))
-
-(defvar company-candidates)
-(defvar company-point)
-(defvar company-common)
-(declare-function company-complete "ext:company")
-(declare-function company-mode "ext:company")
-(declare-function company-complete-common "ext:company")
-
-;;;###autoload
-(defun counsel-company ()
-  "Complete using `company-candidates'."
-  (interactive)
-  (company-mode 1)
-  (unless company-candidates
-    (company-complete))
-  (when company-point
-    (company-complete-common)
-    (when (looking-back company-common (line-beginning-position))
-      (setq ivy-completion-beg (match-beginning 0))
-      (setq ivy-completion-end (match-end 0)))
-    (ivy-read "company cand: " company-candidates
-              :action #'ivy-completion-in-region-action)))
-
-;;;** `counsel-colors'
-(defun counsel-colors--best-contrast-color (color)
-  "Choose the best-contrast foreground color for a background color COLOR.
-
-Use the relative luminance formula to improve the perceived contrast.
-If the relative luminance is beyond a given threshold, in this case a
-midpoint, then the chosen color is black, otherwise is white.  This
-helps to improve the contrast and readability of a text regardless of
-the background color."
-  (let ((rgb (color-name-to-rgb color)))
-    (if rgb
-        (if (>
-             (+ (* (nth 0 rgb) 0.299)
-                (* (nth 1 rgb) 0.587)
-                (* (nth 2 rgb) 0.114))
-             0.5)
-            "#000000"
-          "#FFFFFF")
-      color)))
-
-(defun counsel-colors--update-highlight (cand)
-  "Update the highlight face for the current candidate CAND.
-
-This is necessary because the default `ivy-current-match' face
-background mask most of the colors and you can not see the current
-candidate color when is selected, which is counter-intuitive and not
-user friendly.  The default Emacs command `list-colors-display' have
-the same problem."
-  (when (> (length cand) 0)
-    (let ((color (substring-no-properties cand 26 33)))
-      (face-remap-add-relative
-       'ivy-current-match
-       :background color
-       ;; Another alternatives like use the attribute
-       ;; `distant-foreground' or the function `color-complement-hex'
-       ;; do not work well here because they use the absolute
-       ;; luminance difference between the colors, when the human eye
-       ;; does not perceive all the colors with the same brightness.
-       :foreground (counsel-colors--best-contrast-color color)))))
-
-(defun counsel-colors-action-insert-name (x)
-  "Insert the X color name."
-  (let ((color (car (split-string (substring x 0 25)))))
-    (insert color)))
-
-(defun counsel-colors-action-insert-hex (x)
-  "Insert the X color hexadecimal rgb value."
-  (let ((rgb (substring x 26 33)))
-    (insert rgb)))
-
-(defun counsel-colors-action-kill-name (x)
-  "Kill the X color name."
-  (let ((color (car (split-string (substring x 0 25)))))
-    (kill-new color)))
-
-(defun counsel-colors-action-kill-hex (x)
-  "Kill the X color hexadecimal rgb value."
-  (let ((rgb (substring x 26 33)))
-    (kill-new rgb)))
-
-;;** `counsel-colors-emacs'
-(ivy-set-actions
- 'counsel-colors-emacs
- '(("n" counsel-colors-action-insert-name "insert color name")
-   ("h" counsel-colors-action-insert-hex "insert color hexadecimal value")
-   ("N" counsel-colors-action-kill-name "kill color name")
-   ("H" counsel-colors-action-kill-hex "kill color hexadecimal value")))
-
-(defvar counsel-colors-emacs-history nil
-  "History for `counsel-colors-emacs'.")
-
-(defun counsel-colors--name-to-hex (color)
-  "Return hexadecimal rgb value of a color from his name COLOR."
-  (apply 'color-rgb-to-hex (color-name-to-rgb color)))
-
-;;;###autoload
-(defun counsel-colors-emacs ()
-  "Show a list of all supported colors for a particular frame.
-
-You can insert or kill the name or the hexadecimal rgb value of the
-selected candidate."
-  (interactive)
-  (let ((minibuffer-allow-text-properties t))
-    (ivy-read "%d Emacs color: "
-              (mapcar (lambda (x)
-                        (concat
-                         (propertize
-                          (format "%-25s" (car x))
-                          'result (car x))
-                         (propertize
-                          (format "%8s  "
-                                  (counsel-colors--name-to-hex (car x)))
-                          'face (list :foreground (car x)))
-                         (propertize
-                          (format "%10s" " ")
-                          'face (list :background (car x)))
-                         (propertize
-                          (format "  %-s" (mapconcat #'identity (cdr x) ", "))
-                          'face (list :foreground (car x)))))
-                      (list-colors-duplicates))
-              :require-match t
-              :update-fn (lambda ()
-                           (counsel-colors--update-highlight 
(ivy-state-current ivy-last)))
-              :action #'counsel-colors-action-insert-name
-              :history 'counsel-colors-emacs-history
-              :caller 'counsel-colors-emacs
-              :sort nil)))
-
-;;** `counsel-colors-web'
-(defvar counsel-colors--web-colors-alist
-  '(("aliceblue"            .  "#f0f8ff")
-    ("antiquewhite"         .  "#faebd7")
-    ("aqua"                 .  "#00ffff")
-    ("aquamarine"           .  "#7fffd4")
-    ("azure"                .  "#f0ffff")
-    ("beige"                .  "#f5f5dc")
-    ("bisque"               .  "#ffe4c4")
-    ("black"                .  "#000000")
-    ("blanchedalmond"       .  "#ffebcd")
-    ("blue"                 .  "#0000ff")
-    ("blueviolet"           .  "#8a2be2")
-    ("brown"                .  "#a52a2a")
-    ("burlywood"            .  "#deb887")
-    ("cadetblue"            .  "#5f9ea0")
-    ("chartreuse"           .  "#7fff00")
-    ("chocolate"            .  "#d2691e")
-    ("coral"                .  "#ff7f50")
-    ("cornflowerblue"       .  "#6495ed")
-    ("cornsilk"             .  "#fff8dc")
-    ("crimson"              .  "#dc143c")
-    ("cyan"                 .  "#00ffff")
-    ("darkblue"             .  "#00008b")
-    ("darkcyan"             .  "#008b8b")
-    ("darkgoldenrod"        .  "#b8860b")
-    ("darkgray"             .  "#a9a9a9")
-    ("darkgreen"            .  "#006400")
-    ("darkkhaki"            .  "#bdb76b")
-    ("darkmagenta"          .  "#8b008b")
-    ("darkolivegreen"       .  "#556b2f")
-    ("darkorange"           .  "#ff8c00")
-    ("darkorchid"           .  "#9932cc")
-    ("darkred"              .  "#8b0000")
-    ("darksalmon"           .  "#e9967a")
-    ("darkseagreen"         .  "#8fbc8f")
-    ("darkslateblue"        .  "#483d8b")
-    ("darkslategray"        .  "#2f4f4f")
-    ("darkturquoise"        .  "#00ced1")
-    ("darkviolet"           .  "#9400d3")
-    ("deeppink"             .  "#ff1493")
-    ("deepskyblue"          .  "#00bfff")
-    ("dimgray"              .  "#696969")
-    ("dodgerblue"           .  "#1e90ff")
-    ("firebrick"            .  "#b22222")
-    ("floralwhite"          .  "#fffaf0")
-    ("forestgreen"          .  "#228b22")
-    ("fuchsia"              .  "#ff00ff")
-    ("gainsboro"            .  "#dcdcdc")
-    ("ghostwhite"           .  "#f8f8ff")
-    ("goldenrod"            .  "#daa520")
-    ("gold"                 .  "#ffd700")
-    ("gray"                 .  "#808080")
-    ("green"                .  "#008000")
-    ("greenyellow"          .  "#adff2f")
-    ("honeydew"             .  "#f0fff0")
-    ("hotpink"              .  "#ff69b4")
-    ("indianred"            .  "#cd5c5c")
-    ("indigo"               .  "#4b0082")
-    ("ivory"                .  "#fffff0")
-    ("khaki"                .  "#f0e68c")
-    ("lavenderblush"        .  "#fff0f5")
-    ("lavender"             .  "#e6e6fa")
-    ("lawngreen"            .  "#7cfc00")
-    ("lemonchiffon"         .  "#fffacd")
-    ("lightblue"            .  "#add8e6")
-    ("lightcoral"           .  "#f08080")
-    ("lightcyan"            .  "#e0ffff")
-    ("lightgoldenrodyellow" .  "#fafad2")
-    ("lightgreen"           .  "#90ee90")
-    ("lightgrey"            .  "#d3d3d3")
-    ("lightpink"            .  "#ffb6c1")
-    ("lightsalmon"          .  "#ffa07a")
-    ("lightseagreen"        .  "#20b2aa")
-    ("lightskyblue"         .  "#87cefa")
-    ("lightslategray"       .  "#778899")
-    ("lightsteelblue"       .  "#b0c4de")
-    ("lightyellow"          .  "#ffffe0")
-    ("lime"                 .  "#00ff00")
-    ("limegreen"            .  "#32cd32")
-    ("linen"                .  "#faf0e6")
-    ("magenta"              .  "#ff00ff")
-    ("maroon"               .  "#800000")
-    ("mediumaquamarine"     .  "#66cdaa")
-    ("mediumblue"           .  "#0000cd")
-    ("mediumorchid"         .  "#ba55d3")
-    ("mediumpurple"         .  "#9370d8")
-    ("mediumseagreen"       .  "#3cb371")
-    ("mediumslateblue"      .  "#7b68ee")
-    ("mediumspringgreen"    .  "#00fa9a")
-    ("mediumturquoise"      .  "#48d1cc")
-    ("mediumvioletred"      .  "#c71585")
-    ("midnightblue"         .  "#191970")
-    ("mintcream"            .  "#f5fffa")
-    ("mistyrose"            .  "#ffe4e1")
-    ("moccasin"             .  "#ffe4b5")
-    ("navajowhite"          .  "#ffdead")
-    ("navy"                 .  "#000080")
-    ("oldlace"              .  "#fdf5e6")
-    ("olive"                .  "#808000")
-    ("olivedrab"            .  "#6b8e23")
-    ("orange"               .  "#ffa500")
-    ("orangered"            .  "#ff4500")
-    ("orchid"               .  "#da70d6")
-    ("palegoldenrod"        .  "#eee8aa")
-    ("palegreen"            .  "#98fb98")
-    ("paleturquoise"        .  "#afeeee")
-    ("palevioletred"        .  "#d87093")
-    ("papayawhip"           .  "#ffefd5")
-    ("peachpuff"            .  "#ffdab9")
-    ("peru"                 .  "#cd853f")
-    ("pink"                 .  "#ffc0cb")
-    ("plum"                 .  "#dda0dd")
-    ("powderblue"           .  "#b0e0e6")
-    ("purple"               .  "#800080")
-    ("rebeccapurple"        .  "#663399")
-    ("red"                  .  "#ff0000")
-    ("rosybrown"            .  "#bc8f8f")
-    ("royalblue"            .  "#4169e1")
-    ("saddlebrown"          .  "#8b4513")
-    ("salmon"               .  "#fa8072")
-    ("sandybrown"           .  "#f4a460")
-    ("seagreen"             .  "#2e8b57")
-    ("seashell"             .  "#fff5ee")
-    ("sienna"               .  "#a0522d")
-    ("silver"               .  "#c0c0c0")
-    ("skyblue"              .  "#87ceeb")
-    ("slateblue"            .  "#6a5acd")
-    ("slategray"            .  "#708090")
-    ("snow"                 .  "#fffafa")
-    ("springgreen"          .  "#00ff7f")
-    ("steelblue"            .  "#4682b4")
-    ("tan"                  .  "#d2b48c")
-    ("teal"                 .  "#008080")
-    ("thistle"              .  "#d8bfd8")
-    ("tomato"               .  "#ff6347")
-    ("turquoise"            .  "#40e0d0")
-    ("violet"               .  "#ee82ee")
-    ("wheat"                .  "#f5deb3")
-    ("white"                .  "#ffffff")
-    ("whitesmoke"           .  "#f5f5f5")
-    ("yellow"               .  "#ffff00")
-    ("yellowgreen"          .  "#9acd32"))
-  "These are the colors defined by the W3C consortium to use in CSS sheets.
-
-All of these colors are compatible with any common browser.  The
-colors gray, green, maroon and purple have alternative values as
-defined by the X11 standard, here they follow the W3C one.")
-
-(ivy-set-actions
- 'counsel-colors-web
- '(("n" counsel-colors-action-insert-name "insert name")
-   ("h" counsel-colors-action-insert-hex "insert hex")
-   ("N" counsel-colors-action-kill-name "kill rgb")
-   ("H" counsel-colors-action-kill-hex "kill hex")))
-
-(defvar counsel-colors-web-history nil
-  "History for `counsel-colors-web'.")
-
-;;;###autoload
-(defun counsel-colors-web ()
-  "Show a list of all W3C web colors for use in CSS.
-
-You can insert or kill the name or the hexadecimal rgb value of the
-selected candidate."
-  (interactive)
-  (let ((minibuffer-allow-text-properties t))
-    (ivy-read "%d Web color: "
-              (mapcar (lambda (x)
-                        (concat
-                         (propertize
-                          (format "%-25s" (car x)))
-                         (propertize
-                          (format "%8s  " (cdr x))
-                          'face (list :foreground (car x)))
-                         (propertize
-                          (format "%10s" " ")
-                          'face (list :background (cdr x)))))
-                      counsel-colors--web-colors-alist)
-              :require-match t
-              :action #'counsel-colors-action-insert-name
-              :update-fn (lambda ()
-                           (counsel-colors--update-highlight 
(ivy-state-current ivy-last)))
-              :history 'counsel-colors-web-history
-              :caller 'counsel-colors-web
-              :sort t)))
-
-
-;;** `counsel-faces'
-(defun counsel-faces-action-describe (x)
-  "Describe the face X."
-  (describe-face (intern x)))
-
-(defun counsel-faces-action-customize (x)
-  "Customize the face X."
-  (customize-face (intern x)))
-
-(ivy-set-actions
- 'counsel-faces
- '(("d" counsel-faces-action-describe "describe face")
-   ("c" counsel-faces-action-customize "customize face")
-   ("i" insert "insert face name")
-   ("k" kill-new "kill face name")))
-
-(defvar counsel-faces-history nil
-  "History for `counsel-faces'.")
-
-(defvar counsel-faces--sample-text
-  "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
-  "Text string to display as the sample text for `counsel-faces'.")
-
-(defvar counsel--faces-fmt nil)
-
-(defun counsel--faces-format-function (cands)
-  (ivy--format-function-generic
-   (lambda (str)
-     (concat
-      (format counsel--faces-fmt
-              (ivy--add-face str 'ivy-current-match))
-      (propertize counsel-faces--sample-text 'face (intern str))))
-   (lambda (str)
-     (concat
-      (format counsel--faces-fmt
-              str)
-      (propertize counsel-faces--sample-text 'face (intern str))))
-   cands
-   "\n"))
-
-(defun counsel-faces ()
-  "Show a list of all defined faces.
-
-You can describe, customize, insert or kill the name or selected
-candidate."
-  (interactive)
-  (let* ((minibuffer-allow-text-properties t)
-         (max-length
-          (apply #'max
-                 (mapcar
-                  (lambda (x)
-                    (length (symbol-name x)))
-                  (face-list))))
-         (counsel--faces-fmt (format "%%-%ds  " max-length))
-         (ivy-format-function #'counsel--faces-format-function))
-    (ivy-read "%d Face: " (face-list)
-              :require-match t
-              :action #'counsel-faces-action-describe
-              :history 'counsel-faces-history
-              :caller 'counsel-faces
-              :sort t)))
-
-;;** `counsel-command-history'
-(defun counsel-command-history-action-eval (cmd)
-  "Eval the command CMD."
-    (eval (read cmd)))
-
-(defun counsel-command-history-action-edit-and-eval (cmd)
-  "Edit and eval the command CMD."
-    (edit-and-eval-command "Eval: " (read cmd)))
-
-(ivy-set-actions
- 'counsel-command-history
- '(("r" counsel-command-history-action-eval           "eval command")
-   ("e" counsel-command-history-action-edit-and-eval  "edit and eval 
command")))
-
-(defun counsel-command-history ()
-  "Show the history of commands."
-  (interactive)
-  (ivy-read "%d Command: " (mapcar #'prin1-to-string command-history)
-          :require-match t
-          :action #'counsel-command-history-action-eval
-          :caller 'counsel-command-history))
-
-;;** `counsel-org-agenda-headlines'
-(defvar org-odd-levels-only)
-(declare-function org-set-startup-visibility "org")
-(declare-function org-show-entry "org")
-(declare-function org-map-entries "org")
-(declare-function org-heading-components "org")
-
-(defun counsel-org-agenda-headlines-action-goto (headline)
-  "Go to the `org-mode' agenda HEADLINE."
-  (find-file (nth 1 headline))
-  (org-set-startup-visibility)
-  (goto-char (nth 2 headline))
-  (org-show-entry))
-
-(ivy-set-actions
- 'counsel-org-agenda-headlines
- '(("g" counsel-org-agenda-headlines-action-goto "goto headline")))
-
-(defvar counsel-org-agenda-headlines-history nil
-  "History for `counsel-org-agenda-headlines'.")
-
-(defun counsel-org-agenda-headlines--candidates ()
-  "Return a list of completion candidates for `counsel-org-agenda-headlines'."
-  (org-map-entries
-   (lambda ()
-     (let* ((components (org-heading-components))
-            (level (make-string
-                    (if org-odd-levels-only
-                        (nth 1 components)
-                      (nth 0 components))
-                    ?*))
-            (todo (nth 2 components))
-            (priority (nth 3 components))
-            (text (nth 4 components))
-            (tags (nth 5 components)))
-       (list
-        (mapconcat
-         'identity
-         (cl-remove-if 'null
-                       (list
-                        level
-                        todo
-                        (if priority (format "[#%c]" priority))
-                        text
-                        tags))
-         " ")
-        (buffer-file-name) (point))))
-   nil
-   'agenda))
-
-;;;###autoload
-(defun counsel-org-agenda-headlines ()
-  "Choose from headers of `org-mode' files in the agenda."
-  (interactive)
-  (let ((minibuffer-allow-text-properties t))
-    (ivy-read "Org headline: "
-              (counsel-org-agenda-headlines--candidates)
-              :action #'counsel-org-agenda-headlines-action-goto
-              :history 'counsel-org-agenda-headlines-history
-              :caller 'counsel-org-agenda-headlines)))
-
-;;** `counsel-irony'
-;;;###autoload
-(defun counsel-irony ()
-  "Inline C/C++ completion using Irony."
-  (interactive)
-  (irony-completion-candidates-async 'counsel-irony-callback))
-
-(defun counsel-irony-callback ()
-  (interactive)
-  (let ((coll (irony-completion-at-point)))
-    (when coll
-      (setq ivy-completion-beg (nth 0 coll))
-      (setq ivy-completion-end (nth 1 coll))
-      (ivy-read "code: " (mapcar #'counsel-irony-annotate
-                                 (nth 2 coll))
-                :caller 'counsel-irony
-                :action 'ivy-completion-in-region-action))))
-
-(defun counsel-irony-annotate (x)
-  (cons
-   (condition-case nil
-       (concat
-        x " "
-        (irony-completion--at-point-annotate x))
-     (error x))
-   x))
-
-(add-to-list 'ivy-display-functions-alist '(counsel-irony . 
ivy-display-function-overlay))
-
-(declare-function irony-completion-candidates-async "ext:irony-completion")
-(declare-function irony-completion-at-point "ext:irony-completion")
-(declare-function irony-completion--at-point-annotate "ext:irony-completion")
-
-;;** `counsel-mode'
-(defvar counsel-mode-map
-  (let ((map (make-sparse-keymap)))
-    (dolist (binding
-              '((execute-extended-command . counsel-M-x)
-                (describe-bindings . counsel-descbinds)
-                (describe-function . counsel-describe-function)
-                (describe-variable . counsel-describe-variable)
-                (find-file . counsel-find-file)
-                (find-library . counsel-find-library)
-                (imenu . counsel-imenu)
-                (load-library . counsel-load-library)
-                (load-theme . counsel-load-theme)
-                (yank-pop . counsel-yank-pop)
-                (info-lookup-symbol . counsel-info-lookup-symbol)
-                (pop-mark . counsel-mark-ring)))
-      (define-key map (vector 'remap (car binding)) (cdr binding)))
-    map)
-  "Map for `counsel-mode'. Remaps built-in functions to counsel
-replacements.")
-
-(defcustom counsel-mode-override-describe-bindings nil
-  "Whether to override `describe-bindings' when `counsel-mode' is
-active."
-  :group 'ivy
-  :type 'boolean)
-
-;;;###autoload
-(define-minor-mode counsel-mode
-  "Toggle Counsel mode on or off.
-Turn Counsel mode on if ARG is positive, off otherwise. Counsel
-mode remaps built-in emacs functions that have counsel
-replacements. "
-  :group 'ivy
-  :global t
-  :keymap counsel-mode-map
-  :lighter " counsel"
-  (if counsel-mode
-      (progn
-        (when (and (fboundp 'advice-add)
-                   counsel-mode-override-describe-bindings)
-          (advice-add #'describe-bindings :override #'counsel-descbinds))
-        (define-key minibuffer-local-shell-command-map (kbd "C-r")
-          'counsel-shell-command-history)
-        (define-key read-expression-map (kbd "C-r")
-          'counsel-expression-history))
-    (when (fboundp 'advice-remove)
-      (advice-remove #'describe-bindings #'counsel-descbinds))))
-
-(provide 'counsel)
-
-;;; counsel.el ends here
diff --git a/packages/ivy/doc/Changelog.org b/packages/ivy/doc/Changelog.org
deleted file mode 100644
index 7eb046c..0000000
--- a/packages/ivy/doc/Changelog.org
+++ /dev/null
@@ -1,2896 +0,0 @@
-#+OPTIONS: H:4 num:nil toc:3
-#+SETUPFILE: ~/git/org-html-themes/setup/theme-readtheorg.setup
-#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="kbd-style.css"/>
-
-* 0.6.0
-:PROPERTIES:
-:CUSTOM_ID: 0.6.0
-:END:
------
-** Fixes
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fixes
-:END:
-*** =swiper-avy= should use only the current window
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-swiper-avy-should-use-only-the-current-window
-:END:
-Not all windows. See [[https://github.com/abo-abo/swiper/issues/117][#117]].
------
-*** fix wrap-around for =ivy-next-line=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-fix-wrap-around-for-ivy-next-line
-:END:
-See [[https://github.com/abo-abo/swiper/issues/118][#118]].
------
-*** =swiper-avy= should do nothing for empty input
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-swiper-avy-should-do-nothing-for-empty-input
-:END:
-See [[https://github.com/abo-abo/avy/issues/50][#50]].
------
-*** =ivy-alt-done= should require TRAMP if necessary
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-ivy-alt-done-should-require-tramp-if-necessary
-:END:
-See [[https://github.com/abo-abo/swiper/pull/145][#145]].
------
-*** =swiper-query-replace= shouldn't miss the first occurrence
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-swiper-query-replace-shouldnt-miss-the-first-occurrence
-:END:
-See [[https://github.com/abo-abo/swiper/pull/144][#144]].
------
-*** =swiper= should not deactivate mark
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-swiper-should-not-deactivate-mark
-:END:
-*** =ivy-mode= should not switch to TRAMP for certain input
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-ivy-mode-should-not-switch-to-tramp-for-certain-input
-:END:
-See [[https://github.com/abo-abo/swiper/pull/145][#145]].
------
-*** =counsel-find-file= should work better with TRAMP
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-counsel-find-file-should-work-better-with-tramp
-:END:
-"/ssh:foo" should not be cut off
-See [[https://github.com/abo-abo/swiper/pull/145][#145]].
------
-*** =counsel-find-file= supports Windows drive letters
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-counsel-find-file-supports-windows-drive-letters
-:END:
-See [[https://github.com/abo-abo/swiper/pull/155][#155]].
------
-*** =counsel-file-file= should work better with files that contain "~"
-:PROPERTIES:
-:CUSTOM_ID: 
0-6-0-fx-counsel-file-file-should-work-better-with-files-that-contain-
-:END:
-See [[https://github.com/abo-abo/swiper/pull/157][#157]].
------
-*** =counsel-M-x= should respect =ivy-format-function=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-counsel-m-x-should-respect-ivy-format-function
-:END:
-See [[https://github.com/abo-abo/swiper/pull/150][#150]].
------
-*** =counsel-git-grep= should position better on exit
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-counsel-git-grep-should-position-better-on-exit
-:END:
-See [[https://github.com/abo-abo/swiper/pull/153][#153]].
------
-*** =ivy-mode= should re-scale text to minibuffer height
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-ivy-mode-should-re-scale-text-to-minibuffer-height
-:END:
-See [[https://github.com/abo-abo/swiper/pull/151][#151]].
------
-*** =counsel-unicode-char= should use action-style call
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-counsel-unicode-char-should-use-action-style-call
-:END:
-See [[https://github.com/abo-abo/swiper/pull/160][#160]].
------
-*** =ivy-read= should allow % in prompt string
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-ivy-read-should-allow--in-prompt-string
-:END:
-See [[https://github.com/abo-abo/swiper/pull/171][#171]].
------
-*** =ivy-call= should execute in proper window
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-ivy-call-should-execute-in-proper-window
-:END:
-See [[https://github.com/abo-abo/swiper/pull/176][#176]].
-** New Features
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-fx-new-features
-:END:
-*** =ivy-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-ivy-mode
-:END:
-**** Open an Info file on the file system
-When in =Info-mode=, press ~g~ and select either "(./)" or "(../)" to
-switch to file name completion. That file will be opened with Info.
------
-**** Account for =minibuffer-depth-indication-mode=
-If you have =minibuffer-depth-indication-mode= on, the minibuffer
-prompt will indicate the current depth.
-See [[https://github.com/abo-abo/swiper/pull/134][#134]].
------
-**** Add fuzzy matching function
-To enable fuzzy matching, set your =ivy-re-builders-alist= accordingly:
-#+begin_src elisp
-(setq ivy-re-builders-alist
-      '((t . ivy--regex-fuzzy)))
-#+end_src
-See [[https://github.com/abo-abo/swiper/pull/136][#136]].
-
-See also [[https://github.com/abo-abo/swiper/pull/142][#142]] for toggling 
fuzzy matching with ~C-o m~.
------
-**** =case-fold-search= optimization
-Bind case-fold-search to t when the input is all lower-case:
-
-- input "the" matches both "the" and "The".
-- input "The" matches only "The".
-
-See [[https://github.com/abo-abo/swiper/pull/166][#166]].
------
-**** Allow to see the candidate index a la =anzu= via =ivy-count-format=
-To have this feature, use something like this:
-#+begin_src elisp
-(setq ivy-count-format "(%d/%d) ")
-#+end_src
-See [[https://github.com/abo-abo/swiper/pull/167][#167]].
-
-You can also set this to "", if you don't want any count, see 
[[https://github.com/abo-abo/swiper/pull/188][#188]].
------
-**** Allow to add additional exit points for any command
-Example for =ivy-switch-to-buffer=:
-#+begin_src elisp
-(ivy-set-actions
- 'ivy-switch-buffer
- '(("k"
-    (lambda (x)
-      (kill-buffer x)
-      (ivy--reset-state ivy-last))
-    "kill")
-   ("j"
-    ivy--switch-buffer-other-window-action
-    "other")))
-#+end_src
-
-After this:
-
-- use ~M-o k~ to kill a buffer
-- use ~M-o j~ to switch to a buffer in other window
-
-You can always use ~M-o o~ to access the default action. When there is
-only one action, ~M-o~ does the same as ~C-m~.
-
-See [[https://github.com/abo-abo/swiper/pull/164][#164]].
-
-
-
-
-
-
-
-
------
-*** =counsel-describe-function= and =counsel-decribe-variable=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-counsel-describe-function-and-counsel-decribe-variable
-:END:
-**** Add a binding to look up the symbol in info
-Press ~C-,~ to look up the symbol in info, instead of the default
-describe action.
-See [[https://github.com/abo-abo/swiper/pull/121][#121]].
------
-**** Handle symbol-at-point better in non-Elisp buffers
-See [[https://github.com/abo-abo/swiper/pull/126][#126]].
------
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-ivy-switch-buffer
-:END:
-**** New face =ivy-virtual=
-See [[https://github.com/abo-abo/swiper/pull/129][#129]].
------
-**** Deal better with invisible buffers
-See [[https://github.com/abo-abo/swiper/pull/135][#135]].
------
-**** Add custom keymap
-You can customize =ivy-switch-buffer-map=.
-
-See [[https://github.com/abo-abo/swiper/pull/164][#164]].
------
-**** Add extra actions
-Add a =kill-buffer= action, and =switch-to-buffer-other-window= action.
------
-*** =counsel-git-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-counsel-git-grep
-:END:
-**** Add Async
-Make it fully async: the process =git grep= will be killed and
-restarted on new input. This results in almost no keyboard delay.
------
-**** Own history variable
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-swiper
-:END:
-**** Own history variable
-Having own history variable allows to get more use of ~M-p~, ~M-n~ and ~C-r~.
------
-*** =counsel-el=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-counsel-el
-:END:
-**** Switch to action-style call
-This allows to make use of ~C-M-n~ and ~C-M-p~.
------
-*** =counsel-locate=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-counsel-locate
-:END:
-**** Add Async
-**** Add extra actions
-In addition to the default action of opening a file add:
-
-- =xdg-open= action
-- =dired= action
-
-Press ~M-o~ or ~C-o~ to access these actions.
------
-**** Add own history
-
------
-*** API
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-api
-:END:
-**** Add :matcher
-A matcher is a function that accepts a regexp and a list of candidates
-and returns the filtered list of candidates.
-
-The default matcher is basically =cl-remove-if-not= + =string-match=.
-If you'd like to customize this, pass your own matcher.
-
-See =counsel-git-grep-matcher= for an example.
------
-**** Allow to customize the initial input for all commands
-Customize =ivy-initial-inputs-alist= for this.
-See [[https://github.com/abo-abo/swiper/pull/140][#140]].
------
-**** =ivy-sort-functions-alist= should also examine =this-command=
-**** :dynamic-collection is now a boolean
-Pass the collection function as the second var instead.
-
-** New Commands
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nf-new-commands
-:END:
-*** =ivy-call=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-call
-:END:
-Execute the current action for the current candidate without exiting
-the minibuffer.  Bound to ~C-M-m~ or ~M-RET~ or ~C-o g~.
-
-
------
-*** =counsel-find-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-find-file
-:END:
-Forward to =find-file= with Ivy completion.
-
-=ivy-next-line-and-call= as well as =ivy-resume= should work for this command.
-
-The variable =counsel-find-file-ignore-regexp= allows to ignore
-certain files, like dot files.  Input a leading dot to see all files.
-
-The variable =counsel-find-file-at-point= allows to automatically use
-=ffap=.  You also can do it manually with ~M-n~ when the point is on a file 
name.
-
-The variable =counsel-find-file-map= allows to customize the
-minibuffer key bindings for this command.
-
-Recommended binding:
-
-#+begin_src elisp
-(global-set-key (kbd "C-x C-f") 'counsel-find-file)
-#+end_src
-
-You can peek at files with ~C-M-n~ and ~C-M-p~.
-
-See [[https://github.com/abo-abo/swiper/issues/122][#122]] and 
[[https://github.com/abo-abo/swiper/issues/123][#123]].
-
-See [[https://github.com/abo-abo/swiper/pull/152][#152]] about ~M-n~, ~M-p~ 
and ~M-i~ switching directories when necessary.
-
------
-*** =ivy-recentf=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-recentf
-:END:
-Find a file on =recentf-list=.
-
-Note that if your set =ivy-use-virtual-buffers=, =recentf-list= is
-merged into candidates list for =ivy-switch-buffer=. But if you want
-it separately, you can use this command.
-
-See [[https://github.com/abo-abo/swiper/issues/124][#124]].
------
-*** =ivy-yank-word=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-yank-word
-:END:
-Add word at point to minibuffer input.
-
-This is similar to what ~C-w~ does for =isearch=.  However it's bound
-to ~M-j~ instead of ~C-w~, since ~C-w~ is bound to =kill-region= - a
-useful command.
-
-See [[https://github.com/abo-abo/swiper/issues/125][#125]].
------
-*** =counsel-M-x=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-m-x
-:END:
-Forward to =execute-extended-command= with Ivy completion.
-The candidate list will also display the key binding for each bound command.
-
-This command will piggyback on =smex= for sorting, if =smex= is installed.
-
-Use =counsel-M-x-initial-input= to customize the initial input for
-this command.  By default, it's "^" - the regex character that
-indicates beginning of string.  This results in much faster matching,
-since you usually type the command name from the start.
-
-See [[https://github.com/abo-abo/swiper/pull/136][#136]] and 
[[https://github.com/abo-abo/swiper/pull/138][#138]].
-
------
-*** =hydra-ivy=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-hydra-ivy
-:END:
-Press ~C-o~ to toggle the Hydra for Ivy.
-It gives access to shorter bindings and many customizable options.
-
-Use ~C-o >~ to grow the minibuffer.
-Use ~C-o <~ to shrink the minibuffer.
-
-See [[https://github.com/abo-abo/swiper/pull/151][#151]].
-
------
-*** =ivy-toggle-calling=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-toggle-calling
-:END:
-Toggle executing the current action each time a new candidate is selected.
-
-This command is bound to ~C-o c~.
-
-To explain how this is useful: ~C-M-m C-M-f C-M-f C-M-f~  is equivalent to 
~C-o cjjj~.
-
------
-*** =ivy-insert-current=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-insert-current
-:END:
-Inserts the current candidate into the minibuffer.
-
-Press ~M-i~ if you want something close to the current candidate. You
-can follow up with an edit and select.
-
-I find this very useful when creating new files with a similar name to
-the existing file: ~C-x C-f M-i~ + a bit of editing is very fast.
-
-See [[https://github.com/abo-abo/swiper/pull/141][#141]].
-
------
-*** =counsel-load-theme=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-load-theme
-:END:
-Forward to =load-theme= with Ivy completion. Allows to rapidly try themes 
(e.g. with ~C-M-n~).
-
------
-*** =ivy-reverse-i-search=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-reverse-i-search
-:END:
-Allow to recursively match history with ~C-r~.
-
-I like this command from bash shell. The usual way to search through
-history is with ~M-p~ and ~M-n~.  Using =ivy-reverse-i-search= will
-open a recursive completion session with the current history as the
-candidates.
------
-*** =counsel-rhythmbox=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-rhythmbox
-:END:
-[[http://oremacs.com/2015/07/09/counsel-rhythmbox/][Control Rhythmbox from 
Emacs.]]
------
-*** =ivy-dispatching-done=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-dispatching-done
-:END:
-Select an action for the current candidate and execute it. Bound to ~M-o~.
-
-Some commands that support ~M-o~:
-
-- =counsel-rhythmbox=
-- =counsel-describe-function=
-- =counsel-describe-variable=
-- =ivy-switch-buffer=
-- =counsel-locate=
-
------
-*** =counsel-org-tag=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-org-tag
-:END:
-Forward to =org-set-tags= with Ivy completion.
-
-Selecting any tag each time will toggle it on/off.
-The current list of selected tags will be displayed in the prompt.
-
-See [[https://github.com/abo-abo/swiper/pull/177][#177]] and 
[[https://github.com/abo-abo/swiper/pull/91][#91]].
-
------
-*** =counsel-org-tag-agenda=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-org-tag-agenda
-:END:
-Forward to =org-agenda-set-tags= with Ivy completion.
-See [[https://github.com/abo-abo/swiper/pull/177][#177]].
-
------
-*** =counsel-ag=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-ag
-:END:
-Interactively =ag= using Ivy completion.
-
------
-*** =counsel-recoll=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-counsel-recoll
-:END:
-Use =recoll= with Ivy completion.
-See [[http://oremacs.com/2015/07/27/counsel-recoll/][Using Recoll desktop 
search database with Emacs]].
-
-Install recoll with =sudo apt-get install recoll=.
-
------
-*** =swiper-from-isearch=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-swiper-from-isearch
-:END:
-Start =swiper= from the current =isearch= input.
-
------
-*** =ivy-immediate-done=
-:PROPERTIES:
-:CUSTOM_ID: 0-6-0-nc-ivy-immediate-done
-:END:
-Use this command to exit the minibuffer choosing not the current
-candidate, but the current text.  Bound to ~C-M-j~ or ~C-u C-j~.
-
-See [[https://github.com/abo-abo/swiper/pull/183][#183]].
-
------
-* 0.7.0
-:PROPERTIES:
-:CUSTOM_ID: 0.7.0
-:END:
------
-** Fixes
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fixes
-:END:
-*** Fix :dynamic-collection not being sorted
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-dynamic-collection-not-being-sorted
-:END:
-*** When :initial-input contains a plus, escape it
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-when-initial-input-contains-a-plus,-escape-it
-:END:
-See [[https://github.com/abo-abo/swiper/issues/195][#195]].
------
-*** Set line-spacing to 0 in the minibuffer
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-set-line-spacing-to-0-in-the-minibuffer
-:END:
-See [[https://github.com/abo-abo/swiper/issues/198][#198]].
------
-*** Enlarge the minibuffer window if the candidate list doesn't fit
-:PROPERTIES:
-:CUSTOM_ID: 
0-7-0-fx-enlarge-the-minibuffer-window-if-the-candidate-list-doesnt-fit
-:END:
-See [[https://github.com/abo-abo/swiper/issues/198][#198]] and 
[[https://github.com/abo-abo/swiper/issues/161][#161]] and 
[[https://github.com/abo-abo/swiper/issues/220][#220]].
------
-*** Fix minibuffer collapsing to one line
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-minibuffer-collapsing-to-one-line
-:END:
-See [[https://github.com/abo-abo/swiper/issues/237][#237]], 
[[https://github.com/abo-abo/swiper/issues/229][#229]] and 
[[https://github.com/abo-abo/swiper/issues/77][#77]].
------
-*** Use minibuffer-allow-text-properties
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-use-minibuffer-allow-text-properties
-:END:
-Allows =ivy-read= to return a propertized string.
------
-*** Improve ~C-g~ out of a long-running async process
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-improve-c-g-out-of-a-long-running-async-process
-:END:
-Use =counsel-delete-process= as =:unwind=.
------
-*** Don't regexp-quote :preselect
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-dont-regexp-quote-preselect
-:END:
-See [[https://github.com/abo-abo/swiper/issues/245][#245]].
------
-*** Fix ivy-partial for fuzzy completion
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-ivy-partial-for-fuzzy-completion
-:END:
-See [[https://github.com/abo-abo/swiper/issues/266][#266]].
------
-*** ivy-resume should pass :caller
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-ivy-resume-should-pass-caller
-:END:
-See [[https://github.com/abo-abo/swiper/issues/245][#245]].
------
-*** Fix the regression in perfect match logic
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-the-regression-in-perfect-match-logic
-:END:
-See [[https://github.com/abo-abo/swiper/issues/270][#270]].
------
-*** Fix pasting file paths on Windows
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-pasting-file-paths-on-windows
-:END:
-*** ~C-j~ should no stop completion for a pasted file path
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-c-j-should-no-stop-completion-for-a-pasted-file-path
-:END:
-*** ~C-M-j~ should use =ivy--directory=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-c-m-j-should-use-ivy--directory
-:END:
-When completing file names, expand the file name properly.
-See [[https://github.com/abo-abo/swiper/issues/275][#275]].
------
-*** Use a specific blend method for dark themes
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-use-a-specific-blend-method-for-dark-themes
-:END:
-See [[https://github.com/abo-abo/swiper/issues/278][#278]].
------
-*** Fix one-off bug in =ivy-scroll-up-command= and =ivy-scroll-down-command=
-:PROPERTIES:
-:CUSTOM_ID: 
0-7-0-fx-fix-one-off-bug-in-ivy-scroll-up-command-and-ivy-scroll-down-command
-:END:
-*** ~M-o~ shouldn't set the action permanently
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-m-o-shouldnt-set-the-action-permanently
-:END:
-So now it's possible to e.g. =counsel-describe-function= -> ~M-o d~ ->
-=ivy-resume= -> ~M-o o~ -> =ivy-resume= -> ~M-o i~.
------
-*** Fix swiper preselect issue with similar or identical lines
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-fix-swiper-preselect-issue-with-similar-or-identical-lines
-:END:
-See [[https://github.com/abo-abo/swiper/issues/290][#290]].
------
-*** Make ivy-completing-read handle history as cons
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-make-ivy-completing-read-handle-history-as-cons
-:END:
-See [[https://github.com/abo-abo/swiper/issues/295][#295]].
------
-*** Perform string-match in the original buffer
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-perform-string-match-in-the-original-buffer
-:END:
-The syntax for whitespace, separators etc. is different for modes.  See 
[[https://github.com/abo-abo/swiper/issues/298][#298]].
-** New Features
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-fx-new-features
-:END:
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-swiper
-:END:
-**** Make line numbers into display properties
-Each candidate is now a single space plus the original string.  The
-display property of the single space holds the line number. This means
-that it's no longer possible to match line numbers in queries, which
-is a good thing if you're searching for numbers.
------
-**** Extend =swiper-font-lock-ensure=
-Add =mu4e-view-mode=, =mu4e-headers-mode=, =help-mode=,
-=elfeed-show-mode=, =emms-stream-mode=, =debbugs-gnu-mode=,
-=occur-mode=, =occur-edit-mode=, =bongo-mode=, =eww-mode=, =vc-dir-mode=.
------
-**** Add support for =evil-jumper/backward=
-See [[https://github.com/abo-abo/swiper/issues/268][#268]].
------
-**** Make compatible with =visual-line-mode=
-=swiper= will split the lines when =visual-line-mode= is on.  This is
-convenient for small buffers. For large buffers, it can be very slow,
-since =visual-line-mode= is slow.
-See [[https://github.com/abo-abo/swiper/issues/227][#227]].
------
-**** Add =swiper-toggle-face-matching=
-Bound to ~C-c C-f~.
-At each start of =swiper=, the face at point will be stored.
-Use this command to toggle matching only the candidates with that face.
-See [[https://github.com/abo-abo/swiper/issues/288][#288]].
------
-**** =push-mark= only if exited the minibuffer
-~C-M-n~ and ~C-M-p~ will no longer push mark and annoy with messages.
------
-**** =ivy-resume= should restore the buffer for =swiper=
-See [[https://github.com/abo-abo/swiper/issues/302][#302]].
------
-**** Enable recursive =swiper= calls
-While you =swiper= buffer-1, you can switch out of the minibuffer into
-buffer-2 and call =swiper= again.  Exiting the second minibuffer will
-restore the first minibuffer.
-
-To use this, you need to enable recursive minibuffers.
-#+begin_src elisp
-(setq enable-recursive-minibuffers t)
-#+end_src
-
-It's also useful to indicate the current depth:
-
-#+begin_src elisp
-(minibuffer-depth-indicate-mode 1)
-#+end_src
-
-See [[https://github.com/abo-abo/swiper/issues/309][#309]].
------
-**** Fix for =twittering-mode=
-The =field= text property is now removed before inserting text into
-the minibuffer. This fixes the =swiper= problems with
-=twittering-mode=. See [[https://github.com/abo-abo/swiper/issues/310][#310]].
-
-
-
-
------
-*** =ivy=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-ivy
-:END:
-**** Add manual
-In the current state, the manual covers the most basic topics, like
-the minibuffer key bindings and the regexp builders.
------
-**** Make <left> and <right> behave as in fundamental-mode
-**** Truncate minibuffer prompts longer than window-width
-See [[https://github.com/abo-abo/swiper/issues/240][#240]].
------
-**** ~C-M-n~ should not leave the minibuffer
-Make sure that the minibuffer window remains selected as long as the
-completion hasn't finished.  For example, ~<f1> f~ to call
-=counsel-describe-function=, input "forward" and spam ~C-M-n~ to read
-the doc for each function that starts with "forward". The =*Help*=
-window popup would move the window focus, but this change moves it
-back to the minibuffer.
------
-**** Add =flx= sorting
-See [[https://github.com/abo-abo/swiper/issues/207][#207]].
-Since flx is costly, move the caching to an earlier point. This means
-immediate return for when the input hasn't changed, i.e. for ~C-n~ or
-~C-p~. When =flx= is installed, and =(eq ivy--regex-function 
'ivy--regex-fuzzy)=
-for current function (through =ivy-re-builders-alist=), then sort the final 
candidates with
-=ivy--flx-sort=.
-
-In the worst case, when some error pops up, return the same list. In
-the best case sort the =cands= that all match =name= by closeness to
-=name=.
-
-How to use:
-1. Have =flx= installed - =(require 'flx)= should succeed.
-2. Configure =ivy-re-builders-alist= appropriately to use =ivy--regex-fuzzy=.
-
-For example:
-
-#+begin_src elisp
-(setq ivy-re-builders-alist
-      '((t . ivy--regex-fuzzy)))
-#+end_src
------
-**** Support hash tables
-Since =all-completions= also works for hash tables, no reason not to support 
them.
------
-**** Improve documentation of =ivy-count-format=
-Now possible to set it with Customize.
------
-**** Add =ivy-index-functions-alist=
-Customize this to decide how the index, i.e. the currently selected
-candidate, is updated with new input.
-For example, one strategy is not reset it to 0 after each change.
-
-Another strategy, used for =swiper=, is to try to select the first
-appropriate candidate after (inclusive) the first previously selected
-candidate. This way, if you're typing something that matches what is
-currently selected, the selection won't change.
-
-See [[https://github.com/abo-abo/swiper/issues/253][#253]].
------
-**** Add =ivy-virtual-abbreviate=
-The mode of abbreviation for virtual buffer names.
------
-**** Add =ivy-case-fold-search=
-Used to override =case-fold-search=. See 
[[https://github.com/abo-abo/swiper/issues/259][#259]].
------
-**** Add feedback for long-running async processes
-Each time 0.5s pass after the last input, if the external process
-hasn't finished yet, update minibuffer with the amount of candidates
-collected so far. This is useful to see that long running commands
-like =counsel-locate= or =counsel-ag= (when in a very large directory)
-aren't stuck.
------
-**** Promote =ivy-extra-directories= to defcustom
-**** Promote =ivy-sort-function-alist= to defcustom
-**** ~M-n~ should prefer url at point to symbol at point
-**** ~C-x C-f M-n~ calls =ffap-url-fetcher= when at URL
-**** Highlight modified file buffers with =ivy-modified-buffer= face
-This new face is blank by default, but you can use e.g.:
-#+begin_src elisp
-(custom-set-faces
- '(ivy-modified-buffer ((t (:background "#ff7777")))))
-#+end_src
------
-**** Work with =enable-recursive-minibuffers=
-Store the old =ivy-last= in case =ivy-read= is called while inside the
-minibuffer.  Restore it after =ivy-call=.
------
-**** Allow user-specified matched candidate sorting
-New defcustom =ivy-sort-matches-functions-alist=.
-See [[https://github.com/abo-abo/swiper/issues/269][#269]] 
[[https://github.com/abo-abo/swiper/issues/265][#265]] 
[[https://github.com/abo-abo/swiper/issues/213][#213]].
-
-By default, Ivy doesn't sort the matched candidates, they remain in
-the same order as in the original collection. This option is the
-default, since it's fast and simple.
-
-A small problem with this approach is that we usually want prefix
-matches to be displayed first. One solution to this is to input "^" to
-see only the prefix matches.
-
-Now, another solution is to can set:
-#+begin_src elisp
-(setq ivy-sort-matches-functions-alist
-      '((t . ivy--prefix-sort)))
-#+end_src
-
-Here's another example of using this defcustom:
-#+begin_src elisp
-(add-to-list
-     'ivy-sort-matches-functions-alist
-     '(read-file-name-internal . ivy--sort-files-by-date))
-#+end_src
-
-After this, during file name completion, most recently changed files
-will be ahead.
------
-**** =ivy-display-style=
-Adds fancy highlighting to the minibuffer.
-See [[https://github.com/abo-abo/swiper/issues/212][#212]], 
[[https://github.com/abo-abo/swiper/issues/217][#217]], .
------
-*** =ivy-hydra=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-ivy-hydra
-:END:
-**** Bind ~t~ to =toggle-truncate-lines=
-See [[https://github.com/abo-abo/swiper/issues/214][#214]].
------
-**** Bind ~a~ to =ivy-read-action=
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-ivy-switch-buffer
-:END:
-**** Make ~M-o r~ rename the buffer instead of switching.
-See [[https://github.com/abo-abo/swiper/issues/233][#233]].
------
-*** =counsel-locate=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-locate
-:END:
-**** Allow customizing locate options
-See =counsel-locate-options=.
-The current setting is:
-#+begin_src elisp
-(setq counsel-locate-options '("-i" "--regex"))
-#+end_src
------
-**** Support OSX
-Use =open= instead of =xdg-open=.  Modify =counsel-locate-options= for
-OSX, since there =locate= doesn't support =--regex=.
------
-**** Use single quotes for the regex
-See [[https://github.com/abo-abo/swiper/issues/194][#194]].
------
-**** Add initial-input argument
-See [[https://github.com/abo-abo/swiper/issues/289][#289]].
------
-*** =counsel-org-tag=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-org-tag
-:END:
-**** Now works in agenda
-See [[https://github.com/abo-abo/swiper/issues/200][#200]].
------
-*** =counsel-unicode-char=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-unicode-char
-:END:
-**** Add own history
-*** =counsel-M-x=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-m-x
-:END:
-**** Add "definition" action
-Use ~M-o d~ to jump to definition.
------
-**** Show =current-prefix-arg= in the prompt
-See [[https://github.com/abo-abo/swiper/issues/287][#287]].
------
-*** =counsel-find-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-find-file
-:END:
-**** Input '/sudo::' goes to current directory instead of root's home
-See [[https://github.com/abo-abo/swiper/issues/283][#283]].
------
-**** Fix directory validity check
-See [[https://github.com/abo-abo/swiper/issues/283][#283]] 
[[https://github.com/abo-abo/swiper/issues/284][#284]].
------
-**** Improve TRAMP support
-Selecting items after ~//~ now works properly.
------
-*** =counsel-git-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-git-grep
-:END:
-**** Use prefix arg to specify the shell command.
-Remember to use ~M-i~ to insert the current candidate into the
-minibuffer.
-
-See [[https://github.com/abo-abo/swiper/issues/244][#244]].
------
-**** Allow =counsel-git-grep= -> =ivy-occur= -> =wgrep=
-Using ~C-c C-o~ (=ivy-occur=) while in =counsel-git-grep= will produce
-a =wgrep=-compatible buffer.
------
-**** =ivy-occur= gives full candidates
-This means that the =" | head -n 200"= speed-up isn't used and full
-candidates are returned.
------
-*** =counsel--find-symbol=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel--find-symbol
-:END:
-**** Allow to jump back with pop-tag-mark
-Using ~C-.~ in:
-
-- =counsel-describe-function=
-- =counsel-describe-variable=
-- =counsel-load-library=
-
-will change the current buffer. The buffer and point can be restored
-with ~M-*~ (=pop-tag-mark=).
-
-I also recommend this binding:
-
-#+begin_src elisp
-(global-set-key (kbd "M-,") 'pop-tag-mark)
-#+end_src
------
-**** Resolve the name clash better
-When the symbol is both bound and fbound, prefer the fbound one,
-unless the =:caller= is =counsel-describe-variable=.
------
-*** =counsel-ag=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-counsel-ag
-:END:
-**** Add =initial-directory=
-Support alternative initial directory which helps other packages call
-this function with their unique starting directory.
------
-**** Fix on Windows
-Using the "--vimgrep" argument improves things.
-** New Commands
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nf-new-commands
-:END:
-*** =ivy-occur=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-ivy-occur
-:END:
-Bound to ~C-c C-o~. Store the current completion session to its own
-buffer.  You can have an unlimited amount of these buffers.
------
-*** =ivy-avy=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-ivy-avy
-:END:
-Bound to ~C-'~.
-
-Speeds up selecting a candidate that's currently visible in the minibuffer.
------
-*** =ivy-kill-ring-save=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-ivy-kill-ring-save
-:END:
-Bound to ~M-w~.
-
-When the region is active, call =kill-ring-save=.  Otherwise, store
-all selected candidates to the kill ring.
------
-*** =ivy-dispatching-call=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-ivy-dispatching-call
-:END:
-Bound to ~C-M-o~.
-
-This is a non-exiting version of ~M-o~ (=ivy-dispatching-done=).
------
-*** =ivy-read-action=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-ivy-read-action
-:END:
-Bound to ~C-M-a~. Select the current action. Don't call it yet.
------
-*** =swiper-multi=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-swiper-multi
-:END:
-Use =swiper= in multiple buffers.
-See [[https://github.com/abo-abo/swiper/issues/182][#182]].
-
-Basic usage tips for selecting multiple buffers:
-
-- Use ~C-M-m~ (=ivy-call=) to add or remove one more buffer without exiting.
-- Use ~C-m~ (=ivy-done=) to add one last buffer.
-- Or use ~C-M-j~ (=ivy-immediate-done=) to finish without adding more buffers.
-- Hold ~C-M-n~ (=ivy-next-line-and-call=) to add a lot of buffers at once.
------
-*** =swiper-mc=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-swiper-mc
-:END:
-Open multiple cursors at all selected candidates.
------
-*** =swiper-all=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-swiper-all
-:END:
-New command to launch =swiper= for all open file buffers.  Note that
-this can be excruciatingly slow if you don't clean up your buffer list
-often.
------
-*** =counsel-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-counsel-grep
-:END:
-This is essentially =swiper= for huge files. It's not as smooth as
-=swiper= for small files, but has a faster startup and faster matching
-for files that measure in megabytes.
------
-*** =counsel-git-grep-query-replace=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-counsel-git-grep-query-replace
-:END:
-Bound to ~M-q~. Perform =query-replace= on all matches in all buffers.
------
-*** =counsel-jedi=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-counsel-jedi
-:END:
-Complete Python symbols using Jedi.
------
-*** =counsel-cl=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-counsel-cl
-:END:
-Complete Common Lisp symbols using SLIME.
------
-*** =counsel-yank-pop=
-:PROPERTIES:
-:CUSTOM_ID: 0-7-0-nc-counsel-yank-pop
-:END:
-Give completion for inserting from the kill ring.
-See =counsel-yank-pop-truncate= defcustom and 
[[https://github.com/abo-abo/swiper/issues/218][#218]].
------
-* 0.8.0
-:PROPERTIES:
-:CUSTOM_ID: 0.8.0
-:END:
------
-** Package rename
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-package-rename
-:END:
-Due to popular demand, =swiper-0.7.0= is succeeded by =ivy-0.8.0= in GNU
-ELPA. The contents of the package don't change, only the name. Make
-sure to remove the =~/.emacs.d/elpa/swiper-0.7.0= directory if you
-have it and ~M-x~ =package-install ivy=.
-** Documentation
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-documentation
-:END:
-HTML documentation is available at http://oremacs.com/swiper/.
-
-Texinfo documentation is in doc/ivy.texi.
-
-The HTML file shouldn't be in this repository to avoid bloat, instead
-it's in the gh-pages branch at
-https://github.com/abo-abo/swiper/tree/gh-pages.
-** Fixes
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fixes
-:END:
-*** =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-read
-:END:
-**** Fix recursive minibuffer exit with ~C-g~
-Make it so e.g. ~C-h f C-h v C-g~ goes back to the =describe-function= 
selection.
------
-**** Ensure the return result
-In some cases, =read-from-minibuffer= will return the whole minibuffer
-contents (i.e. all available candidates). Return =ivy--current= instead.
------
-**** Properly support matching ignoring order
-See [[https://github.com/abo-abo/swiper/issues/296][#296]] and 
[[https://github.com/abo-abo/swiper/issues/329][#329]].
------
-**** Insert intermediate candidates during async completions
-See [[https://github.com/abo-abo/swiper/issues/340][#340]].
------
-**** Initialize =ivy-last= to empty state
-See [[https://github.com/abo-abo/swiper/issues/352][#352]].
------
-**** Fix extra actions for =completing-read=
-See [[https://github.com/abo-abo/swiper/issues/337][#337]].
------
-**** Support a list of symbols as collection
-See [[https://github.com/abo-abo/swiper/issues/375][#375]].
------
-**** Define =setq-local= and =defvar-local= unless defined
-With this commit, Ivy works on emacs-24.2.
-See [[https://github.com/abo-abo/swiper/issues/415][#415]].
------
-**** Make ~M-o~ not modify the action
-See [[https://github.com/abo-abo/swiper/issues/454][#454]].
------
-**** Make sure user keybindings are respected
-See [[https://github.com/abo-abo/swiper/issues/466][#466]].
------
-**** Fix =read-file-name= with a specified dir
-See [[https://github.com/abo-abo/swiper/issues/475][#475]].
------
-**** Don't highlight the match in the file part
-See [[https://github.com/abo-abo/swiper/issues/483][#483]].
------
-**** Add a few tests for alists
------
-*** =ivy-occur=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-occur
-:END:
-**** Fix =default-directory=
-This way, =next-error= etc will work properly.
------
-*** =ivy--resize-minibuffer-to-fit=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy--resize-minibuffer-to-fit
-:END:
-**** Fix for small delta
-See [[https://github.com/abo-abo/swiper/issues/339][#339]].
------
-**** Check =frame-root-window-p=
-See [[https://github.com/abo-abo/swiper/issues/380][#380]].
------
-*** =ivy-completing-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-completing-read
-:END:
-**** Use =completing-read-default= for tmm
-See [[https://github.com/abo-abo/swiper/issues/316][#316]].
------
-*** =ivy--regex-plus=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy--regex-plus
-:END:
-**** Recognize ! at the beginning of the str
-See [[https://github.com/abo-abo/swiper/issues/318][#318]].
------
-**** Prettify a bit
-See [[https://github.com/abo-abo/swiper/issues/344][#344]].
------
-**** Don't consider =\\(?...\)= a group
-See [[https://github.com/abo-abo/swiper/issues/393][#393]].
------
-*** =ivy--get-window=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy--get-window
-:END:
-**** Always return a valid window
-Even if =state= is invalid.
------
-*** =ivy--recompute-index=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy--recompute-index
-:END:
-**** Update =cl-position= logic
-See [[https://github.com/abo-abo/swiper/issues/207][#207]].
------
-*** =ivy-reverse-i-search=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-reverse-i-search
-:END:
-**** Fix due to recursive update
-See [[https://github.com/abo-abo/swiper/issues/323][#323]].
------
-*** =ivy--reset-state=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy--reset-state
-:END:
-**** Don't null =initial-input=
-This is specifically for ='read-file-name-internal= collection.  The
-input needs to be set to nil for e.g. =rgrep=, which supplies the
-*absolute* path as =initial-input=, resulting in a mess.
-
-For now, don't set input to nil if =:action= was passed to =ivy-read=.
-See [[https://github.com/abo-abo/swiper/issues/336][#336]].
------
-**** Don't deactivate region
-See [[https://github.com/abo-abo/swiper/issues/377][#377]].
------
-*** =ivy-completion-in-region=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-completion-in-region
-:END:
-**** Use =completion-all-completions=
-See [[https://github.com/abo-abo/swiper/issues/341][#341]].
------
-**** Optimize for 1 candidate
-When there's only one candidate, call the action immediately.
------
-**** Add feedback for 1 candidate
-When the sole completion is the same as the input, notify the user.
-See [[https://github.com/abo-abo/swiper/issues/350][#350]].
------
-**** Bind =completion-ignore-case=
-It's convenient to have it the same value as =case-fold-search=.
------
-*** =ivy-read-action=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-read-action
-:END:
-**** Give enough minibuffer space
-See [[https://github.com/abo-abo/swiper/issues/402][#402]].
------
-**** Allow to customize the action hint formatter
-See [[https://github.com/abo-abo/swiper/issues/469][#469]].
------
-*** =ivy-count-format=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-count-format
-:END:
-**** Fix for nil value
-See [[https://github.com/abo-abo/swiper/issues/349][#349]].
------
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-switch-buffer
-:END:
-**** Don't fall back to =switch-to-buffer=
-See [[https://github.com/abo-abo/swiper/issues/410][#410]].
------
-*** =ivy-next-history-element=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-next-history-element
-:END:
-**** 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.
-
-Fixes [[https://github.com/abo-abo/swiper/issues/409][#409]].
------
-*** =ivy-occur-press=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-occur-press
-:END:
-**** Pulse no longer
-Repeated pulses within a short time span resulted in horrible window
-flickering.
------
-*** =ivy-resume=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-resume
-:END:
-**** Add a guard against null =:action=
------
-*** =ivy-avy=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-avy
-:END:
-**** Make ~C-g~ cancel gracefully
-See abo-abo/avy[[https://github.com/abo-abo/swiper/issues/140][#140]].
------
-*** =ivy-dispatching-done=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-ivy-dispatching-done
-:END:
-Allow to exit with no candidates.
------
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-swiper
-:END:
-**** Improve for multiple occurrences on one line
-See [[https://github.com/abo-abo/swiper/issues/314][#314]].
------
-**** Fix "backward" search
-When none of the previous candidates after the point match the current
-input, instead of returning 0, return the index of the last matching
-candidate.  This is a good choice, because that candidate is the
-closest to the point of the initial search start.
-
-See [[https://github.com/abo-abo/swiper/issues/319][#319]].
------
-**** Return point
-See [[https://github.com/abo-abo/swiper/issues/370][#370]].
------
-**** Update =regexp-search-ring=
-See [[https://github.com/abo-abo/swiper/issues/89][#89]].
------
-**** Always remove '(field) text property
-Allows to search better in modes for shell interaction.
------
-*** =swiper-font-lock-ensure=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-swiper-font-lock-ensure
-:END:
-**** Add modes
-Add bongo-library-mode, bongo-playlist-mode, sauron-mode.
-
-See [[https://github.com/abo-abo/swiper/issues/19][#19]].
------
-**** Don't fail when font-lock is off
-See [[https://github.com/abo-abo/swiper/issues/400][#400]].
------
-*** =swiper--multi-candidates=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-swiper--multi-candidates
-:END:
-**** Add check for =make-string=
-See [[https://github.com/abo-abo/swiper/issues/481][#481]].
------
-*** =counsel--async-sentinel=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-counsel--async-sentinel
-:END:
-**** Fix issue with =ivy--regex-ignore-order=
-See [[https://github.com/abo-abo/swiper/issues/342][#342]].
------
-**** Re-display when no cands
-**** Recognize error codes other than 1
-See [[https://github.com/abo-abo/swiper/issues/394][#394]].
------
-*** =counsel-git=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-counsel-git
-:END:
-**** Fix window selection.
-Use =with-ivy-window=, so that each new file chosen with e.g. ~C-M-n~ is
-selected in the same window.
------
-*** =counsel-recoll=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-counsel-recoll
-:END:
-**** Add =:unwind=
-See [[https://github.com/abo-abo/swiper/issues/403][#403]].
------
-*** compilation warnings
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-compilation-warnings
-:END:
-See [[https://github.com/abo-abo/swiper/issues/324][#324]].
------
-** New Features
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-fx-new-features
-:END:
-*** =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-read
-:END:
-**** Use =flx= for highlighting fuzzy matches
-See [[https://github.com/abo-abo/swiper/issues/207][#207]].
------
-**** Simplify the signature for =:dynamic-collection= functions
-When given =:dynamic-collection=, assume the collection function only
-needs one argument - the string input.
------
-**** Modify ~M-n~ prediction when region is active
-When the region is active and ~M-n~ is called, insert the region
-contents into the minibuffer and deactivate the region. The region
-deactivation is done for =swiper=, to make it easier to search for
-multiple words or a subword.
------
-**** Allow to compose collections
-***** Example 1: async collection
-Stack =recentf= on top of =counsel-locate=:
-
-#+begin_src elisp
-(defun small-test ()
-  (cl-subseq recentf-list 0 10))
-
-(ivy-set-sources
- 'counsel-locate
- '((small-test)
-   (original-source)))
-#+end_src
-
-Here, (original-source) represents the async candidates of
-=counsel-locate=. All extra sources are static - each function is called
-once to generate a list of strings, which will be filtered later.
-
-The order matters, so you can have e.g.:
-
-#+begin_src elisp
-(ivy-set-sources
- 'counsel-locate
- '((original-source)
-   (small-test)))
-#+end_src
-
-See [[https://github.com/abo-abo/swiper/issues/373][#373]].
------
-***** Example 2: sync collection
-#+begin_src elisp
-(defun my-extra-source ()
-  (append
-   (when (eq 'Git (vc-backend (buffer-file-name)))
-     (list "git1" "git2" "git3"))
-   (when (file-exists-p "doc/Changelog.org")
-     (list (propertize "doc/Changelog.org" 'face '(:background "red"))))))
-
-(defun my-find-file ()
-  (interactive)
-  (ivy-read "Find file: " 'read-file-name-internal
-            :action (lambda (x)
-                      (with-ivy-window
-                        (find-file (expand-file-name x ivy--directory))))
-            :require-match 'confirm-after-completion
-            :history 'file-name-history
-            :caller 'my-find-file))
-
-(ivy-set-sources
- 'my-find-file
- '((my-extra-source)
-   (original-source)))
-#+end_src
-
-The function =my-find-file= knows nothing about the extra source, it's
-only purpose is to introduce a =:caller= to attach things to, as to not
-to mess up e.g. =counsel-find-file=.
-
-The function =my-extra-source= gets called once in =ivy-read= via
-=ivy--reset-state=. It takes no args and returns a list of strings,
-possibly empty.
------
-**** Improve documentation UI
-Bind ~C-h m~ to =ivy-help=.
-
-=ivy-help-file= is a new defvar pointing to the ivy-help.org file.
-
-Bind ~D~ in =hydra-ivy= to go to hydra's definition.
-
-See [[https://github.com/abo-abo/swiper/issues/376][#376]] and 
[[https://github.com/abo-abo/swiper/issues/379][#379]].
------
-**** Add ignore pattern toggling
-~C-c C-a~ is bound to =ivy-toggle-ignore= - a 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=.
-
-See [[https://github.com/abo-abo/swiper/issues/369][#369]].
------
-*** =ivy-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-mode
-:END:
-**** Set =completion-in-region-function=
-See [[https://github.com/abo-abo/swiper/issues/331][#331]].
------
-**** Improve ~M-n~ for ='read-file-name-internal=
------
-*** =ivy-set-occur=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-set-occur
-:END:
-Allows to customize =ivy-occur= per-command.
------
-**** Add custom occur for =ivy-switch-buffer=
-See [[https://github.com/abo-abo/swiper/issues/438][#438]] and 
[[https://github.com/abo-abo/swiper/issues/440][#440]].
------
-*** =ivy-occur-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-occur-mode
-:END:
-**** New commands on ~j~, ~k~, ~c~
-(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=.
-
-Example:
-
-- ~C-h f~ (=describe-funtion=)
-- =run= (=self-insert-command=)
-- ~C-c C-o~ (=ivy-occur=); ~C-o u~ also works.
-- ~cjjjjkkkk~
------
-**** New command =ivy-occur-revert-buffer= on ~g~
-Does what e.g. =revert-buffer= does for *Help* buffers.
-
-Has special handling for =counsel-git-grep=, =counsel-ag= and
-=counsel-grep=: will run the shell command once more and reflect the
-updates in files.
-
-Move =ivy-occur-press= from ~g~ to ~f~.
------
-**** Improve the feedback for ~j~ and ~k~
-The overlays will be more responsive now.
------
-*** =ivy-re-builders-alist=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-re-builders-alist
-:END:
-**** Allow =this-command= to be a key
-Example:
-#+begin_src elisp
-(defun asdf ()
-  (interactive)
-  (completing-read "prompt: " '("abc" "abcd" "def")))
-
-(global-set-key (kbd "C-c t") 'asdf)
-
-(setq ivy-re-builders-alist
-      '(
-        (asdf . ivy--regex-fuzzy)
-        (t . ivy--regex-plus)))
-#+end_src
-This is useful for commands that you didn't write. For new commands
-that you write, consider using =ivy-read= and =:caller=.
-
-See [[https://github.com/abo-abo/swiper/issues/330][#330]].
------
-*** =ivy-set-actions=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-set-actions
-:END:
-**** Call with =t= to affect all commands
-Example:
-
-#+begin_src elisp
-(ivy-set-actions
- t
- '(("i" insert "insert")))
-#+end_src
-
-Now an "insert" action will be available for all =ivy-read= sessions
-when pressing ~M-o~.
-
-See [[https://github.com/abo-abo/swiper/issues/337][#337]].
------
-*** =ivy-faces=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-faces
-:END:
-New defcustom group.
-See [[https://github.com/abo-abo/swiper/issues/389][#389]].
------
-*** =ivy-flx-limit=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-flx-limit
-:END:
-New variable. Configure when =flx= is used.
-See [[https://github.com/abo-abo/swiper/issues/207][#207]].
------
-*** =ivy-inhibit-action=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-inhibit-action
-:END:
-New variable. See [[https://github.com/abo-abo/swiper/issues/363][#363]].
------
-*** =ivy-do-completion-in-region=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-do-completion-in-region
-:END:
-New defcustom. See [[https://github.com/abo-abo/swiper/issues/367][#367]].
------
-*** =ivy-fixed-height-minibuffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-fixed-height-minibuffer
-:END:
-New defcustom.
-
-When non nil, fix the height of the minibuffer during ivy completion
-at =ivy-height=. This effectively sets the minimum height at this level
-and tries to ensure that it does not change depending on the number of
-candidates.
-
-See [[https://github.com/abo-abo/swiper/issues/353][#353]].
------
-*** =ivy-set-display-transformer=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-set-display-transformer
-:END:
-New API function.
-
-Now used by =switch-to-buffer= and =read-file-name=.
-
-See [[https://github.com/abo-abo/swiper/issues/399][#399]].
------
-*** =ivy-ignore-buffers=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-ignore-buffers
-:END:
-New defcustom similar to =ido-ignore-buffers=.
-
-See [[https://github.com/abo-abo/swiper/issues/382][#382]] and 
[[https://github.com/abo-abo/swiper/issues/366][#366]].
------
-*** =ivy-add-newline-after-prompt=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-add-newline-after-prompt
-:END:
-New defcustom.
-
-See [[https://github.com/abo-abo/swiper/issues/451][#451]].
------
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-switch-buffer
-:END:
-**** Add virtual views
-=ivy-views= variable stores pre-defined views. Allows to set a window
-configuration with many buffers from =ivy-switch-buffer=.
-
-How to use: just set =ivy-views= appropriately. An example value is
-provided (but nulled, so that it's empty initially).
------
-*** =ivy-use-ignore-default=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-ivy-use-ignore-default
-:END:
-New defcustom
-
-See [[https://github.com/abo-abo/swiper/issues/477][#477]].
------
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-swiper
-:END:
-**** Improve =swiper-query-replace=
-To replace a symbol with a similar symbol,
-
-1. Press ~C-s M-n~ for =swiper= and select the symbol at point as input.
-2. Press ~M-q~ for =swiper-query-replace=
-3. Press ~M-n~ to yank the symbol to replace.
-4. Edit the replacement and ~RET~.
-
-Here step-3 was modified to yank e.g. "symbol" instead of
-"\_<symbol\_>" previously.
------
-*** =swiper-font-lock-exclude=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-swiper-font-lock-exclude
-:END:
-New variable for major modes that misbehave with =font-lock-ensure=.
-See [[https://github.com/abo-abo/swiper/issues/346][#346]].
------
-*** =swiper-all=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-swiper-all
-:END:
-**** New auto-updates position
-See [[https://github.com/abo-abo/swiper/issues/401][#401]].
------
-*** =counsel-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-mode
-:END:
-A minor-mode that remaps built-in functions that have counsel
-replacements available.
-
-See [[https://github.com/abo-abo/swiper/issues/414][#414]].
------
-**** Allow use of describe-prefix-bindings
-See [[https://github.com/abo-abo/swiper/issues/441][#441]].
------
-*** =counsel-find-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-find-file
-:END:
-**** Add =initial-input=
-See [[https://github.com/abo-abo/swiper/issues/336][#336]].
------
-**** Change tramp prompt from "Find File: " to "address@hidden: "
-**** Bind =counsel-up-directory= to ~C-DEL~
-New function that moves up to the parent directory and at the same
-time preselects the current directory. This is useful for moving up
-and down a file tree quickly.
-
-See [[https://github.com/abo-abo/swiper/issues/343][#343]].
------
-**** Customize =M-n= action
-This feature allows to quickly visit Github issues from either
-=magit-commit-mode= or from a version-controlled file. The point has to
-be at the "#" char in e.g. 
"[[https://github.com/abo-abo/swiper/issues/123][#123]]";, that represents an 
issue.
-
-It's possible to customize =ivy-ffap-url-functions= to do a similar
-thing for places other than Github.
-
-The ~C-x C-f M-n~ key binding will work better with =counsel-find-file=,
-for plain =find-file= it will open a =dired= buffer in addition to opening
-the URL.
------
-**** Can un-ignore dotfiles with a leading dot input
-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.
-
-See [[https://github.com/abo-abo/swiper/issues/408][#408]].
------
-**** Bind ~M-o f~ to =find-file-other-window=
-**** Correctly expand file name at point
-See [[https://github.com/abo-abo/swiper/issues/430][#430]].
------
-**** Add display transformer
-See [[https://github.com/abo-abo/swiper/issues/458][#458]].
------
-**** Add magic slash that changes the directory
-Update to the behavior: the slash ("/") will enter a directory even if
-its name isn't completely typed out if either:
-
-1. It's the only candidate.
-2. The candidate index isn't 0, i.e. "C-n" has been typed at least once.
-3. The input isn't "/".
-
-The above rules still allow to keep the old behavior with "//" moving
-to root and "/ssh:" opening tramp.
-
-This is an experimental feature, please report if it breaks someone's
-workflow.
-
-See [[https://github.com/abo-abo/swiper/issues/321][#321]] and 
[[https://github.com/abo-abo/swiper/issues/480][#480]].
------
-*** =counsel-git-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-git-grep
-:END:
-**** Bind ~C-c C-m~ to =counsel-git-grep-switch-cmd=
-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.
-
-See [[https://github.com/abo-abo/swiper/issues/420][#420]].
------
-*** =counsel-locate=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-locate
-:END:
-**** counsel-locate-cmd
-New defcustom that replaces =counsel-locate-options=.
-
-See [[https://github.com/abo-abo/swiper/issues/385][#385]].
------
-**** counsel-locate-cmd-mdfind
-New function.
-See [[https://github.com/abo-abo/swiper/issues/390][#390]].
------
-**** counsel-locate-cmd-es
-New function.
-See [[https://github.com/abo-abo/swiper/issues/426][#426]].
------
-*** =counsel-yank-pop=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-yank-pop
-:END:
-**** Truncate during display
-During the completion, only the context around the match will be shown.
-By default, the context is +2 lines above and +2 lines below the match.
-It can be adjusted with =counsel-yank-pop-truncate-radius=.
-Additionally, =ivy-height= is temporarily bound to 5 during completion.
-This way, the maximum minibuffer height should be 1+4*5=21 lines.
-
-See [[https://github.com/abo-abo/swiper/issues/315][#315]].
------
-*** =counsel-unicode-char=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-unicode-char
-:END:
-Display hex codes in left column.
------
-*** =counsel-rhythmbox=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-rhythmbox
-:END:
-**** Preselect the current song
------
-*** =counsel-ag=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-ag
-:END:
-**** =counsel-ag-base-command=
-Allows the command run by =counsel-ag-function= to be customized. There
-are several reasons to allow this: The vimgrep option is a recent
-addition; on windows it's more convenient to use pt; and the user
-might want to customize ignored files.
-
-Standard value:
-#+begin_src elisp
-(setq counsel-ag-base-command "ag --nocolor --nogroup %s -- .")
-#+end_src
-
-See [[https://github.com/abo-abo/swiper/issues/335][#335]].
------
-**** Add dir prompt for ~C-u~
-See [[https://github.com/abo-abo/swiper/issues/429][#429]].
------
-**** Add =counsel-ag-map=
-See [[https://github.com/abo-abo/swiper/issues/462][#462]].
------
-*** =counsel-async-split-string-re=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-async-split-string-re
-:END:
-New defcustom.
------
-*** =counsel--async-cmd=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel--async-cmd
-:END:
-**** Add optional exit-code table
-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.
-
-See [[https://github.com/abo-abo/swiper/issues/421][#421]].
------
-*** =counsel-prompt-function=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-prompt-function
-:END:
-New defcustom
-
-See [[https://github.com/abo-abo/swiper/issues/424][#424]] and 
[[https://github.com/abo-abo/swiper/issues/425][#425]].
------
-*** =counsel-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-grep
-:END:
-**** Reveal outlines
-Just like =swiper=.
------
-**** Should pick candidates closest to point
-Fixes the algorithm selecting the first matching candidate in case
-there are 0 matching candidates following point. Now the last matching
-candidate will be selected, resulting in less scrolling.
------
-**** Speed up x40 times
-The default shell command will not use =--ignore-case= switch for
-=grep=. It's a bit less convenient, but results in a huge speed-up.
------
-*** =counsel-M-x=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-counsel-m-x
-:END:
-**** Add help action
-Bound to ~M-o h~ by default.
-
-See [[https://github.com/abo-abo/swiper/issues/452][#452]].
-** New Commands
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nf-new-commands
-:END:
-*** =counsel-tmm=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-tmm
-:END:
-Completion for the menu bar items. For example:
-
-=counsel-tmm= -> =Options= -> =Set Default Font...=.
-
-Thanks to completion, the latter stages of the chain would look like: =op= 
~RET~ =set= ~RET~.
------
-*** =counsel-imenu=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-imenu
-:END:
-Jump to a buffer position indexed by imenu.
------
-*** =counsel-decbinds=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-decbinds
-:END:
-Show a list of all defined keys, and their definitions. Describe the
-selected candidate.
-See [[https://github.com/abo-abo/swiper/issues/332][#332]].
------
-*** =counsel-list-processes=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-list-processes
-:END:
-Offer completion for =process-list=
-
-The default action deletes the selected process.  An extra action
-allows to switch to the process buffer.
-
-See [[https://github.com/abo-abo/swiper/issues/357][#357]] and 
[[https://github.com/abo-abo/swiper/issues/398][#398]].
------
-*** =ivy-switch-buffer-other-window=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-ivy-switch-buffer-other-window
-:END:
-Remap =switch-to-buffer-other-window= to =ivy-switch-buffer-other-window= for 
=ivy-mode=.
-
-See [[https://github.com/abo-abo/swiper/issues/361][#361]].
------
-*** =counsel-git-stash=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-git-stash
-:END:
-Search through all available git stashes.
-
-See [[https://github.com/abo-abo/swiper/issues/374][#374]].
------
-*** =counsel-git-log=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-git-log
-:END:
-Call the =git log --grep= shell command and search through the output.
------
-*** =counsel-pt=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-pt
-:END:
-Grep for a string in the current directory using pt.
-
-See [[https://github.com/abo-abo/swiper/issues/434][#434]].
------
-*** =counsel-linux-app=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-linux-app
-:END:
-Launch a Linux desktop application, similar to Alt-<F2>.
-
-See [[https://github.com/abo-abo/swiper/issues/446][#446]].
------
-*** =counsel-ace-link=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-ace-link
-:END:
-Ivy completion for =ace-link=.
------
-*** =counsel-esh-history=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-esh-history
-:END:
-Browse Eshell history.
-
-See [[https://github.com/abo-abo/swiper/issues/459][#459]].
------
-*** =counsel-shell-history=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-shell-history
-:END:
-Browse shell history.
------
-*** =counsel-grep-or-swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-8-0-nc-counsel-grep-or-swiper
-:END:
-New command: automatically use =swiper= for smaller buffers and
-=counsel-grep= for larger buffers.
-
-Adjust with:
-#+begin_src elisp
-(setq counsel-grep-swiper-limit 300000)
-#+end_src
-
-By default, the splitting predicate is 300K bytes in a file.
------
-#+BEGIN_EXPORT html
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-#+END_EXPORT
-* 0.9.0
-:PROPERTIES:
-:CUSTOM_ID: 0.9.0
-:END:
------
-** Fixes
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fixes
-:END:
-*** =colir-parse-color=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-colir-parse-color
-:END:
-Fix color parsing in terminal. See 
[[https://github.com/abo-abo/swiper/issues/541][#541]] and 
[[https://github.com/abo-abo/swiper/issues/543][#543]].
------
-*** =counsel--gg-sentinel=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel--gg-sentinel
-:END:
-Check for an additional 141 return code.
------
-*** =counsel-ace-link=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-ace-link
-:END:
-Use =cdr= for action. See 
[[https://github.com/abo-abo/swiper/issues/835][#835]].
------
-*** =counsel-ag=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-ag
-:END:
-**** Use sync on remote
-See [[https://github.com/abo-abo/swiper/issues/669][#669]].
-**** Add missing parameter
-See [[https://github.com/abo-abo/swiper/issues/858][#858]], 
[[https://github.com/abo-abo/swiper/issues/861][#861]].
------
-*** =counsel-find-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-find-file
-:END:
-**** Improve stability on arcane systems
-It can happen that =(all-completions "" 'read-file-name-internal)= may
-fail on systems with symlinks. I think it's related to the file
-functions trying to compute occupied space. In any case, a plain
-=directory-files= is roughly the equivalent and is less likely to fail.
-**** Check compat between preselect and initial-input
-See [[https://github.com/abo-abo/swiper/issues/514][#514]], 
[[https://github.com/abo-abo/swiper/issues/515][#515]].
-**** Prevent expand-file-name nil
-See [[https://github.com/abo-abo/swiper/issues/518][#518]].
-**** Don't crash if default-directory is nil
-See [[https://github.com/abo-abo/swiper/issues/586][#586]].
-**** Allow to ~C-y~ a "/ssh:" file
-**** Press ~M-n~ on issue works for newer magit version
-See [[https://github.com/abo-abo/swiper/issues/692][#692]].
-**** Fix when initial input is a file name
-See [[https://github.com/abo-abo/swiper/issues/744][#744]].
-**** Account for =file-name-directory= returning nil
-See [[https://github.com/abo-abo/swiper/issues/780][#780]].
-**** Fix ~RET~ on no input
-See [[https://github.com/abo-abo/swiper/issues/782][#782]].
-**** Fix ~RET~ when file exists
-See [[https://github.com/abo-abo/swiper/issues/792][#792]].
------
-*** =counsel-git=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-git
-:END:
-**** Add a better error message.
-See [[https://github.com/abo-abo/swiper/issues/537][#537]].
-**** Add ~x~ action
-To open externally.
------
-*** =counsel-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-grep
-:END:
-Quote =:preselect=.
------
-*** =counsel-grep-or-swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-grep-or-swiper
-:END:
-Don't grep on compressed files. See 
[[https://github.com/abo-abo/swiper/issues/536][#536]].
------
-*** =counsel-imenu=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-imenu
-:END:
-**** Improve readability
-See [[https://github.com/abo-abo/swiper/issues/558][#558]].
-**** Force rescan if requested
-See [[https://github.com/abo-abo/swiper/issues/631][#631]].
------
-*** =counsel-info-lookup-symbol=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-info-lookup-symbol
-:END:
-Fix doc, see [[https://github.com/abo-abo/swiper/issues/721][#721]].
-Add preselect, see [[https://github.com/abo-abo/swiper/issues/722][#722]].
------
-*** =counsel-linux-app=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-linux-app
-:END:
-**** Don't quit on bad data
-See [[https://github.com/abo-abo/swiper/issues/604][#604]].
-**** Check if dir exists
-See [[https://github.com/abo-abo/swiper/issues/896][#896]].
------
-*** =counsel-load-theme=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-load-theme
-:END:
-Add noconfirm flag in =counsel-load-theme-action=.
------
-*** =counsel-locate=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-locate
-:END:
-**** Make =counsel-locate-action-extern= interactive
-See [[https://github.com/abo-abo/swiper/issues/605][#605]].
-**** Add w32 support to =counsel-locate-action-extern=
-See [[https://github.com/abo-abo/swiper/issues/607][#607]], 
[[https://github.com/abo-abo/swiper/issues/688][#688]].
------
-*** =counsel-M-x=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-m-x
-:END:
-**** Fix interaction with =repeat=
-See [[https://github.com/abo-abo/swiper/issues/564][#564]].
-**** Preserve =last-command=
-See [[https://github.com/abo-abo/swiper/issues/891][#891]], 
[[https://github.com/abo-abo/swiper/issues/893][#893]].
------
-*** =counsel-org-tag-action=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-org-tag-action
-:END:
-Perform in the minibuffer. See 
[[https://github.com/abo-abo/swiper/issues/890][#890]].
------
-*** =counsel-recoll=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-recoll
-:END:
-Add =shell-quote-argument=. See 
[[https://github.com/abo-abo/swiper/issues/713][#713]].
------
-*** =counsel-rhythmbox=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-rhythmbox
-:END:
-No longer depends on =helm-rhythmbox=.
------
-*** =counsel-yank-pop=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-counsel-yank-pop
-:END:
-Fix candidates not showing sometimes.
------
-*** doc
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-doc
-:END:
-**** Fixed typos in the doc
-See [[https://github.com/abo-abo/swiper/issues/497][#497]], 
[[https://github.com/abo-abo/swiper/issues/809][#809]].
-**** Added =ivy-format-function= to the doc
-See [[https://github.com/abo-abo/swiper/issues/577][#577]].
-**** Added info on generating the doc
-See [[https://github.com/abo-abo/swiper/issues/601][#601]].
-**** Added info on associating values
-See [[https://github.com/abo-abo/swiper/issues/714][#714]].
-**** Update package names on ELPA/MELPA
-See [[https://github.com/abo-abo/swiper/issues/833][#833]].
------
-*** =ivy--filter=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--filter-recompute-index-after-filter
-:END:
-Recompute index after filter.
-
-See [[https://github.com/abo-abo/swiper/issues/491][#491]].
------
-*** =ivy--flx-sort=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--flx-sort
-:END:
-Improve. See [[https://github.com/abo-abo/swiper/issues/843][#843]].
------
-*** =ivy--format-minibuffer-line=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--format-minibuffer-line
-:END:
-Fix for =ivy-display-style= nil. See 
[[https://github.com/abo-abo/swiper/issues/828][#828]].
------
-*** =ivy--minibuffer-setup=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--minibuffer-setup
-:END:
-Fix =max-mini-window-height=. See 
[[https://github.com/abo-abo/swiper/issues/732][#732]].
------
-*** =ivy--occur-insert-lines=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--occur-insert-lines
-:END:
-Scroll to first command. See 
[[https://github.com/abo-abo/swiper/issues/829][#829]].
------
-*** =ivy--regex-ignore-order=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--regex-ignore-order
-:END:
-Ensure it returns legal regexps. See 
[[https://github.com/abo-abo/swiper/issues/765][#765]].
------
-*** =ivy--reset-state=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--reset-state
-:END:
-Simplify. See [[https://github.com/abo-abo/swiper/issues/827][#827]].
------
-*** =ivy--virtual-buffers=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy--virtual-buffers
-:END:
-Don't modify recentfs or bookmarks. See 
[[https://github.com/abo-abo/swiper/issues/821][#821]].
------
-*** =ivy-call=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-call
-:END:
-Set =default-directory=, see 
[[https://github.com/abo-abo/swiper/issues/717][#717]], 
[[https://github.com/abo-abo/swiper/issues/760][#760]], 
[[https://github.com/abo-abo/swiper/issues/779][#779]], 
[[https://github.com/abo-abo/swiper/issues/810][#810]].
-Recursive logic, see [[https://github.com/abo-abo/swiper/issues/924][#924]], 
[[https://github.com/abo-abo/swiper/issues/937][#937]].
------
-*** =ivy-completion-in-region=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-completion-in-region
-:END:
-Fix double insert bug.
-Fix common length bug. See 
[[https://github.com/abo-abo/swiper/issues/528][#528]].
-Remove =:require-match=, see 
[[https://github.com/abo-abo/swiper/issues/907][#907]].
------
-*** =ivy-completion-in-region-action=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-completion-in-region-action
-:END:
-Remove string properties, see 
[[https://github.com/abo-abo/swiper/issues/517][#517]].
-Remove =with-ivy-window=, see 
[[https://github.com/abo-abo/swiper/issues/928][#928]].
------
-*** =ivy-fixed-height-minibuffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-fixed-height-minibuffer
-:END:
-Add correction. See [[https://github.com/abo-abo/swiper/issues/737][#737]].
------
-*** =ivy-help-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-help-file
-:END:
-Define with =defconst=, see 
[[https://github.com/abo-abo/swiper/issues/938][#938]].
------
-*** =ivy-hydra= is now a separate package on MELPA
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-hydra-is-now-a-separate-package-on-melpa
-:END:
-See [[https://github.com/abo-abo/swiper/issues/464][#464]], 
[[https://github.com/abo-abo/swiper/issues/512][#512]].
------
-*** =ivy-immediate-done=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-immediate-done
-:END:
-Update docstring, see [[https://github.com/abo-abo/swiper/issues/525][#525]].
------
-*** =ivy-minibuffer-map=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-minibuffer-map
-:END:
-**** Move =ivy-toggle-regexp-quote= from ~M-q~ to ~M-r~.
-See [[https://github.com/abo-abo/swiper/issues/566][#566]].
-**** Remap scroll-up/down-command
-Instead of assigning ~C-v~ / ~M-v~ so page up/down works.
-See [[https://github.com/abo-abo/swiper/issues/797][#797]], 
[[https://github.com/abo-abo/swiper/issues/798][#798]].
-**** Remap =backward-delete-char-untabify= to =ivy-backward-delete-char=
-**** Rebind ~C-v~ and ~M-v~
-The ultimate solution to have PgUp and PgDown and whatever else was
-mapped to =scroll-up-command= bound in =ivy-minibuffer-map=. While
-still having the standard ~C-v~ and ~M-v~ bindings.
-
-See [[https://github.com/abo-abo/swiper/issues/797][#797]], 
[[https://github.com/abo-abo/swiper/issues/798][#798]], 
[[https://github.com/abo-abo/swiper/issues/535][#535]].
------
-*** =ivy-occur-press=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-occur-press
-:END:
-Pass the whole cons cell to action, see 
[[https://github.com/abo-abo/swiper/issues/634][#634]].
------
-*** =ivy-partial=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-partial
-:END:
-Fix for =:dynamic-collection=.
-See [[https://github.com/abo-abo/swiper/issues/946][#946]].
------
-*** =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-read
-:END:
-**** Document all args
-See [[https://github.com/abo-abo/swiper/issues/533][#533]].
-**** Use predicate when reading file names
-See [[https://github.com/abo-abo/swiper/issues/804][#804]].
------
-*** =ivy-remote=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-remote
-:END:
-Use a lighter color for dark themes, see 
[[https://github.com/abo-abo/swiper/issues/646][#646]].
------
-*** =ivy-resume=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-resume
-:END:
-The original =default-directory= will be restored, see 
[[https://github.com/abo-abo/swiper/issues/591][#591]].
------
-*** =ivy-sort-functions-alist=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-sort-functions-alist
-:END:
-Improve. See [[https://github.com/abo-abo/swiper/issues/870][#870]].
------
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-switch-buffer
-:END:
-**** Reset index to 0 on input
-See [[https://github.com/abo-abo/swiper/issues/522][#522]], 
[[https://github.com/abo-abo/swiper/issues/513][#513]].
------
-*** =ivy-switch-buffer-other-window=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-ivy-switch-buffer-other-window
-:END:
-Obey =ivy-ignore-buffers=. See 
[[https://github.com/abo-abo/swiper/issues/745][#745]].
------
-*** Recursive minibuffers with two emacsclients
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-recursive-minibuffers-with-two-emacsclients
-:END:
-See [[https://github.com/abo-abo/swiper/issues/738][#738]].
------
-*** shrink minibuffer after reading actions
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-shrink-minibuffer-after-reading-actions
-:END:
-See [[https://github.com/abo-abo/swiper/issues/764][#764]], 
[[https://github.com/abo-abo/swiper/issues/402][#402]].
------
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-swiper
-:END:
-**** Fix "foo!bar" syntax
-See [[https://github.com/abo-abo/swiper/issues/565][#565]].
-**** Now respects =ivy-re-builders-alist=
-See [[https://github.com/abo-abo/swiper/issues/613][#613]].
-
-Example:
-#+begin_src
-(setq ivy-re-builders-alist
-          '((swiper . ivy--regex-fuzzy)
-            (t . ivy--regex-plus)))
-#+end_src
------
-*** =swiper-avy=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-swiper-avy
-:END:
-Require =avy=, see [[https://github.com/abo-abo/swiper/issues/593][#593]].
------
-*** =swiper-font-lock-exclude=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-swiper-font-lock-exclude
-:END:
-Add =forth-mode=, see [[https://github.com/abo-abo/swiper/issues/526][#526]].
-Add =forth-block-mode=, see 
[[https://github.com/abo-abo/swiper/issues/527][#527]].
-Add =bookmark-bmenu-mode=.
-Add =nix-mode=, see [[https://github.com/abo-abo/swiper/issues/879][#879]].
-Add =circe-mode=, see [[https://github.com/abo-abo/swiper/issues/900][#900]], 
[[https://github.com/abo-abo/swiper/issues/901][#901]].
------
-*** =swiper-multi=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-fx-swiper-multi
-:END:
-Fix regression, See [[https://github.com/abo-abo/swiper/issues/673][#673]].
-Don't use virtual buffers, See 
[[https://github.com/abo-abo/swiper/issues/705][#705]].
------
-** New Features
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-new-features
-:END:
-*** =counsel-ag=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-ag
-:END:
-**** Extend more
-See [[https://github.com/abo-abo/swiper/issues/576][#576]].
-**** Add =counsel-git-cmd=
-See [[https://github.com/abo-abo/swiper/issues/590][#590]].
-**** Prompt for extra args when using prefix arg
-See [[https://github.com/abo-abo/swiper/issues/774][#774]].
-**** Support limiting in files
-See [[https://github.com/abo-abo/swiper/issues/820][#820]], 
[[https://github.com/abo-abo/swiper/issues/822][#822]], 
[[https://github.com/abo-abo/swiper/issues/823][#823]].
-**** =counsel-grep-post-action-hook=
-New hook for counsel-ag/grep/pt. See 
[[https://github.com/abo-abo/swiper/issues/800][#800]], 
[[https://github.com/abo-abo/swiper/issues/751][#751]].
------
-*** =counsel-bookmark=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-bookmark
-:END:
-**** =counsel-bookmark-avoid-dired=
-When non-nil and a directory is selected from =counsel-bookmark=,
-forward the choice to =counsel-find-file= instead of opening a =dired=
-buffer.  See [[https://github.com/abo-abo/swiper/issues/813][#813]].
------
-*** =counsel-find-file=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-find-file
-:END:
-**** Add binding to jump to a bookmarked directory without quit
-Press ~M-o b~ to set the current directory to one of the virtual
-buffers' directories. You continue to select a file from that directory.
-
-See [[https://github.com/abo-abo/swiper/issues/531][#531]].
-**** Add =counsel-find-file-root=
-Press ~M-o r~ to find the current file as root.
-See [[https://github.com/abo-abo/swiper/issues/948][#948]].
------
-*** =counsel-git-grep=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-git-grep
-:END:
-**** Support custom per-project commands
-The idea is to grep several Git repositories at once. For example, my
-Emacs config is a Git repository with many Git submodule repositories
-inside.
-
-When used with ~C-u~, and inside =counsel-git-grep-projects-alist=, use
-the corresponding command instead.  Additionally,
-=counsel-git-grep-proj-function= is used.
-
-For a possible implementation of the custom git-grep command, see:
-https://github.com/abo-abo/oremacs/commit/c7effdb94749dc600b1204ea7a9db319ebdb0f00
-
-See [[https://github.com/abo-abo/swiper/issues/616][#616]].
-**** Reveal text hidden in outlines
-**** Works with "Git for Windows" and native Emacs build
-**** Fix for files with spaces in the name
-See [[https://github.com/abo-abo/swiper/issues/700][#700]].
-**** Fix ~g~ (=counsel-git-grep-occur=)
-Things go wrong when `ivy-text' is changed from the original value.
-Extract =ivy-text= from the buffer name.
-
-Quote the directory name. See 
[[https://github.com/abo-abo/swiper/issues/811][#811]].
-**** Update quoting
-See [[https://github.com/abo-abo/swiper/issues/876][#876]].
-**** =counsel-git-grep-cmd-default=
-The initial value for =counsel-git-grep-cmd=.
------
-*** =counsel-git-log=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-git-log
-:END:
-**** Add =counsel-git-log-cmd=
-Allows to customize the command, see 
[[https://github.com/abo-abo/swiper/issues/652][#652]].
------
-*** =counsel-linux-app=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-linux-app
-:END:
-**** =counsel-linux-apps-directories=
-Customize the search path.
------
-*** =counsel-load-library=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-load-library
-:END:
-**** Allow to find library with an action
-See [[https://github.com/abo-abo/swiper/issues/873][#873]].
------
-*** =counsel-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-mode
-:END:
-**** Bind =counsel-info-lookup-symbol=
-Substitutes =info-lookup-symbol=, see 
[[https://github.com/abo-abo/swiper/issues/493][#493]].
-**** Bind ~C-r~ for =eval-expression= and =shell-command=
-Press ~C-r~ while inside the minibuffer during =eval-expression= or
-=shell-command= to get completion for history.
------
-*** =counsel-pt=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-pt
-:END:
-Add =initial-input= arg. See 
[[https://github.com/abo-abo/swiper/issues/757][#757]].
------
-*** =counsel-unicode-char=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-unicode-char
-:END:
-**** Add leading zeros to the display
-See [[https://github.com/abo-abo/swiper/issues/662][#662]].
-**** Support universal argument
-See [[https://github.com/abo-abo/swiper/issues/868][#868]].
------
-*** =counsel-yank-pop=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-counsel-yank-pop
-:END:
-**** Add =counsel-yank-pop-separator=
-Allows to customize the separator.
-See [[https://github.com/abo-abo/swiper/issues/660][#660]].
------
-*** =ivy=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy
-:END:
-**** completion at point
-- =ivy-display-functions-alist= ::
-    New defcustom, which decides how to display the candidates.
-=ivy-completion-in-region= will use completion at point by default.
-
-Related: [[https://github.com/abo-abo/swiper/issues/707][#707]], 
[[https://github.com/abo-abo/swiper/issues/712][#712]], 
[[https://github.com/abo-abo/swiper/issues/788][#788]].
-**** =ivy-action-wrap=
-Set this to have =ivy-next-action= and =ivy-prev-action= wrap around.
-**** =ivy-add-actions=
-This is a convenience extension to the existing =ivy-set-actions=.
-See [[https://github.com/abo-abo/swiper/issues/470][#470]].
-**** =ivy-case-fold-search= additional value ='always=
-If the value of ivy-case-fold-search is set to 'always, the search is
-always case-insensive, regardless of the input.
-See [[https://github.com/abo-abo/swiper/issues/916][#916]].
-**** =ivy-completion-in-region-action=
-Add support for =multiple-cursors=, see 
[[https://github.com/abo-abo/swiper/issues/547][#547]].
-**** =ivy-highlight-functions-alist=
-Customize the highlighters. See 
[[https://github.com/abo-abo/swiper/issues/691][#691]], 
[[https://github.com/abo-abo/swiper/issues/654][#654]], 
[[https://github.com/abo-abo/swiper/issues/827][#827]].
-**** =ivy-magic-tilde=
-New defcustom. Decide if =~= or =~/= should cd home.
-
-See [[https://github.com/abo-abo/swiper/issues/687][#687]], 
[[https://github.com/abo-abo/swiper/issues/679][#679]].
-**** =ivy-set-prompt=
-Allow to set the prompt using the =:caller= as key.
-**** =ivy-set-prompt-text-properties-function=
-An advanced override of the prompt string.
-**** =ivy-sort-file-function-using-ido=
-Extends the options for sorting file names. See 
[[https://github.com/abo-abo/swiper/issues/498][#498]].
------
-*** =ivy-completing-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy-completing-read
-:END:
-**** Set =:caller= to =this-command=
-Improves sorting customization. See 
[[https://github.com/abo-abo/swiper/issues/899][#899]].
-**** Don't =:require-match= for null
-See [[https://github.com/abo-abo/swiper/issues/909][#909]].
-**** =ivy-completing-read-handlers-alist=
-New defcustom. See [[https://github.com/abo-abo/swiper/issues/892][#892]].
------
-*** =ivy-minibuffer-map=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy-minibuffer-map
-:END:
-**** Alternative action list ~M-o~ using Hydra
-Not hiding the candidates and using a single line for actions results
-in a more distraction-free experience.
-
-Use this code to turn it on:
-#+begin_src elisp
-(require 'ivy-hydra)
-#+end_src
------
-*** =ivy-occur-mode=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy-occur-mode
-:END:
-**** ~RET~ now switches to candidate window
-**** =read-only-mode= is enabled
-See [[https://github.com/abo-abo/swiper/issues/720][#720]].
-**** Set =view-read-only= locally
-See [[https://github.com/abo-abo/swiper/issues/789][#789]].
-**** Run =wgrep-setup=
-See [[https://github.com/abo-abo/swiper/issues/904][#904]].
------
-*** =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy-read
-:END:
-**** Make key binding for other window action consistent
-By default, ~M-o j~ will select the file or buffer in other window, for
-both =ivy-switch-buffer= and =counsel-find-file=.
-**** Facilitate sorting of cons cells
-See [[https://github.com/abo-abo/swiper/issues/554][#554]].
-#+begin_src elisp
-(defvar ivy-sorter-data '(("b 1" . 1) ("a 2" . 2) ("d 0" . 0) ("c 5" . 5)))
-
-(defun isn (a b)
-  (< (cdr a) (cdr b)))
-
-(add-to-list 'ivy-sort-functions-alist '(ivy-sorter . isn))
-
-(ivy-read "string: " ivy-sorter-data
-          :sort t
-          :caller 'ivy-sorter)
-#+end_src
-**** Add prefix arg for action functions
-See [[https://github.com/abo-abo/swiper/issues/552][#552]].
-
-Single actions:
-| C-m     | ivy-done             | store prefix |
-| M-o     | ivy-dispatching-done | store prefix |
-| C-j     | ivy-alt-done         | store prefix |
-| C-M-j   | ivy-immediate-done   | store prefix |
-| TAB TAB | ivy-partial-or-done  | unsupported  |
-| C-'     | ivy-avy              | unsupported  |
-
-Multiple actions:
-| C-M-m | ivy-call                   | store prefix, type prefix again for 
next call |
-| C-M-o | ivy-dispatching-call       | store prefix, type prefix again for 
next call |
-| C-M-n | ivy-next-line-and-call     | store prefix, type prefix again for 
next call |
-| C-M-p | ivy-previous-line-and-call | store prefix, type prefix again for 
next call |
-
-An example application:
-
-no prefix prints first number in a message-box
-one prefix prints last number in a message-box
-numeric prefix selects the index to print in a message-box
-#+begin_src elisp
-(ivy-read "choose: " '(("a" 1 2 3)
-                       ("b" 3 4 5))
-          :action
-          (lambda (x)
-            (message-box "%s"
-                         (cond
-                           ((null ivy-current-prefix-arg)
-                            (elt x 0))
-                           ((equal '(4) ivy-current-prefix-arg)
-                            (car (last x)))
-                           (t
-                            (elt x (prefix-numeric-value 
ivy-current-prefix-arg)))))))
-#+end_src
-**** Breaking change for alist type collection actions
-The action will be called with collection's =ITEM=, instead of =(cdr
-ITEM)= like before. This allows to simplify the logic of complex action
-functions: they don't have to look up the full item by string in their
-own collection, moreover they don't have to know anything about their
-collection.
-**** Implement unique index for alist completion
-The uniqueness assumption is that the completion system is passed a
-list of /unique/ strings, of which one (or more) are selected.
-
-Unlike plain string completion, alists may require violating the
-uniqueness assumption: there may be two elements with the same =car= but
-different =cdr=. Example: C function declaration and definition for tag
-completion.
-
-Until now, whenever two equal strings were sent to =ivy-read=, only the
-first one could be selected. Now, each alist car gets an integer index
-assigned to it as a text property ='idx=. So it's possible to
-differentiate two alist items with the same key.
-**** Make =with-ivy-window= not necessary in the action function
-This allows for a lot of simplification, e.g. use =insert= instead of
-=(lambda (x) (with-ivy-window (insert x)))=.
-
-See [[https://github.com/abo-abo/swiper/issues/639][#639]].
------
-*** =ivy-switch-buffer=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-ivy-switch-buffer
-:END:
-**** Add =ivy-sort-function-buffer=
-Puts e.g. the =*scratch*= buffer ahead of the =misc= buffer if the input
-is "sc", since it's almost like a prefix match.
-
-See [[https://github.com/abo-abo/swiper/issues/595][#595]].
-**** Sort virtual buffers after open buffers
-See [[https://github.com/abo-abo/swiper/issues/706][#706]], 
[[https://github.com/abo-abo/swiper/issues/743][#743]].
-**** =ivy-switch-buffer-faces-alist=
-Allow to customize faces in =ivy-switch-buffer= by the mode of each buffer.
-
-Example:
-#+begin_src elisp
-(setq ivy-switch-buffer-faces-alist
-      '((emacs-lisp-mode . swiper-match-face-1)
-        (dired-mode . ivy-subdir)
-        (org-mode . org-level-4)))
-#+end_src
------
-*** =swiper=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-swiper
-:END:
-**** Add option for swiper line number to be searchable
-See =swiper-include-line-number-in-search= and 
[[https://github.com/abo-abo/swiper/issues/562][#562]].
-**** Restore window position after using swiper.
-Relevant for high settings of =scroll-conservatively=.
-See [[https://github.com/abo-abo/swiper/issues/643][#643]].
-**** Improve fuzzy highlight
-If you've set the regex builder to fuzzy (non-default), you'll get a
-highlight quality on par with the default one.  See 
[[https://github.com/abo-abo/swiper/issues/651][#651]], 
[[https://github.com/abo-abo/swiper/issues/653][#653]].
-**** Add =char-fold-to-regexp=
-See [[https://github.com/abo-abo/swiper/issues/622][#622]].
-**** Add compatibility with =evil-ex-search=
-See [[https://github.com/abo-abo/swiper/issues/887][#887]].
-**** Apply =evil= search highlighting
-See [[https://github.com/abo-abo/swiper/issues/888][#888]].
-**** Set =evil-ex-search-direction=
-See [[https://github.com/abo-abo/swiper/issues/947][#947]].
-**** =swiper-goto-start-of-match=
-New defcustom. When non-nil, swiper default action will go to the
-beginning of the match instead of on its end. This behavior is
-inspired by vim's and evil's way of searching.
-
-See [[https://github.com/abo-abo/swiper/issues/944][#944]], 
[[https://github.com/abo-abo/swiper/issues/942][#942]].
-**** =swiper-avy= works with more regexp builders
-See [[https://github.com/abo-abo/swiper/issues/932][#932]].
------
-*** =swiper-all=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nf-swiper-all
-:END:
-**** Is now async
-This means extremely fast startup time.
-
-Additionally, the feedback to input is quite fast even with a hundred
-buffers. This is because, unlike =swiper=, line numbers are not
-computed. Computing line numbers, while situationally useful, is
-really slow for huge buffers, and even slower for dozens of huge
-buffers.
-
-See [[https://github.com/abo-abo/swiper/issues/620][#620]].
-**** Press ~M-q~ for query-replace
-See [[https://github.com/abo-abo/swiper/issues/623][#623]].
-**** Ignore TAGS buffers
-See [[https://github.com/abo-abo/swiper/issues/787][#787]].
-**** Consider magit stash buffers
-See [[https://github.com/abo-abo/swiper/issues/819][#819]].
-**** Fix =case-fold-search=
-See [[https://github.com/abo-abo/swiper/issues/880][#880]].
------
-** New Commands
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-new-commands
-:END:
-*** =counsel-bookmark=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-bookmark
-:END:
-Completion for =bookmark-jump=.
-
-Can delete and rename bookmarks, see 
[[https://github.com/abo-abo/swiper/issues/758][#758]].
------
-*** =counsel-colors-emacs=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-colors-emacs
-:END:
-See [[https://github.com/abo-abo/swiper/issues/815][#815]], 
[[https://github.com/abo-abo/swiper/issues/921][#921]].
------
-*** =counsel-colors-web=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-colors-web
-:END:
-See [[https://github.com/abo-abo/swiper/issues/815][#815]].
------
-*** =counsel-command-history=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-command-history
-:END:
-See [[https://github.com/abo-abo/swiper/issues/826][#826]].
------
-*** =counsel-company=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-company
-:END:
-Picks up company's candidates and inserts the result into the buffer.
-See [[https://github.com/abo-abo/swiper/issues/331][#331]], 
[[https://github.com/abo-abo/swiper/issues/547][#547]].
------
-*** =counsel-describe-face=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-describe-face
-:END:
-See [[https://github.com/abo-abo/swiper/issues/585][#585]], 
[[https://github.com/abo-abo/swiper/issues/703][#703]].
------
-*** =counsel-dired-jump=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-dired-jump
-:END:
-Like, =counsel-file-jump=, but for directories.
------
-*** =counsel-dpkg=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-dpkg
-:END:
-Completion for =dpkg -l=.
------
-*** =counsel-faces=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-faces
-:END:
-See [[https://github.com/abo-abo/swiper/issues/815][#815]].
------
-*** =counsel-file-jump=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-file-jump
-:END:
-Jump to a file from a list of all files in the current directory, see 
[[https://github.com/abo-abo/swiper/issues/609][#609]], 
[[https://github.com/abo-abo/swiper/issues/610][#610]].
------
-*** =counsel-find-library=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-find-library
-:END:
-A helpful and unsurprising alternative to using ~C-.~ with
-=counsel-load-library=.
-See [[https://github.com/abo-abo/swiper/issues/794][#794]], 
[[https://github.com/abo-abo/swiper/issues/801][#801]].
------
-*** =counsel-hydra-heads=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-hydra-heads
-:END:
-Call a head of the current/last hydra by name.
-See [[https://github.com/abo-abo/swiper/issues/696][#696]].
------
-*** =counsel-irony=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-irony
-:END:
-Inline C++ completion using Irony.
------
-*** =counsel-mark-ring=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-mark-ring
-:END:
-See [[https://github.com/abo-abo/swiper/issues/834][#834]].
------
-*** =counsel-org-agenda-headlines=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-org-agenda-headlines
-:END:
-See [[https://github.com/abo-abo/swiper/issues/825][#825]].
------
-*** =counsel-outline=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-outline
-:END:
-Completion for outlines in the current buffer.
------
-*** =counsel-package=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-package
-:END:
-Manage packages. Allows installing, deleting, describing etc.
-See [[https://github.com/abo-abo/swiper/issues/869][#869]], 
[[https://github.com/abo-abo/swiper/issues/872][#872]].
------
-*** =counsel-recentf=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-recentf
-:END:
-Renamed from =ivy-recentf=, see 
[[https://github.com/abo-abo/swiper/issues/624][#624]].
-
-Added actions in [[https://github.com/abo-abo/swiper/issues/701][#701]]:
-
-- ~j~ for =find-file-other-window=
-- ~x~ for =counsel-find-file-extern=
-
-Remove text properties, see 
[[https://github.com/abo-abo/swiper/issues/770][#770]].
------
-*** =counsel-rg=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-rg
-:END:
-Grep for a string in the current directory using =rg=.
-Use =counsel-rg-base-command= to customize.
-See [[https://github.com/abo-abo/swiper/issues/784][#784]], 
[[https://github.com/abo-abo/swiper/issues/785][#785]], 
[[https://github.com/abo-abo/swiper/issues/795][#795]], 
[[https://github.com/abo-abo/swiper/issues/796][#796]].
------
-*** =counsel-rpm=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-rpm
-:END:
-Call the =rpm= shell command. See 
[[https://github.com/abo-abo/swiper/issues/695][#695]].
------
-*** =counsel-semantic=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-semantic
-:END:
-Completion for semantic tags.
------
-*** =counsel-set-variable=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-set-variable
-:END:
-Completion for setting a variable to a value.
-See [[https://github.com/abo-abo/swiper/issues/544][#544]], 
[[https://github.com/abo-abo/swiper/issues/546][#546]], 
[[https://github.com/abo-abo/swiper/issues/549][#549]], 
[[https://github.com/abo-abo/swiper/issues/550][#550]], 
[[https://github.com/abo-abo/swiper/issues/556][#556]].
------
-*** =counsel-shell-command-history=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-counsel-shell-command-history
-:END:
-Search through history in =shell-mode=. See 
[[https://github.com/abo-abo/swiper/issues/689][#689]].
-
-When =counsel-mode= is on, ~M-! C-r~ will call
-=counsel-shell-command-history=.
------
-*** =ivy-push-view=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-ivy-push-view
-:END:
-And =ivy-pop-view=.
-
-1. Use =ivy-push-view= to store a view - your current window tree.  This
-   contains: all windows on the current frame, and their configuration
-   w.r.t. horizontal or vertical splits. The point positions in each
-   window are stored as well.
-
-2. Use =ivy-switch-buffer= to select stored views.
-
-3. Use =ivy-pop-view= to delete a stored view that you don't want any
-   more.
-
-See [[https://github.com/abo-abo/swiper/issues/584][#584]].
------
-*** =ivy-rotate-sort=
-:PROPERTIES:
-:CUSTOM_ID: 0-9-0-nc-ivy-rotate-sort
-:END:
-Modify =ivy-sort-functions-alist= to allow a list of sorting functions
-to apply to a collection. The car of this list is the current
-one. =ivy-rotate-sort= then rotates this list through the different
-possibilities. Bound to ~C-c C-s~. Here is a simple example to
-illustrate.
-
-#+begin_src elisp
-(setq ivy-sort-functions-alist
-      '((read-file-name-internal .
-                                (ivy-sort-file-function-default string-lessp 
string-greaterp))
-       (internal-complete-buffer . nil)
-       (counsel-git-grep-function . nil)
-       (Man-goto-section . nil)
-       (org-refile . nil)
-       (t . string-lessp)))
-#+end_src
-
-~M-x~ =find-file= ~RET C-c C-s~ now switches from the default sorting to
-using =string-lessp=. ~C-c C-s~ again switches to =string-greaterp= and so
-on.
-
-See [[https://github.com/abo-abo/swiper/issues/845][#845]], 
[[https://github.com/abo-abo/swiper/issues/927][#927]].
------
-#+BEGIN_EXPORT html
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
-#+END_EXPORT
diff --git a/packages/ivy/doc/ivy-help.org b/packages/ivy/doc/ivy-help.org
deleted file mode 100644
index 989c0e4..0000000
--- a/packages/ivy/doc/ivy-help.org
+++ /dev/null
@@ -1,138 +0,0 @@
-* Ivy Generic Help
-
-=ivy= is an Emacs incremental completion framework.
-
-- Narrow the list by typing some pattern,
-- Multiple patterns are allowed by separating with a space,
-- Select with ~C-n~ and ~C-p~, choose with ~RET~.
-
-** Help
-
-- ~C-h m~ :: Pop to this generic help buffer.
-
-** Basic Operations
-*** Key bindings for navigation
-
-- ~C-n~ (=ivy-next-line=) :: next candidate.
-- ~C-p~ (=ivy-previous-line=) :: previous candidate.
-- ~C-v~ (=ivy-scroll-up-command=) :: next page.
-- ~M-v~ (=ivy-scroll-down-command=) :: previous page.
-- ~M-<~ (=ivy-beginning-of-buffer=) :: first candidate.
-- ~M->~ (=ivy-end-of-buffer=) :: last candidate.
-
-*** Key bindings for single selection
-
-When selecting a candidate, an action is called on it. You can think
-of an action as a function that takes the selected candidate as an
-argument and does something with it.
-
-Ivy can offer several actions from which to choose. This can be
-independently composed with whether you want to end completion when
-the action is called. Depending on this, the short term is either
-"calling an action" or "exiting with action".
-
-~C-m~ or ~RET~ (=ivy-done=) - exit with the current action.
-
-~M-o~ (=ivy-dispatching-done=) - select an action and exit with it.
-
-~C-j~ (=ivy-alt-done=) - when the candidate is a directory, enter
-it. Otherwise, exit with the current action.
-
-~TAB~ (=ivy-partial-or-done=) - attempt partial completion, extending
-the current input as much as possible. ~TAB TAB~ is the same as ~C-j~.
-
-~C-M-j~ (=ivy-immediate-done=) - exit with the current action, calling
-it on the /current input/ instead of the current candidate. This is
-useful especially when creating new files or directories - often the
-input will match an existing file, which you don't want to select.
-
-~C-'~ (=ivy-avy=) - select a candidate from the current page with avy
-and exit with the current action.
-
-** Advanced Operations
-*** Key bindings for multiple selection
-
-For repeatedly applying multiple actions or acting on multiple
-candidates, Ivy does not close the minibuffer between commands. It
-keeps the minibuffer open for applying subsequent actions.
-
-Adding an extra meta key to the normal key chord invokes the special
-version of the regular commands that enables applying multiple
-actions.
-
-~C-M-m~ (=ivy-call=) is the non-exiting version of ~C-m~ (=ivy-done=).
-
-~C-M-n~ (=ivy-next-line-and-call=) combines ~C-n~ and ~C-M-m~.
-
-~C-M-p~ (=ivy-previous-line-and-call=) combines ~C-p~ and ~C-M-m~.
-
-~C-M-o~ (=ivy-dispatching-call=) is a non-exiting version of ~M-o~
-(=ivy-dispatching-done=).
-
-*** Key bindings that alter the minibuffer input
-
-~M-n~ (=ivy-next-history-element=) select the next history element or
-symbol/URL at point.
-
-~M-p~ (=ivy-previous-history-element=) select the previous history
-element.
-
-~C-r~ (=ivy-reverse-i-search=) start a recursive completion session to
-select a history element.
-
-~M-i~ (=ivy-insert-current=) insert the current candidate into the
-minibuffer. Useful for copying and renaming files, for example: ~M-i~
-to insert the original file name string, edit it, and then ~C-m~ to
-complete the renaming.
-
-~M-j~ (=ivy-yank-word=) insert the sub-word at point into the
-minibuffer.
-
-~S-SPC~ (=ivy-restrict-to-matches=) deletes the current input, and
-resets the candidates list to the currently restricted matches. This
-is how Ivy provides narrowing in successive tiers.
-
-*** Other key bindings
-
-~M-w~ (=ivy-kill-ring-save=) copies the selected candidates to the
-kill ring; when the region is active, copies the active region.
-
-*** Saving the current completion session to a buffer
-
-~C-c C-o~ (=ivy-occur=) saves the current candidates to a new buffer;
-the list is active in the new buffer.
-
-~RET~ or ~mouse-1~ in the new buffer calls the appropriate action on
-the selected candidate.
-
-Ivy has no limit on the number of active buffers like these.
-
-Ivy takes care of making these buffer names unique. It applies
-descriptive names, for example: =*ivy-occur counsel-describe-variable
-"function$*=.
-
-*** Global key bindings
-
-=ivy-resume= recalls the state of the completion session just before
-its last exit. Useful after an accidental ~C-m~ (=ivy-done=).
-Recommended global binding: ~C-c C-r~.
-
-*** Hydra in the minibuffer
-
-~C-o~ (=hydra-ivy/body=) invokes Hydra menus with key shortcuts.
-
-When in Hydra, ~C-o~ or ~i~ resumes editing.
-
-Hydra reduces key strokes, for example: ~C-n C-n C-n C-n~ is ~C-o
-jjjj~ in Hydra. Besides certain shorter keys, Hydra shows useful info
-such as case folding and the current action.
-
-Additionally, here are the keys that are otherwise not bound:
-
-- ~<~ and ~>~ adjust the height of the minibuffer.
-- ~c~ (=ivy-toggle-calling=) - toggle calling the current action each
-  time a different candidate is selected.
-- ~m~ (=ivy-toggle-fuzzy=) - toggle regex matcher.
-- ~w~ and ~s~ scroll the actions list.
-
-Minibuffer editing is disabled when Hydra is active.
diff --git a/packages/ivy/doc/ivy-ox.el b/packages/ivy/doc/ivy-ox.el
deleted file mode 100644
index cb69c7f..0000000
--- a/packages/ivy/doc/ivy-ox.el
+++ /dev/null
@@ -1,193 +0,0 @@
-;;; ivy-ox.el --- org-export settings for Ivy
-
-;; Copyright (C) 2015  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;* ox-texinfo
-(require 'ox-texinfo)
-(org-export-define-backend 'texinfo
-  '((bold . org-texinfo-bold)
-    (center-block . org-texinfo-center-block)
-    (clock . org-texinfo-clock)
-    (code . org-texinfo-kbd)
-    (drawer . org-texinfo-drawer)
-    (dynamic-block . org-texinfo-dynamic-block)
-    (entity . org-texinfo-entity)
-    (example-block . org-texinfo-example-block)
-    (export-block . org-texinfo-export-block)
-    (export-snippet . org-texinfo-export-snippet)
-    (fixed-width . org-texinfo-fixed-width)
-    (footnote-definition . org-texinfo-footnote-definition)
-    (footnote-reference . org-texinfo-footnote-reference)
-    (headline . org-texinfo-headline)
-    (inline-src-block . org-texinfo-inline-src-block)
-    (inlinetask . org-texinfo-inlinetask)
-    (italic . org-texinfo-italic)
-    (item . org-texinfo-item)
-    (keyword . org-texinfo-keyword)
-    (line-break . org-texinfo-line-break)
-    (link . org-texinfo-link)
-    (node-property . org-texinfo-node-property)
-    (paragraph . org-texinfo-paragraph)
-    (plain-list . org-texinfo-plain-list)
-    (plain-text . org-texinfo-plain-text)
-    (planning . org-texinfo-planning)
-    (property-drawer . org-texinfo-property-drawer)
-    (quote-block . org-texinfo-quote-block)
-    (radio-target . org-texinfo-radio-target)
-    (section . org-texinfo-section)
-    (special-block . org-texinfo-special-block)
-    (src-block . org-texinfo-src-block)
-    (statistics-cookie . org-texinfo-statistics-cookie)
-    (subscript . org-texinfo-subscript)
-    (superscript . org-texinfo-superscript)
-    (table . org-texinfo-table)
-    (table-cell . org-texinfo-table-cell)
-    (table-row . org-texinfo-table-row)
-    (target . org-texinfo-target)
-    (template . org-texinfo-template)
-    (timestamp . org-texinfo-timestamp)
-    (verbatim . org-texinfo-code)
-    (verse-block . org-texinfo-verse-block))
-  :filters-alist
-  '((:filter-headline . org-texinfo--filter-section-blank-lines)
-    (:filter-parse-tree . org-texinfo--normalize-headlines)
-    (:filter-section . org-texinfo--filter-section-blank-lines))
-  :menu-entry
-  '(?i "Export to Texinfo"
-    ((?t "As TEXI file" org-texinfo-export-to-texinfo)
-     (?i "As INFO file" org-texinfo-export-to-info)
-     (?o "As INFO file and open"
-      (lambda (a s v b)
-        (if a (org-texinfo-export-to-info t s v b)
-          (org-open-file (org-texinfo-export-to-info nil s v b)))))))
-  :options-alist
-  '((:texinfo-filename "TEXINFO_FILENAME" nil nil t)
-    (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t)
-    (:texinfo-header "TEXINFO_HEADER" nil nil newline)
-    (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline)
-    (:subtitle "SUBTITLE" nil nil parse)
-    (:subauthor "SUBAUTHOR" nil nil newline)
-    (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t)
-    (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t)
-    (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t)
-    (:texinfo-printed-title "TEXINFO_PRINTED_TITLE" nil nil t)
-    ;; Other variables.
-    (:texinfo-classes nil nil org-texinfo-classes)
-    (:texinfo-format-headline-function nil nil 
org-texinfo-format-headline-function)
-    (:texinfo-node-description-column nil nil 
org-texinfo-node-description-column)
-    (:texinfo-active-timestamp-format nil nil 
org-texinfo-active-timestamp-format)
-    (:texinfo-inactive-timestamp-format nil nil 
org-texinfo-inactive-timestamp-format)
-    (:texinfo-diary-timestamp-format nil nil 
org-texinfo-diary-timestamp-format)
-    (:texinfo-link-with-unknown-path-format nil nil 
org-texinfo-link-with-unknown-path-format)
-    (:texinfo-tables-verbatim nil nil org-texinfo-tables-verbatim)
-    (:texinfo-table-scientific-notation nil nil 
org-texinfo-table-scientific-notation)
-    (:texinfo-def-table-markup nil nil org-texinfo-def-table-markup)
-    (:texinfo-text-markup-alist nil nil org-texinfo-text-markup-alist)
-    (:texinfo-format-drawer-function nil nil 
org-texinfo-format-drawer-function)
-    (:texinfo-format-inlinetask-function nil nil 
org-texinfo-format-inlinetask-function)))
-
-(defun org-texinfo-kbd (code _contents _info)
-  "Transcode a CODE object from Org to Texinfo."
-  (format "@kbd{%s}" (org-element-property :value code)))
-
-(defun org-texinfo-plain-list (plain-list contents info)
-  "Transcode a PLAIN-LIST element from Org to Texinfo.
-CONTENTS is the contents of the list.  INFO is a plist holding
-contextual information."
-  (let* ((attr (org-export-read-attribute :attr_texinfo plain-list))
-         (indic (or (plist-get attr :indic)
-                    (plist-get info :texinfo-def-table-markup)))
-         (table-type (plist-get attr :table-type))
-         (type (org-element-property :type plain-list))
-         (list-type (cond
-                      ((eq type 'ordered) "enumerate")
-                      ((eq type 'unordered) "itemize")
-                      ((member table-type '("ftable" "vtable")) table-type)
-                      (t "table"))))
-    (if (equal list-type "table")
-        (mapconcat (lambda (s)
-                     (cond ((string-match "\\`User Option @code{\\(.*\\)}$" s)
-                            (format "@defopt address@hidden defopt\n"
-                                    (match-string-no-properties 1 s)
-                                    (string-trim
-                                     (substring s (1+ (match-end 1))))))
-                           ((string-match "\\(.*\\)$" s)
-                            (let* ((line (match-string 1 s))
-                                   (body (string-trim
-                                          (substring s (1+ (match-end 1)))))
-                                   (symbol-index
-                                    (if (string-match 
"@code{\\(\\(?:ivy\\|swiper\\|counsel\\)-[^}]+\\)}" line)
-                                        (format "@vindex %s\n" (match-string 1 
line))
-                                      ""))
-                                   (key-index
-                                    (apply #'concat
-                                           (mapcar
-                                            (lambda (s)
-                                              (format "@kindex %s\n" s))
-                                            (iox-extract-kbd line)))))
-                              (format "@subsubheading address@hidden@end 
indentedblock"
-                                      line
-                                      (concat symbol-index
-                                              key-index)
-                                      body)))
-                           (t
-                            (concat "@subsubheading " s))))
-                   (split-string (substring-no-properties contents) 
"address@hidden " t)
-                   "\n")
-      (format "@address@hidden %s"
-              (if (eq type 'descriptive) (concat list-type " " indic) 
list-type)
-              contents
-              list-type))))
-
-(defun iox-extract-kbd (str)
-  (let ((start 0)
-        res)
-    (while (string-match "@kbd{\\([^}]+\\)}" str start)
-      (setq start (match-end 0))
-      (push (match-string 1 str) res))
-    (nreverse res)))
-
-;;* ox-html
-(require 'ox-html)
-(setq org-html-validation-link nil)
-(setq org-html-postamble nil)
-(setq org-html-text-markup-alist
-      '((bold . "<b>%s</b>")
-        (code . "<kbd>%s</kbd>")
-        (italic . "<i>%s</i>")
-        (strike-through . "<del>%s</del>")
-        (underline . "<span class=\"underline\">%s</span>")
-        (verbatim . "<code>%s</code>")))
-(setq org-html-style-default nil)
-
-(defvar ivy-info-dir (file-name-directory
-                      (or load-file-name
-                          (buffer-file-name))))
-
-(defun info-ivy ()
-  (interactive)
-  (let ((buf (get-buffer "*info*")))
-    (when buf
-      (kill-buffer buf)))
-  (Info-find-node
-   (expand-file-name "ivy.info" ivy-info-dir)
-   "Top"))
-
-(provide 'ivy-ox)
diff --git a/packages/ivy/doc/ivy.org b/packages/ivy/doc/ivy.org
deleted file mode 100644
index 1ff790d..0000000
--- a/packages/ivy/doc/ivy.org
+++ /dev/null
@@ -1,1326 +0,0 @@
-#+TITLE: Ivy User Manual
-#+AUTHOR: Oleh Krehel
-#+EMAIL: address@hidden
-#+LANGUAGE: en
-
-#+TEXINFO_DIR_CATEGORY: Emacs
-#+TEXINFO_DIR_TITLE: Ivy: (ivy).
-#+TEXINFO_DIR_DESC: Using Ivy for completion.
-#+SETUPFILE: ~/git/org-html-themes/setup/theme-readtheorg.setup
-#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="kbd-style.css"/>
-#+OPTIONS: H:6 num:6 toc:4
-#+STARTUP: indent
-* Setup                                                                        
       :noexport:
-#+BEGIN_SRC elisp :exports results :results silent
-(add-to-list 'load-path default-directory)
-(require 'ivy-ox)
-#+END_SRC
-* Writing this manual                                                          
       :noexport:
-To highlight a section without introducing a new subheading use
-definition lists. The definition list "owns" the subsequent text if
-the text is indented by 5 spaces. Use ~C-q~ to indent the
-paragraphs. Start new paragraphs with 5 spaces indented. To separate
-definition lists from regular lists, use two newlines.
-
-A typical definition list:
-#+BEGIN_EXAMPLE
-- ~C-M-j~ (=ivy-immediate-done=) ::
-#+END_EXAMPLE
-The code and kbd part is recognized and added as address@hidden and
address@hidden respectively.
-
-Use definition lists to declare a address@hidden section for =defcustom=
-or =defvar=. For proper Texinfo export, use this form:
-
-#+BEGIN_EXAMPLE
-User Option =ivy-wrap= ::
-#+END_EXAMPLE
-
-Set =CUSTOM_ID= property to name each heading. For example, =worf='s
-~C-u L~. This will result in consistent HTML node names.
-
-Keep one empty line before each source block for proper Texinfo
-exports.
-
-** Exporting to texinfo
-
-ivy.texi is generated from ivy.org. To update the .texi file, eval
-ivy-ox.el then ~C-c C-e i t~ in the ivy.org bufer.
-* Copying
-:PROPERTIES:
-:COPYING:  t
-:CUSTOM_ID: copying
-:END:
-#+TEXINFO: @ifnottex
-Ivy manual, version 0.8.0
-
-Ivy is an interactive interface for completion in Emacs. Emacs uses
-completion mechanism in a variety of contexts: code, menus, commands,
-variables, functions, etc. Completion entails listing, sorting,
-filtering, previewing, and applying actions on selected items. When
-active, =ivy-mode= completes the selection process by narrowing
-available choices while previewing in the minibuffer. Selecting the
-final candidate is either through simple keyboard character inputs or
-through powerful regular expressions.
-#+TEXINFO: @end ifnottex
-
-Copyright (C) 2015 Free Software Foundation, Inc.
-
-#+BEGIN_QUOTE
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3 or
-any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
-and with the Back-Cover Texts as in (a) below.  A copy of the license
-is included in the section entitled ``GNU Free Documentation License.''
-
-(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual.''
-#+END_QUOTE
-
-#+HTML: <a 
href="https://github.com/abo-abo/swiper/blob/master/doc/ivy.org";>This manual 
source</a>
-* Introduction
-:PROPERTIES:
-:CUSTOM_ID: introduction
-:END:
-Ivy is for quick and easy selection from a list. When Emacs prompts
-for a string from a list of several possible choices, Ivy springs into
-action to assist in narrowing and picking the right string from a vast
-number of choices.
-
-Ivy strives for minimalism, simplicity, customizability and
-discoverability.
-
-- Minimalism ::
-     Uncluttered minibuffer is minimalism. Ivy shows the completion
-     defaults, the number of matches, and 10 candidate matches below
-     the input line. Customize =ivy-height= to adjust the number of
-     candidate matches displayed in the minibuffer.
-
-- Simplicity ::
-     Simplicity is about Ivy's behavior in the minibuffer. It is also
-     about the code interface to extend Ivy's functionality. The
-     minibuffer area behaves as close to =fundamental-mode= as
-     possible. ~SPC~ inserts a space, for example, instead of being
-     bound to the more complex =minibuffer-complete-word=. Ivy's code
-     uses easy-to-examine global variables; avoids needless
-     complications with branch-introducing custom macros.
-
-- Customizability ::
-     Customizability is about being able to use different methods and
-     interfaces of completion to tailor the selection process. For
-     example, adding a custom display function that points to a
-     selected candidate with =>=, instead of highlighting the selected
-     candidate with the =ivy-current-match= face (see
-     =ivy-format-function=). Or take the customization of actions, say
-     after the candidate function is selected. ~RET~ uses
-     =counsel-describe-function= to describe the function, whereas
-     ~M-o d~ jumps to that function's definition in the code. The
-     ~M-o~ prefix can be uniformly used with characters like ~d~ to
-     group similar actions.
-
-- Discoverability ::
-     Ivy displays easily discoverable commands through the hydra
-     facility.  ~C-o~ in the minibuffer displays a hydra menu. It
-     opens up within an expanded minibuffer area. Each menu item comes
-     with short documentation strings and highlighted one-key
-     completions. So discovering even seldom used keys is simply a
-     matter of ~C-o~ in the minibuffer while in the midst of the Ivy
-     interaction. This discoverability minimizes exiting Ivy interface
-     for documentation look-ups.
-
-* Installation
-:PROPERTIES:
-:CUSTOM_ID: installation
-:END:
-
-Install Ivy automatically through Emacs's package manager, or manually
-from Ivy's development repository.
-
-Emacs 24.3.1 is the oldest version to run Ivy. Emacs 24.5.1 is the
-oldest version that runs Ivy with fancy faces display.
-
-** Installing from Emacs Package Manager
-:PROPERTIES:
-:CUSTOM_ID: installing-from-emacs-package-manager
-:END:
-
-~M-x~ =package-install= ~RET~ =ivy= ~RET~
-
-Ivy is installed as part of =ivy= package, which is available from two
-different package archives, GNU ELPA and MELPA. For the latest stable
-version, use the GNU ELPA archives using the above M-x command.
-
-For current hourly builds, use the MELPA archives. In MELPA, Ivy is
-split into three packages: =ivy=, =swiper= and =counsel=; you can simply
-install =counsel= which will bring in the other two as dependencies.
-See the code below for adding MELPA to the list of package archives:
-
-#+begin_src elisp
-(require 'package)
-(add-to-list 'package-archives
-             '("melpa" . "http://melpa.org/packages/";))
-#+end_src
-
-After this do ~M-x~ =package-refresh-contents= ~RET~, followed by ~M-x~
-=package-install= ~RET~ =counsel= ~RET~.
-
-For package manager details, see [[info:emacs#Packages]].
-
-** Installing from the Git repository
-:PROPERTIES:
-:CUSTOM_ID: installing-from-the-git-repository
-:END:
-
-- Why install from Git? ::
-
-    - No need to wait for MELPA's hourly builds
-    - Easy to revert to previous versions
-    - Contribute to Ivy's development; send patches; pull requests
-
-
-- Configuration steps ::
-     First clone the Swiper repository with:
-
-     #+begin_src sh
-     cd ~/git && git clone https://github.com/abo-abo/swiper
-     cd swiper && make compile
-     #+end_src
-
-     Second, add these lines to the Emacs init file:
-
-     #+begin_src elisp
-     (add-to-list 'load-path "~/git/swiper/")
-     (require 'ivy)
-     #+end_src
-
-     Then, update the code with:
-
-     #+begin_src sh
-     git pull
-     make
-     #+end_src
-
-* Getting started
-:PROPERTIES:
-:CUSTOM_ID: getting-started
-:END:
-First enable Ivy completion everywhere:
-
-#+begin_src elisp
-(ivy-mode 1)
-#+end_src
-
-Note: =ivy-mode= can be toggled on and off with ~M-x~ =ivy-mode=.
-** Basic customization
-:PROPERTIES:
-:CUSTOM_ID: basic-customization
-:END:
-Here are some basic settings particularly useful for new Ivy users:
-
-#+begin_src elisp
-(setq ivy-use-virtual-buffers t)
-(setq ivy-count-format "(%d/%d) ")
-#+end_src
-
-If you want, you can go without any customizations at all. The above
-settings are the most bang for the buck in terms of customization.  So
-users that typically don't like customize a lot are advised to look at
-these settings first.
-
-For more advanced customizations, refer to =M-x describe-variable=
-documentation.
-
-* Key bindings
-:PROPERTIES:
-:CUSTOM_ID: key-bindings
-:END:
-** Global key bindings
-:PROPERTIES:
-:CUSTOM_ID: global-key-bindings
-:END:
-The recommended key bindings are:
-
-- Ivy-based interface to standard commands ::
-
-     #+begin_src elisp
-     (global-set-key (kbd "C-s") 'swiper)
-     (global-set-key (kbd "M-x") 'counsel-M-x)
-     (global-set-key (kbd "C-x C-f") 'counsel-find-file)
-     (global-set-key (kbd "<f1> f") 'counsel-describe-function)
-     (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
-     (global-set-key (kbd "<f1> l") 'counsel-find-library)
-     (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
-     (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
-     #+end_src
-
-- Ivy-based interface to shell and system tools ::
-
-     #+begin_src elisp
-     (global-set-key (kbd "C-c g") 'counsel-git)
-     (global-set-key (kbd "C-c j") 'counsel-git-grep)
-     (global-set-key (kbd "C-c k") 'counsel-ag)
-     (global-set-key (kbd "C-x l") 'counsel-locate)
-     (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
-     #+end_src
-
-- Ivy-resume and other commands ::
-
-     =ivy-resume= resumes the last Ivy-based completion.
-
-     #+begin_src elisp
-     (global-set-key (kbd "C-c C-r") 'ivy-resume)
-     #+end_src
-
-** Minibuffer key bindings
-:PROPERTIES:
-:CUSTOM_ID: minibuffer-key-bindings
-:END:
-
-#+VINDEX: ivy-minibuffer-map
-Ivy includes several minibuffer bindings, which are defined in the
-=ivy-minibuffer-map= keymap variable. The most frequently used ones
-are described here.
-
-=swiper= or =counsel-M-x= add more key bindings through the =keymap=
-argument to =ivy-read=. These keys, also active in the minibuffer, are
-described under their respective commands.
-
-A key feature of =ivy-minibuffer-map= is its full editing capability
-where the familiar ~C-a~, ~C-f~, ~M-d~, ~M-DEL~, ~M-b~, ~M-w~, ~C-k~,
-~C-y~ key bindings work the same as in =fundamental-mode=.
-
-*** Key bindings for navigation
-:PROPERTIES:
-:CUSTOM_ID: key-bindings-for-navigation
-:END:
-
-- ~C-n~ (=ivy-next-line=) selects the next candidate
-- ~C-p~ (=ivy-previous-line=) selects the previous candidate
-- ~M-<~ (=ivy-beginning-of-buffer=) selects the first candidate
-- ~M->~ (=ivy-end-of-buffer=) selects the last candidate
-- ~C-v~ (=ivy-scroll-up-command=) scrolls up by =ivy-height= lines
-- ~M-v~ (=ivy-scroll-down-command=) scrolls down by =ivy-height= lines
-
-
-- User Option =ivy-wrap= ::
-     Specifies the wrap-around behavior for ~C-n~ and ~C-p~. When
-     =ivy-wrap= is set to =t=, =ivy-next-line= and =ivy-previous-line=
-     will cycle past the last and the first candidates respectively.
-
-     Warp-around behavior is off by default.
-
-- User Option =ivy-height= ::
-     Use this option to adjust the minibuffer height, which also
-     affects scroll size when using ~C-v~ and ~M-v~ key bindings.
-
-     =ivy-height= is 10 lines by default.
-
-*** Key bindings for single selection, action, then exit minibuffer
-:PROPERTIES:
-:CUSTOM_ID: key-bindings-for-single-selection-action-then-exit-minibuffer
-:END:
-
-Ivy can offer several actions from which to choose which action to
-run. This "calling an action" operates on the selected candidate. For
-example, when viewing a list of files, one action could open it for
-editing, one to view it, another to invoke a special function, and so
-on. Custom actions can be added to this interface. The precise action
-to call on the selected candidate can be delayed until after the
-narrowing is completed. No need to exit the interface if unsure which
-action to run. This delayed flexibility and customization of actions
-extends usability of lists in Emacs.
-
-- ~C-m~ or ~RET~ (=ivy-done=) ::
-     Calls the default action and then exits the minibuffer.
-
-- ~M-o~ (=ivy-dispatching-done=) ::
-     Presents valid actions from which to choose. When only one action
-     is available, there is no difference between ~M-o~ and ~C-m~.
-
-- ~C-j~ (=ivy-alt-done=) ::
-     When completing file names, selects the current directory
-     candidate and starts a new completion session there. Otherwise,
-     it is the same as =ivy-done=.
-
-- ~TAB~ (=ivy-partial-or-done=) ::
-     Attempts partial completion, extending current input as much as
-     possible. ~TAB TAB~ is the same as ~C-j~ (=ivy-alt-done=).
-
-     Example ERT test:
-
-     #+begin_src elisp
-     (should
-      (equal (ivy-with
-              '(progn
-                (ivy-read "Test: " '("can do" "can't, sorry" "other"))
-                ivy-text)
-              "c <tab>")
-             "can"))
-     #+end_src
-
-- ~C-M-j~ (=ivy-immediate-done=) ::
-     Exits with /the current input/ instead of /the current candidate/
-     (like other commands).
-
-     This is useful e.g. when you call =find-file= to create a new
-     file, but the desired name matches an existing file. In that
-     case, using ~C-j~ would select that existing file, which isn't
-     what you want - use this command instead.
-
-- ~C-'~ (=ivy-avy=) ::
-     Uses avy to select one of the candidates on the current candidate
-     page.  This can often be faster than multiple ~C-n~ or ~C-p~
-     keystrokes followed by ~C-m~.
-
-*** Key bindings for multiple selections and actions, keep minibuffer open
-:PROPERTIES:
-:CUSTOM_ID: 
key-bindings-for-multiple-selections-and-actions-keep-minibuffer-open
-:END:
-
-For repeatedly applying multiple actions or acting on multiple
-candidates, Ivy does not close the minibuffer between commands. It
-keeps the minibuffer open for applying subsequent actions.
-
-Adding an extra meta key to the normal key chord invokes the special
-version of the regular commands that enables applying multiple
-actions.
-
-- ~C-M-m~ (=ivy-call=) ::
-     Is the non-exiting version of ~C-m~ (=ivy-done=).
-
-     Instead of closing the minibuffer, ~C-M-m~ allows selecting
-     another candidate or another action. For example, ~C-M-m~ on
-     functions list invokes =describe-function=. When combined with
-     ~C-n~, function descriptions can be invoked quickly in
-     succession.
-
-- ~C-M-o~ (=ivy-dispatching-call=) ::
-     Is the non-exiting version of ~M-o~ (=ivy-dispatching-done=).
-
-     For example, during the =counsel-rhythmbox= completion, press
-     ~C-M-o e~ to en-queue the selected candidate, followed by ~C-n
-     C-m~ to play the next candidate - the current action reverts to
-     the default one after ~C-M-o~.
-
-- ~C-M-n~ (=ivy-next-line-and-call=) ::
-     Combines ~C-n~ and ~C-M-m~. Applies an action and moves to next
-     line.
-
-     Comes in handy when opening multiple files from
-     =counsel-find-file=, =counsel-git-grep=, =counsel-ag=, =counsel-rg=, or
-     =counsel-locate= lists. Just hold ~C-M-n~ for rapid-fire default
-     action on each successive element of the list.
-
-- ~C-M-p~ (=ivy-previous-line-and-call=) ::
-     Combines ~C-p~ and ~C-M-m~.
-
-     Similar to the above except it moves through the list in the
-     other direction.
-
-- =ivy-resume= ::
-     Recalls the state of the completion session just before its last
-     exit.
-
-     Useful after an accidental ~C-m~ (=ivy-done=).
-
-*** Key bindings that alter the minibuffer input
-:PROPERTIES:
-:CUSTOM_ID: key-bindings-that-alter-the-minibuffer-input
-:END:
-
-- ~M-n~ (=ivy-next-history-element=) ::
-     Cycles forward through the Ivy command history.
-
-     Ivy updates an internal history list after each action. When this
-     history list is empty, ~M-n~ inserts symbol (or URL) at point
-     into the minibuffer.
-
-- ~M-p~ (=ivy-previous-history-element=) ::
-     Cycles forward through the Ivy command history.
-
-- ~M-i~ (=ivy-insert-current=) ::
-     Inserts the current candidate into the minibuffer.
-
-     Useful for copying and renaming files, for example: ~M-i~ to
-     insert the original file name string, edit it, and then ~C-m~ to
-     complete the renaming.
-
-- ~M-j~ (=ivy-yank-word=) ::
-     Inserts the sub-word at point into the minibuffer.
-
-     This is similar to ~C-s C-w~ with =isearch=. Ivy reserves ~C-w~
-     for =kill-region=.
-
-- ~S-SPC~ (=ivy-restrict-to-matches=) ::
-     Deletes the current input, and resets the candidates list to the
-     currently restricted matches.
-
-     This is how Ivy provides narrowing in successive tiers.
-
-- ~C-r~ (=ivy-reverse-i-search=) ::
-     Starts a recursive completion session through the command's
-     history.
-
-     This works just like ~C-r~ at the bash command prompt, where the
-     completion candidates are the history items. Upon completion, the
-     selected candidate string is inserted into the minibuffer.
-
-*** Other key bindings
-:PROPERTIES:
-:CUSTOM_ID: other-key-bindings
-:END:
-
-- ~M-w~ (=ivy-kill-ring-save=) ::
-     Copies selected candidates to the kill ring.
-
-     Copies the region if the region is active.
-
-*** Hydra in the minibuffer
-:PROPERTIES:
-:CUSTOM_ID: hydra-in-the-minibuffer
-:END:
-
-- ~C-o~ (=hydra-ivy/body=) ::
-     Invokes the hydra menu with short key bindings.
-
-When Hydra is active, minibuffer editing is disabled and menus
-display short aliases:
-
-| Short | Normal    | Command name              |
-|-------+-----------+---------------------------|
-| ~o~   | ~C-g~     | =keyboard-escape-quit=    |
-| ~j~   | ~C-n~     | =ivy-next-line=           |
-| ~k~   | ~C-p~     | =ivy-previous-line=       |
-| ~h~   | ~M-<~     | =ivy-beginning-of-buffer= |
-| ~l~   | ~M->~     | =ivy-end-of-buffer=       |
-| ~d~   | ~C-m~     | =ivy-done=                |
-| ~f~   | ~C-j~     | =ivy-alt-done=            |
-| ~g~   | ~C-M-m~   | =ivy-call=                |
-| ~u~   | ~C-c C-o~ | =ivy-occur=               |
-
-Hydra reduces key strokes, for example: ~C-n C-n C-n C-n~ is ~C-o
-jjjj~ in Hydra.
-
-Hydra menu offers these additioanl bindings:
-
-- ~c~ (=ivy-toggle-calling=) ::
-     Toggle calling the action after each candidate change. It
-     modifies ~j~ to ~jg~, ~k~ to ~kg~ etc.
-
-- ~m~ (=ivy-toggle-fuzzy=) ::
-     Toggle the current regexp matcher.
-
-- ~>~ (=ivy-minibuffer-grow=) ::
-     Increase =ivy-height= for the current minibuffer.
-
-- ~<~ (=ivy-minibuffer-shrink=) ::
-     Decrease =ivy-height= for the current minibuffer.
-
-- ~w~ (=ivy-prev-action=) ::
-     Select the previous action.
-
-- ~s~ (=ivy-next-action=) ::
-     Select the next action.
-
-- ~a~ (=ivy-read-action=) ::
-     Use a menu to select an action.
-
-- ~C~ (=ivy-toggle-case-fold=) ::
-     Toggle case folding (match both upper and lower case
-     characters for lower case input).
-
-*** Saving the current completion session to a buffer
-:PROPERTIES:
-:CUSTOM_ID: saving-the-current-completion-session-to-a-buffer
-:END:
-
-- ~C-c C-o~ (=ivy-occur=) ::
-     Saves the current candidates to a new buffer and exits
-     completion.
-
-The new buffer is read-only and has a few useful bindings defined.
-
-- ~RET~ or ~j~ (=ivy-occur-press=) ::
-     Call the current action on the selected candidate.
-
-- ~mouse-1~ (=ivy-occur-click=) ::
-     Call the current action on the selected candidate.
-
-- ~j~ (=next-line=) ::
-     Move to next line.
-
-- ~k~ (=previous-line=) ::
-     Move to previous line.
-
-- ~a~ (=ivy-occur-read-action=) ::
-     Read an action and make it current for this buffer.
-
-- ~o~ (=ivy-occur-dispatch=) ::
-     Read an action and call it on the selected candidate.
-
-- ~q~ (=quit-window=) ::
-     Bury the current buffer.
-
-
-Ivy has no limit on the number of active buffers like these.
-
-Ivy takes care of naming buffers uniquely by constructing descriptive
-names. For example: =*ivy-occur counsel-describe-variable
-"function$*=.
-
-* Completion Styles
-:PROPERTIES:
-:CUSTOM_ID: completion-styles
-:END:
-
-Ivy's completion functions rely on a regex builder - a function that
-transforms a string input to a string regex. All current candidates
-simply have to match this regex. Each collection can be assigned its
-own regex builder by customizing =ivy-re-builders-alist=.
-
-The keys of this alist are collection names, and the values are one of
-the following:
-- =ivy--regex=
-- =ivy--regex-plus=
-- =ivy--regex-ignore-order=
-- =ivy--regex-fuzzy=
-- =regexp-quote=
-
-A catch-all key, =t=, applies to all collections that don't have their
-own key.
-
-The default is:
-
-#+begin_src elisp
-(setq ivy-re-builders-alist
-      '((t . ivy--regex-plus)))
-#+end_src
-
-This example shows a custom regex builder assigned to file name
-completion:
-
-#+begin_src elisp
-(setq ivy-re-builders-alist
-      '((read-file-name-internal . ivy--regex-fuzzy)
-        (t . ivy--regex-plus)))
-#+end_src
-
-Here, =read-file-name-internal= is a function that is passed as the
-second argument to =completing-read= for file name completion.
-
-The regex builder resolves as follows (in order of priority):
-1. =re-builder= argument passed to =ivy-read=.
-2. =collection= argument passed to =ivy-read= is a function and has an
-   entry on =ivy-re-builders-alist=.
-3. =caller= argument passed to =ivy-read= has an entry on
-   =ivy-re-builders-alist=.
-4. =this-command= has an entry on =ivy-re-builders-alist=.
-5. =t= has an entry on =ivy-re-builders-alist=.
-6. =ivy--regex=.
-
-** ivy--regex-plus
-:PROPERTIES:
-:CUSTOM_ID: ivy--regex-plus
-:END:
-
-=ivy--regex-plus= is Ivy's default completion method.
-
-=ivy--regex-plus= matches by splitting the input by spaces and
-rebuilding it into a regex.
-
-As the search string is typed in Ivy's minibuffer, it is transformed
-into valid regex syntax. If the string is ="for example"=, it is
-transformed into
-
-#+begin_src elisp
-"\\(for\\).*\\(example\\)"
-#+end_src
-
-which in regex terminology matches ="for"= followed by a wild card and
-then ="example"=. Note how Ivy uses the space character to build wild
-cards. To match a literal white space, use an extra space. So to match
-one space type two spaces, to match two spaces type three spaces, and
-so on.
-
-As Ivy transforms typed characters into regex strings, it provides an
-intuitive feedback through font highlights.
-
-Ivy supports regexp negation with ="!"=.
-For example, ="define key ! ivy quit"= first selects everything
-matching ="define.*key"=, then removes everything matching ="ivy"=,
-and finally removes everything matching ="quit"=. What remains is the
-final result set of the negation regexp.
-
-Since Ivy treats minibuffer input as a regexp, the standard regexp
-identifiers work: ="^"=, ="$"=, ="\b"= or ="[a-z]"=. The exceptions
-are spaces, which translate to =".*"=, and ="!"= that signal the
-beginning of a negation group.
-
-** ivy--regex-ignore-order
-:PROPERTIES:
-:CUSTOM_ID: ivy--regex-ignore-order
-:END:
-
-=ivy--regex-ignore-order= ignores the order of regexp tokens when
-searching for matching candidates. For instance, the input
-="for example"= will match ="example test for"=.
-
-** ivy--regex-fuzzy
-:PROPERTIES:
-:CUSTOM_ID: ivy--regex-fuzzy
-:END:
-
-=ivy--regex-fuzzy= splits each character with a wild card. Searching
-for ="for"= returns all ="f.*o.*r"= matches, resulting in a large
-number of hits.  Yet some searches need these extra hits. Ivy sorts
-such large lists using =flx= package's scoring mechanism, if it's
-installed.
-
-~C-o m~ toggles the current regexp builder.
-
-* Customization
-:PROPERTIES:
-:CUSTOM_ID: customization
-:END:
-** Faces
-:PROPERTIES:
-:CUSTOM_ID: faces
-:END:
-- =ivy-current-match= ::
-     Highlights the currently selected candidate.
-- =ivy-minibuffer-match-face-1= ::
-     Highlights the background of the match.
-- =ivy-minibuffer-match-face-2= ::
-     Highlights the first (modulo 3) matched group.
-- =ivy-minibuffer-match-face-3= ::
-     Highlights the second (modulo 3) matched group.
-- =ivy-minibuffer-match-face-4= ::
-     Highlights the third (modulo 3) matched group.
-- =ivy-confirm-face= ::
-     Highlights the "(confirm)" part of the prompt.
-
-     When =confirm-nonexistent-file-or-buffer= set to =t=, then
-     confirming non-existent files in =ivy-mode= requires an
-     additional ~RET~.
-
-     The confirmation prompt will use this face.
-
-     For example:
-
-     #+begin_src elisp
-     (setq confirm-nonexistent-file-or-buffer t)
-     #+end_src
-
-     Then call =find-file=, enter "eldorado" and press ~RET~ - the
-     prompt will be appended with "(confirm)". Press ~RET~ once more
-     to confirm, or any key to continue the completion.
-- =ivy-match-required-face= ::
-     Highlights the "(match required)" part of the prompt.
-
-     When completions have to match available candidates and cannot
-     take random input, the "(match required)" prompt signals this
-     constraint.
-
-     For example, call =describe-variable=, enter "waldo" and press
-     ~RET~ - "(match required)" is prompted.
-     Press any key for the prompt to disappear.
-- =ivy-subdir= ::
-     Highlights directories when completing file names.
-- =ivy-remote= ::
-     Highlights remote files when completing file names.
-- =ivy-virtual= ::
-     Highlights virtual buffers when completing buffer names.
-
-     Virtual buffers correspond to bookmarks and recent files list,
-     =recentf=.
-
-     Enable virtual buffers with:
-
-     #+begin_src elisp
-     (setq ivy-use-virtual-buffers t)
-     #+end_src
-** Defcustoms
-:PROPERTIES:
-:CUSTOM_ID: defcustoms
-:END:
-- User Option =ivy-count-format= ::
-     A string that specifies display of number of candidates and
-     current candidate, if one exists.
-
-     The number of matching candidates by default is shown as a right-
-     padded integer value.
-
-     To disable showing the number of candidates:
-
-     #+begin_src elisp
-     (setq ivy-count-format "")
-     #+end_src
-
-     To also display the current candidate:
-
-     #+begin_src elisp
-     (setq ivy-count-format "(%d/%d) ")
-     #+end_src
-
-     The =format=-style switches this variable uses are described
-     in the =format= documentation.
-
-- User Option =ivy-display-style= ::
-     Specifies highlighting candidates in the minibuffer.
-
-     The default setting is ='fancy= and valid only in Emacs versions
-     24.5 or newer.
-
-     Set =ivy-display-style= to =nil= for a plain minibuffer.
-
-- User Option =ivy-on-del-error-function= ::
-     Specify what when ~DEL~ (=ivy-backward-delete-char=) throws.
-
-     The default behavior is to quit the completion after ~DEL~ -- a
-     handy key to invoke after mistakenly triggering a completion.
-
-** Actions
-:PROPERTIES:
-:CUSTOM_ID: actions
-:END:
-*** What are actions?
-:PROPERTIES:
-:CUSTOM_ID: what-are-actions
-:END:
-An action is a function that is called after you select a candidate
-during completion. This function takes a single string argument, which
-is the selected candidate.
-
-- Window context when calling an action ::
-     Currently, the action is executed in the minibuffer window
-     context. This means e.g. that if you call =insert= the text will
-     be inserted into the minibuffer.
-
-     If you want to execute the action in the initial window from
-     which the completion started, use the =with-ivy-window= wrapper
-     macro.
-
-     #+begin_src elisp
-     (defun ivy-insert-action (x)
-       (with-ivy-window
-         (insert x)))
-     #+end_src
-
-*** How can different actions be called?
-:PROPERTIES:
-:CUSTOM_ID: how-can-different-actions-be-called
-:END:
-- ~C-m~ (=ivy-done=) calls the current action.
-- ~M-o~ (=ivy-dispatching-done=) presents available actions for
-  selection, calls it after selection, and then exits.
-- ~C-M-o~ (=ivy-dispatching-call=) presents available actions for
-  selection, calls it after selection, and then does not exit.
-
-*** How to modify the actions list?
-:PROPERTIES:
-:CUSTOM_ID: how-to-modify-the-actions-list
-:END:
-Currently, you can append any amount of your own actions to the
-default list of actions. This can be done either for a specific
-command, or for all commands at once.
-
-Usually, the command has only one default action. The convention is to
-use single letters when selecting a command, and the letter ~o~ is
-designated for the default command. This way, ~M-o o~ should be always
-equivalent to ~C-m~.
-
-*** Example - add two actions to each command
-:PROPERTIES:
-:CUSTOM_ID: example---add-two-actions-to-each-command
-:END:
-The first action inserts the current candidate into the Ivy window -
-the window from which =ivy-read= was called.
-
-The second action copies the current candidate to the kill ring.
-
-#+begin_src elisp
-(defun ivy-yank-action (x)
-  (kill-new x))
-
-(defun ivy-copy-to-buffer-action (x)
-  (with-ivy-window
-    (insert x)))
-
-(ivy-set-actions
- t
- '(("i" ivy-copy-to-buffer-action "insert")
-   ("y" ivy-yank-action "yank")))
-#+end_src
-
-Then in any completion session, ~M-o y~ invokes =ivy-yank-action=, and
-~M-o i~ invokes =ivy-copy-to-buffer-action=.
-
-**** How to undo adding the two actions
-:PROPERTIES:
-:CUSTOM_ID: how-to-undo-adding-the-two-actions
-:END:
-Since =ivy-set-actions= modifies the internal dictionary with new
-data, set the extra actions list to =nil= by assigning =nil= value to
-the =t= key as follows:
-
-#+begin_src elisp
-(ivy-set-actions t nil)
-#+end_src
-
-**** How to add actions to a specific command
-:PROPERTIES:
-:CUSTOM_ID: how-to-add-actions-to-a-specific-command
-:END:
-Use the command name as the key:
-
-#+begin_src elisp
-(ivy-set-actions
- 'swiper
- '(("i" ivy-copy-to-buffer-action "insert")
-   ("y" ivy-yank-action "yank")))
-#+end_src
-
-*** Example - define a new command with several actions
-:PROPERTIES:
-:CUSTOM_ID: example---define-a-new-command-with-several-actions
-:END:
-#+begin_src elisp
-(defun my-action-1 (x)
-  (message "action-1: %s" x))
-
-(defun my-action-2 (x)
-  (message "action-2: %s" x))
-
-(defun my-action-3 (x)
-  (message "action-3: %s" x))
-
-(defun my-command-with-3-actions ()
-  (interactive)
-  (ivy-read "test: " '("foo" "bar" "baz")
-            :action '(1
-                      ("o" my-action-1 "action 1")
-                      ("j" my-action-2 "action 2")
-                      ("k" my-action-3 "action 3"))))
-#+end_src
-
-The number 1 above is the index of the default action. Each
-action has its own string description for easy selection.
-
-**** Test the above function with =ivy-occur=
-:PROPERTIES:
-:CUSTOM_ID: test-the-above-function-with-ivy-occur
-:END:
-To examine each action with each candidate in a key-efficient way, try:
-
-- Call =my-command-with-3-actions=
-- Press ~C-c C-o~ to close the completion window and move to an
-  ivy-occur buffer
-- Press ~kkk~ to move to the first candidate, since the point is most
-  likely at the end of the buffer
-- Press ~oo~ to call the first action
-- Press ~oj~ and ~ok~ to call the second and the third actions
-- Press ~j~ to move to the next candidate
-- Press ~oo~, ~oj~, ~ok~
-- Press ~j~ to move to the next candidate
-- and so on...
-
-** Packages
-:PROPERTIES:
-:CUSTOM_ID: packages
-:END:
-- =org-mode= ::
-     =org-mode= versions 8.3.3 or later obey
-     =completing-read-function= (which =ivy-mode= sets). Try refiling
-     headings with similar names to appreciate =ivy-mode=.
-- =magit= ::
-     Magit requires this setting for ivy completion:
-
-     #+begin_src elisp
-     (setq magit-completing-read-function 'ivy-completing-read)
-     #+end_src
-- =find-file-in-project= ::
-     It uses ivy by default if Ivy is installed.
-- =projectile= ::
-     Projectile requires this setting for ivy completion:
-
-     #+begin_src elisp
-     (setq projectile-completion-system 'ivy)
-     #+end_src
-- =helm-make= ::
-     Helm-make requires this setting for ivy completion.
-
-     #+begin_src elisp
-     (setq helm-make-completion-method 'ivy)
-     #+end_src
-
-* Commands
-:PROPERTIES:
-:CUSTOM_ID: commands
-:END:
-** File Name Completion
-:PROPERTIES:
-:CUSTOM_ID: file-name-completion
-:END:
-Since file name completion is ubiquitous, Ivy provides extra
-bindings that work here:
-
-
-- ~C-j~ (=ivy-alt-done=) ::
-     On a directory, restarts completion from that directory.
-
-     On a file or =./=, exit completion with the selected candidate.
-- ~DEL~ (=ivy-backward-delete-char=) ::
-     Restart the completion in the parent directory if current input
-     is empty.
-- ~//~ (=self-insert-command=) ::
-     Switch to the root directory.
-- ~~~ (=self-insert-command=) ::
-     Switch to the home directory.
-- ~/~ (=self-insert-command=) ::
-     If the current input matches an existing directory name exactly,
-     switch the completion to that directory.
-- ~M-q~ (=ivy-toggle-regexp-quote=) ::
-     Toggle between input as regexp or not.
-
-     Switch to matching literally since file names include =.=, which
-     is for matching any char in regexp mode.
-
-- User Option =ivy-extra-directories= ::
-     Decide if you want to see =../= and =./= during file name
-     completion.
-
-     Reason to remove: =../= is the same as ~DEL~.
-
-     Reason not to remove: navigate anywhere with only ~C-n~, ~C-p~
-     and ~C-j~.
-
-     Likewise, =./= can be removed.
-
-- Using TRAMP ::
-     From any directory, with the empty input, inputting =/ssh:= and
-     pressing ~C-j~ (or ~RET~, which is the same thing) completes for
-     host and user names.
-
-     For =/ssh:address@hidden input, completes the domain name.
-
-     ~C-i~ works in a similar way to the default completion.
-
-     You can also get sudo access for the current directory by
-     inputting =/sudo::= ~RET~. Using =/sudo:= (i.e. single colon instead of
-     double) will result in a completion session for the desired user.
-
-- History ::
-     File history works the same with ~M-p~, ~M-n~, and ~C-r~, but
-     uses a custom code for file name completion that cycles through
-     files previously opened. It also works with TRAMP files.
-
-** Buffer Name Completion
-:PROPERTIES:
-:CUSTOM_ID: buffer-name-completion
-:END:
-- User Option =ivy-use-virtual-buffers= ::
-     When non-nil, add =recentf-mode= and bookmarks to
-     =ivy-switch-buffer= completion candidates.
-
-     Adding this to Emacs init file:
-
-     #+begin_src elisp
-     (setq ivy-use-virtual-buffers t)
-     #+end_src
-     will add additional virtual buffers to the buffers list for recent
-     files. Selecting such virtual buffers, which are highlighted with
-     =ivy-virtual= face, will open the corresponding file.
-
-** Counsel commands
-:PROPERTIES:
-:CUSTOM_ID: counsel-commands
-:END:
-The main advantages of =counsel-= functions over their basic
-equivalents in =ivy-mode= are:
-
-1. Multi-actions and non-exiting actions work.
-2. =ivy-resume= can resume the last completion session.
-3. Customize =ivy-set-actions=, =ivy-re-builders-alist=.
-4. Customize individual keymaps, such as =counsel-describe-map=,
-   =counsel-git-grep-map=, or =counsel-find-file-map=, instead of
-   customizing =ivy-minibuffer-map= that applies to all completion
-   sessions.
-* API
-:PROPERTIES:
-:CUSTOM_ID: api
-:END:
-The main (and only) entry point is the =ivy-read= function. It takes
-two required arguments and many optional arguments that can be passed
-by a key. The optional =:action= argument is highly recommended for
-features such as multi-actions, non-exiting actions, =ivy-occur= and
-=ivy-resume=.
-
-** Required arguments for =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: required-arguments-for-ivy-read
-:END:
-- =prompt= ::
-     A format string normally ending in a colon and a space.
-
-     =%d= anywhere in the string is replaced by the current number of
-     matching candidates. To use a literal =%= character, escape it as
-     =%%=. See also =ivy-count-format=.
-
-- =collection= ::
-     Either a list of strings, a function, an alist or a hash table.
-
-     If a function, then it has to be compatible with
-     =all-completions=.
-
-** Optional arguments for =ivy-read=
-:PROPERTIES:
-:CUSTOM_ID: optional-arguments-for-ivy-read
-:END:
-- =predicate= ::
-     Is a function to filter the initial collection. It has to be
-     compatible with =all-completions=. Tip: most of the time, it's
-     simpler to just apply this filter to the =collection= argument
-     itself, e.g. =(cl-remove-if-not predicate collection)=.
-- =require-match= ::
-     When set to a non-nil value, input must match one of the
-     candidates. Custom input is not accepted.
-- =initial-input= ::
-     This string argument is included for compatibility with
-     =completing-read=, which inserts it into the minibuffer.
-
-     It's recommended to use the =preselect= argument instead of this.
-- =history= ::
-     Name of the symbol to store history. See =completing-read=.
-- =preselect= ::
-     When set to a string value, select the first candidate matching
-     this value.
-
-     When set to an integer value, select the candidate with that
-     index value.
-
-     Every time the input becomes empty, the item corresponding to to
-     =preselect= is selected.
-- =keymap= ::
-     A keymap to be composed with =ivy-minibuffer-map=. This keymap
-     has priority over =ivy-minibuffer-map= and can be modified at any
-     later stage.
-- =update-fn= ::
-     Is the function called each time the current candidate changes.
-     This function takes no arguments and is called in the
-     minibuffer's =post-command-hook=. See =swiper= for an example
-     usage.
-- =sort= ::
-     When non-nil, use =ivy-sort-functions-alist= to sort the
-     collection as long as the collection is not larger than
-     =ivy-sort-max-size=.
-- =action= ::
-     Is the function to call after selection. It takes a string
-     argument.
-- =unwind= ::
-     Is the function to call before exiting completion. It takes no
-     arguments. This function is called even if the completion is
-     interrupted with ~C-g~. See =swiper= for an example usage.
-- =re-builder= ::
-     Is a function that takes a string and returns a valid regex. See
-     =Completion Styles= for details.
-- =matcher= ::
-     Is a function that takes a regex string and a list of strings and
-     returns a list of strings matching the regex. Any ordinary Emacs
-     matching function will suffice, yet finely tuned matching
-     functions can be used. See =counsel-find-file= for an example
-     usage.
-- =dynamic-collection= ::
-     When non-nil, =collection= will be used to dynamically generate
-     the candidates each time the input changes, instead of being used
-     once statically with =all-completions= to generate a list of
-     strings. See =counsel-locate= for an example usage.
-- =caller= ::
-     Is a symbol that uniquely identifies the function that called
-     =ivy-read=, which may be useful for further customizations.
-** Example - =counsel-describe-function=
-:PROPERTIES:
-:CUSTOM_ID: example---counsel-describe-function
-:END:
-This is a typical example of a function with a non-async collection,
-which is a collection where all the strings in the collection are
-known prior to any input from the user.
-
-Only the first two arguments (along with =action=) are essential - the
-rest of the arguments are for fine-tuning, and could be omitted.
-
-The =action= argument could also be omitted - but then =ivy-read=
-would do nothing except returning the string result, which you could
-later use yourself. However, it's recommended that you use the
-=action= argument.
-
-#+begin_src elisp
-(defun counsel-describe-function ()
-  "Forward to `describe-function'."
-  (interactive)
-  (ivy-read "Describe function: "
-            (let (cands)
-              (mapatoms
-               (lambda (x)
-                 (when (fboundp x)
-                   (push (symbol-name x) cands))))
-              cands)
-            :keymap counsel-describe-map
-            :preselect (counsel-symbol-at-point)
-            :history 'counsel-describe-symbol-history
-            :require-match t
-            :sort t
-            :action (lambda (x)
-                      (describe-function
-                       (intern x)))
-            :caller 'counsel-describe-function))
-#+end_src
-
-Here are the interesting features of the above function, in the order that 
they appear:
-
-- The =prompt= argument is a simple string ending in ": ".
-- The =collection= argument evaluates to a (large) list of strings.
-- The =keymap= argument is for a custom keymap to supplement 
=ivy-minibuffer-map=.
-- The =preselect= is provided by =counsel-symbol-at-point=, which
-  returns a symbol near the point. Ivy then selects the first
-  candidate from the collection that matches this symbol. To select
-  this pre-selected candidate, a ~RET~ will suffice. No further user
-  input is necessary.
-- The =history= argument is for keeping the history of this command
-  separate from the common history in =ivy-history=.
-- The =require-match= is set to =t= since it doesn't make sense to
-  call =describe-function= on an un-interned symbol.
-- The =sort= argument is set to =t= so choosing between similar
-  candidates becomes easier. Sometimes, the collection size will
-  exceed =ivy-sort-max-size=, which is 30000 by default. In that case
-  the sorting will not happen to avoid delays.
-
-  Adjust this variable to choose between sorting time and completion
-  start-up time.
-- The =action= argument calls =describe-function= on the interned
-  selected candidate.
-- The =caller= argument identifies this completion session. This is
-  important, since with the collection being a list of strings and not
-  a function name, the only other way for =ivy-read= to identify
-  "who's calling" and to apply the appropriate customizations is to
-  examine =this-command=. But =this-command= would be modified if
-  another command called =counsel-describe-function=.
-** Example - =counsel-locate=
-:PROPERTIES:
-:CUSTOM_ID: example---counsel-locate
-:END:
-This is a typical example of a function with an async collection.
-Since the collection function cannot pre-compute all the locatable
-files in memory within reasonable limits (time or memory), it relies
-on user input to filter the universe of possible candidates to a
-manageable size while also continuing to search asynchronously for
-possible candidates. Both the filtering and searching continues with
-each character change of the input with rapid updates to the
-collection presented without idle waiting times. This live update will
-continue as long as there are likely candidates. Eventually updates to
-the minibuffer will stop after user input, filtering, and searching
-have exhausted looking for possible candidates.
-
-Async collections suit long-running shell commands, such as =locate=.
-With each new input, a new process starts while the old process is
-killed. The collection is refreshed anew with each new process.
-Meanwhile the user can provide more input characters (for further
-narrowing) or select a candidate from the visible collection.
-
-#+begin_src elisp
-(defun counsel-locate-function (str)
-  (if (< (length str) 3)
-      (counsel-more-chars 3)
-    (counsel--async-command
-     (format "locate %s '%s'"
-             (mapconcat #'identity counsel-locate-options " ")
-             (counsel-unquote-regex-parens
-              (ivy--regex str))))
-    '("" "working...")))
-
-;;;###autoload
-(defun counsel-locate (&optional initial-input)
-  "Call the \"locate\" shell command.
-INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive)
-  (ivy-read "Locate: " #'counsel-locate-function
-            :initial-input initial-input
-            :dynamic-collection t
-            :history 'counsel-locate-history
-            :action (lambda (file)
-                      (with-ivy-window
-                        (when file
-                          (find-file file))))
-            :unwind #'counsel-delete-process
-            :caller 'counsel-locate))
-#+end_src
-
-Here are the interesting features of the above functions, in the order
-that they appear:
-
-- =counsel-locate-function= takes a string argument and returns a list
-  of strings. Note that it's not compatible with =all-completions=,
-  but since we're not using that here, might as well use one argument
-  instead of three.
-- =counsel-more-chars= is a simple function that returns e.g.
-  ='("2 chars more")= asking the user for more input.
-- =counsel--async-command= is a very easy API simplification that
-  takes a single string argument suitable for
-  =shell-command-to-string=. So you could prototype your function as
-  non-async using =shell-command-to-string= and =split-string= to
-  produce a collection, then decide that you want async and simply swap in
-  =counsel--async-command=.
-- =counsel-locate= is an interactive function with an optional =initial-input=.
-- =#'counsel-locate-function= is passed as the =collection= argument.
-- =dynamic-collection= is set to t, since this is an async collection.
-- =action= argument uses =with-ivy-window= wrapper, since we want to open the
-  selected file in the same window from which =counsel-locate= was
-  called.
-- =unwind= argument is set to =#'counsel-delete-process=: when we press ~C-g~
-  we want to kill the running process created by
-  =counsel--async-command=.
-- =caller= argument identifies this command for easier customization.
-** Example - =ivy-read-with-extra-properties=
-:PROPERTIES:
-:CUSTOM_ID: example---ivy-read-with-extra-properties
-:END:
-This is another example to show how to associate additional values to each
-displayed strings.
-
-#+BEGIN_SRC elisp
-(defun find-candidates-function (str pred _)
-  (let ((props '(1 2))
-        (strs '("foo" "foo2")))
-    (cl-mapcar (lambda (s p) (propertize s 'property p))
-               strs
-               props)))
-
-(defun find-candidates ()
-  (interactive)
-  (ivy-read "Find symbols: "
-            #'find-candidates-function
-            :action (lambda (x)
-                      (message "Value: %s" (get-text-property 0 'property x)
-                       ))))
-#+END_SRC
-
-Here are the interesting features of the above function:
-
-- =find-candidates-function= builds up a list of strings and associates "foo" 
with
-  the value 1 and "foo2" with 2.
-- =find-candidates= is an interactive function.
-- =#'find-candidates= is passed as the =collection= argument.
-- =action= gets passed the selected string with the associated value. It
-  then retrieves that value and displays it.
-
-* Variable Index
-:PROPERTIES:
-:INDEX:    vr
-:CUSTOM_ID: variable-index
-:END:
-
-* Keystroke Index
-:PROPERTIES:
-:CUSTOM_ID: key-index
-:INDEX:    ky
-:END:
diff --git a/packages/ivy/doc/ivy.texi b/packages/ivy/doc/ivy.texi
deleted file mode 100644
index 956fdcc..0000000
--- a/packages/ivy/doc/ivy.texi
+++ /dev/null
@@ -1,1702 +0,0 @@
-\input texinfo    @c -*- texinfo -*-
address@hidden %**start of header
address@hidden ./ivy.info
address@hidden Ivy User Manual
address@hidden UTF-8
address@hidden en
address@hidden %**end of header
-
address@hidden
address@hidden
-Ivy manual, version 0.8.0
-
-Ivy is an interactive interface for completion in Emacs. Emacs uses
-completion mechanism in a variety of contexts: code, menus, commands,
-variables, functions, etc. Completion entails listing, sorting,
-filtering, previewing, and applying actions on selected items. When
-active, @code{ivy-mode} completes the selection process by narrowing
-available choices while previewing in the minibuffer. Selecting the
-final candidate is either through simple keyboard character inputs or
-through powerful regular expressions.
address@hidden ifnottex
-
-Copyright (C) 2015 Free Software Foundation, Inc.
-
address@hidden
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3 or
-any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
-and with the Back-Cover Texts as in (a) below.  A copy of the license
-is included in the section entitled ``GNU Free Documentation License.''
-
-(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual.''
address@hidden quotation
address@hidden copying
-
address@hidden Emacs
address@hidden
-* Ivy: (ivy).           Using Ivy for completion.
address@hidden direntry
-
address@hidden
address@hidden
address@hidden Ivy User Manual
address@hidden Oleh Krehel
address@hidden
address@hidden 0pt plus 1filll
address@hidden
address@hidden titlepage
-
address@hidden
-
address@hidden
address@hidden Top
address@hidden Ivy User Manual
address@hidden
address@hidden ifnottex
-
address@hidden
-* Introduction::
-* Installation::
-* Getting started::
-* Key bindings::
-* Completion Styles::
-* Customization::
-* Commands::
-* API::
-* Variable Index::
-* Keystroke Index::
-
address@hidden
---- The Detailed Node Listing ---
-
-
-Installation
-
-* Installing from Emacs Package Manager::
-* Installing from the Git repository::
-
-
-
-Getting started
-
-* Basic customization::
-
-
-Key bindings
-
-* Global key bindings::
-* Minibuffer key bindings::
-
-
-Minibuffer key bindings
-
-* Key bindings for navigation::
-* Key bindings for single selection, action, then exit minibuffer: Key 
bindings for single selection action then exit minibuffer. 
-* Key bindings for multiple selections and actions, keep minibuffer open: Key 
bindings for multiple selections and actions keep minibuffer open. 
-* Key bindings that alter the minibuffer input::
-* Other key bindings::
-* Hydra in the minibuffer::
-* Saving the current completion session to a buffer::
-
-Completion Styles
-
-* ivy--regex-plus::
-* ivy--regex-ignore-order::
-* ivy--regex-fuzzy::
-
-
-
-Customization
-
-* Faces::
-* Defcustoms::
-* Actions::
-* Packages::
-
-
-
-Actions
-
-* What are actions?::
-* How can different actions be called?::
-* How to modify the actions list?::
-* Example - add two actions to each command::
-* Example - define a new command with several actions::
-
-
-
-
-Example - add two actions to each command
-
-* How to undo adding the two actions::
-* How to add actions to a specific command::
-
-
-
-Example - define a new command with several actions
-
-* Test the above function with @code{ivy-occur}::
-
-Commands
-
-* File Name Completion::
-* Buffer Name Completion::
-* Counsel commands::
-
-
-
-API
-
-* Required arguments for @code{ivy-read}::
-* Optional arguments for @code{ivy-read}::
-* Example - @code{counsel-describe-function}::
-* Example - @code{counsel-locate}::
address@hidden detailmenu
address@hidden menu
-
address@hidden Introduction
address@hidden Introduction
-
-Ivy is for quick and easy selection from a list. When Emacs prompts
-for a string from a list of several possible choices, Ivy springs into
-action to assist in narrowing and picking the right string from a vast
-number of choices.
-
-Ivy strives for minimalism, simplicity, customizability and
-discoverability.
-
address@hidden Minimalism
address@hidden
-Uncluttered minibuffer is minimalism. Ivy shows the completion
-defaults, the number of matches, and 10 candidate matches below
-the input line. Customize @code{ivy-height} to adjust the number of
-candidate matches displayed in the minibuffer.
address@hidden indentedblock
address@hidden Simplicity
address@hidden
-Simplicity is about Ivy's behavior in the minibuffer. It is also
-about the code interface to extend Ivy's functionality. The
-minibuffer area behaves as close to @code{fundamental-mode} as
-possible. @kbd{SPC} inserts a space, for example, instead of being
-bound to the more complex @code{minibuffer-complete-word}. Ivy's code
-uses easy-to-examine global variables; avoids needless
-complications with branch-introducing custom macros.
address@hidden indentedblock
address@hidden Customizability
address@hidden
-Customizability is about being able to use different methods and
-interfaces of completion to tailor the selection process. For
-example, adding a custom display function that points to a
-selected candidate with @code{>}, instead of highlighting the selected
-candidate with the @code{ivy-current-match} face (see
address@hidden). Or take the customization of actions, say
-after the candidate function is selected. @kbd{RET} uses
address@hidden to describe the function, whereas
address@hidden d} jumps to that function's definition in the code. The
address@hidden prefix can be uniformly used with characters like @kbd{d} to
-group similar actions.
address@hidden indentedblock
address@hidden Discoverability
address@hidden
-Ivy displays easily discoverable commands through the hydra
-facility.  @kbd{C-o} in the minibuffer displays a hydra menu. It
-opens up within an expanded minibuffer area. Each menu item comes
-with short documentation strings and highlighted one-key
-completions. So discovering even seldom used keys is simply a
-matter of @kbd{C-o} in the minibuffer while in the midst of the Ivy
-interaction. This discoverability minimizes exiting Ivy interface
-for documentation look-ups.
address@hidden indentedblock
-
address@hidden Installation
address@hidden Installation
-
-Install Ivy automatically through Emacs's package manager, or manually
-from Ivy's development repository.
-
-Emacs 24.3.1 is the oldest version to run Ivy. Emacs 24.5.1 is the
-oldest version that runs Ivy with fancy faces display.
-
address@hidden
-* Installing from Emacs Package Manager::
-* Installing from the Git repository::
address@hidden menu
-
address@hidden Installing from Emacs Package Manager
address@hidden Installing from Emacs Package Manager
-
address@hidden @code{package-install} @kbd{RET} @code{swiper} @kbd{RET}
-
-Ivy is installed as part of @code{swiper} package. @code{swiper} is available
-from two different package archives, GNU ELPA and MELPA. For the
-latest stable version, use the GNU ELPA archives using the above M-x
-command.
-
-For current hourly builds, use the MELPA archives. See the code below
-for adding MELPA to the list of package archives:
-
address@hidden
-(require 'package)
-(add-to-list 'package-archives
-             '("melpa" . "http://melpa.org/packages/";))
address@hidden lisp
-
-After this do @kbd{M-x} @code{package-refresh-contents} @kbd{RET}, followed by
address@hidden @code{package-install} @kbd{RET} @code{counsel} @kbd{RET}.
-
-For package manager details, see @ref{Packages,,,emacs,}.
-
address@hidden Installing from the Git repository
address@hidden Installing from the Git repository
-
address@hidden Why install from Git?
address@hidden
address@hidden
address@hidden
-No need to wait for MELPA's hourly builds
address@hidden
-Easy to revert to previous versions
address@hidden
-Contribute to Ivy's development; send patches; pull requests
address@hidden itemize
address@hidden indentedblock
-
-
address@hidden Configuration steps
address@hidden
-First clone the Swiper repository with:
-
address@hidden
-     cd ~/git && git clone https://github.com/abo-abo/swiper
-     cd swiper && make compile
address@hidden example
-
-Second, add these lines to the Emacs init file:
-
address@hidden
-     (add-to-list 'load-path "~/git/swiper/")
-     (require 'ivy)
address@hidden lisp
-
-Then, update the code with:
-
address@hidden
-     git pull
-     make
address@hidden example
address@hidden indentedblock
-
address@hidden Getting started
address@hidden Getting started
-
-First enable Ivy completion everywhere:
-
address@hidden
-(ivy-mode 1)
address@hidden lisp
-
-Note: @code{ivy-mode} can be toggled on and off with @kbd{M-x} @code{ivy-mode}.
-
address@hidden
-* Basic customization::
address@hidden menu
-
address@hidden Basic customization
address@hidden Basic customization
-
-Here are some basic settings particularly useful for new Ivy users:
-
address@hidden
-(setq ivy-use-virtual-buffers t)
-(setq ivy-count-format "(%d/%d) ")
address@hidden lisp
-
-If you want, you can go without any customizations at all. The above
-settings are the most bang for the buck in terms of customization.  So
-users that typically don't like customize a lot are advised to look at
-these settings first.
-
-For more advanced customizations, refer to @code{M-x describe-variable}
-documentation.
-
address@hidden Key bindings
address@hidden Key bindings
-
address@hidden
-* Global key bindings::
-* Minibuffer key bindings::
address@hidden menu
-
address@hidden Global key bindings
address@hidden Global key bindings
-
-The recommended key bindings are:
-
address@hidden Ivy-based interface to standard commands
address@hidden
address@hidden
-     (global-set-key (kbd "C-s") 'swiper)
-     (global-set-key (kbd "M-x") 'counsel-M-x)
-     (global-set-key (kbd "C-x C-f") 'counsel-find-file)
-     (global-set-key (kbd "<f1> f") 'counsel-describe-function)
-     (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
-     (global-set-key (kbd "<f1> l") 'counsel-find-library)
-     (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
-     (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
address@hidden lisp
address@hidden indentedblock
address@hidden Ivy-based interface to shell and system tools
address@hidden
address@hidden
-     (global-set-key (kbd "C-c g") 'counsel-git)
-     (global-set-key (kbd "C-c j") 'counsel-git-grep)
-     (global-set-key (kbd "C-c k") 'counsel-ag)
-     (global-set-key (kbd "C-x l") 'counsel-locate)
-     (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
address@hidden lisp
address@hidden indentedblock
address@hidden Ivy-resume and other commands
address@hidden
address@hidden resumes the last Ivy-based completion.
-
address@hidden
-     (global-set-key (kbd "C-c C-r") 'ivy-resume)
address@hidden lisp
address@hidden indentedblock
-
address@hidden Minibuffer key bindings
address@hidden Minibuffer key bindings
-
address@hidden ivy-minibuffer-map
-Ivy includes several minibuffer bindings, which are defined in the
address@hidden keymap variable. The most frequently used ones
-are described here.
-
address@hidden or @code{counsel-M-x} add more key bindings through the 
@code{keymap}
-argument to @code{ivy-read}. These keys, also active in the minibuffer, are
-described under their respective commands.
-
-A key feature of @code{ivy-minibuffer-map} is its full editing capability
-where the familiar @kbd{C-a}, @kbd{C-f}, @kbd{M-d}, @kbd{M-DEL}, @kbd{M-b}, 
@kbd{M-w}, @kbd{C-k},
address@hidden key bindings work the same as in @code{fundamental-mode}.
-
address@hidden
-* Key bindings for navigation::
-* Key bindings for single selection, action, then exit minibuffer: Key 
bindings for single selection action then exit minibuffer. 
-* Key bindings for multiple selections and actions, keep minibuffer open: Key 
bindings for multiple selections and actions keep minibuffer open. 
-* Key bindings that alter the minibuffer input::
-* Other key bindings::
-* Hydra in the minibuffer::
-* Saving the current completion session to a buffer::
address@hidden menu
-
address@hidden Key bindings for navigation
address@hidden Key bindings for navigation
-
address@hidden
address@hidden
address@hidden (@code{ivy-next-line}) selects the next candidate
address@hidden
address@hidden (@code{ivy-previous-line}) selects the previous candidate
address@hidden
address@hidden<} (@code{ivy-beginning-of-buffer}) selects the first candidate
address@hidden
address@hidden>} (@code{ivy-end-of-buffer}) selects the last candidate
address@hidden
address@hidden (@code{ivy-scroll-up-command}) scrolls up by @code{ivy-height} 
lines
address@hidden
address@hidden (@code{ivy-scroll-down-command}) scrolls down by 
@code{ivy-height} lines
address@hidden itemize
-
-
address@hidden ivy-wrap
-Specifies the wrap-around behavior for @kbd{C-n} and @kbd{C-p}. When
address@hidden is set to @code{t}, @code{ivy-next-line} and 
@code{ivy-previous-line}
-will cycle past the last and the first candidates respectively.
-
-Warp-around behavior is off by default.
address@hidden defopt
-
address@hidden ivy-height
-Use this option to adjust the minibuffer height, which also
-affects scroll size when using @kbd{C-v} and @kbd{M-v} key bindings.
-
address@hidden is 10 lines by default.
address@hidden defopt
-
address@hidden Key bindings for single selection action then exit minibuffer
address@hidden Key bindings for single selection, action, then exit minibuffer
-
-Ivy can offer several actions from which to choose which action to
-run. This "calling an action" operates on the selected candidate. For
-example, when viewing a list of files, one action could open it for
-editing, one to view it, another to invoke a special function, and so
-on. Custom actions can be added to this interface. The precise action
-to call on the selected candidate can be delayed until after the
-narrowing is completed. No need to exit the interface if unsure which
-action to run. This delayed flexibility and customization of actions
-extends usability of lists in Emacs.
-
address@hidden @kbd{C-m} or @kbd{RET} (@code{ivy-done})
address@hidden ivy-done
address@hidden C-m
address@hidden RET
address@hidden
-Calls the default action and then exits the minibuffer.
address@hidden indentedblock
address@hidden @kbd{M-o} (@code{ivy-dispatching-done})
address@hidden ivy-dispatching-done
address@hidden M-o
address@hidden
-Presents valid actions from which to choose. When only one action
-is available, there is no difference between @kbd{M-o} and @kbd{C-m}.
address@hidden indentedblock
address@hidden @kbd{C-j} (@code{ivy-alt-done})
address@hidden ivy-alt-done
address@hidden C-j
address@hidden
-When completing file names, selects the current directory
-candidate and starts a new completion session there. Otherwise,
-it is the same as @code{ivy-done}.
address@hidden indentedblock
address@hidden @kbd{TAB} (@code{ivy-partial-or-done})
address@hidden ivy-partial-or-done
address@hidden TAB
address@hidden
-Attempts partial completion, extending current input as much as
-possible. @kbd{TAB TAB} is the same as @kbd{C-j} (@code{ivy-alt-done}).
-
-Example ERT test:
-
address@hidden
-     (should
-      (equal (ivy-with
-              '(progn
-                (ivy-read "Test: " '("can do" "can't, sorry" "other"))
-                ivy-text)
-              "c <tab>")
-             "can"))
address@hidden lisp
address@hidden indentedblock
address@hidden @kbd{C-M-j} (@code{ivy-immediate-done})
address@hidden ivy-immediate-done
address@hidden C-M-j
address@hidden
-Exits with @emph{the current input} instead of @emph{the current candidate}
-(like other commands).
-
-This is useful e.g. when you call @code{find-file} to create a new
-file, but the desired name matches an existing file. In that
-case, using @kbd{C-j} would select that existing file, which isn't
-what you want - use this command instead.
address@hidden indentedblock
address@hidden @kbd{C-'} (@code{ivy-avy})
address@hidden ivy-avy
address@hidden C-'
address@hidden
-Uses avy to select one of the candidates on the current candidate
-page.  This can often be faster than multiple @kbd{C-n} or @kbd{C-p}
-keystrokes followed by @kbd{C-m}.
address@hidden indentedblock
-
address@hidden Key bindings for multiple selections and actions keep minibuffer 
open
address@hidden Key bindings for multiple selections and actions, keep 
minibuffer open
-
-For repeatedly applying multiple actions or acting on multiple
-candidates, Ivy does not close the minibuffer between commands. It
-keeps the minibuffer open for applying subsequent actions.
-
-Adding an extra meta key to the normal key chord invokes the special
-version of the regular commands that enables applying multiple
-actions.
-
address@hidden @kbd{C-M-m} (@code{ivy-call})
address@hidden ivy-call
address@hidden C-M-m
address@hidden
-Is the non-exiting version of @kbd{C-m} (@code{ivy-done}).
-
-Instead of closing the minibuffer, @kbd{C-M-m} allows selecting
-another candidate or another action. For example, @kbd{C-M-m} on
-functions list invokes @code{describe-function}. When combined with
address@hidden, function descriptions can be invoked quickly in
-succession.
address@hidden indentedblock
address@hidden @kbd{C-M-o} (@code{ivy-dispatching-call})
address@hidden ivy-dispatching-call
address@hidden C-M-o
address@hidden
-Is the non-exiting version of @kbd{M-o} (@code{ivy-dispatching-done}).
-
-For example, during the @code{counsel-rhythmbox} completion, press
address@hidden e} to en-queue the selected candidate, followed by @kbd{C-n
-     C-m} to play the next candidate - the current action reverts to
-the default one after @kbd{C-M-o}.
address@hidden indentedblock
address@hidden @kbd{C-M-n} (@code{ivy-next-line-and-call})
address@hidden ivy-next-line-and-call
address@hidden C-M-n
address@hidden
-Combines @kbd{C-n} and @kbd{C-M-m}. Applies an action and moves to next
-line.
-
-Comes in handy when opening multiple files from
address@hidden, @code{counsel-git-grep}, @code{counsel-ag},
address@hidden, or @code{counsel-locate} lists. Just hold
address@hidden for rapid-fire default action on each successive element
-of the list.
address@hidden indentedblock
address@hidden @kbd{C-M-p} (@code{ivy-previous-line-and-call})
address@hidden ivy-previous-line-and-call
address@hidden C-M-p
address@hidden
-Combines @kbd{C-p} and @kbd{C-M-m}.
-
-Similar to the above except it moves through the list in the
-other direction.
address@hidden indentedblock
address@hidden @code{ivy-resume}
address@hidden ivy-resume
address@hidden
-Recalls the state of the completion session just before its last
-exit.
-
-Useful after an accidental @kbd{C-m} (@code{ivy-done}).
address@hidden indentedblock
-
address@hidden Key bindings that alter the minibuffer input
address@hidden Key bindings that alter the minibuffer input
-
address@hidden @kbd{M-n} (@code{ivy-next-history-element})
address@hidden ivy-next-history-element
address@hidden M-n
address@hidden
-Cycles forward through the Ivy command history.
-
-Ivy updates an internal history list after each action. When this
-history list is empty, @kbd{M-n} inserts symbol (or URL) at point
-into the minibuffer.
address@hidden indentedblock
address@hidden @kbd{M-p} (@code{ivy-previous-history-element})
address@hidden ivy-previous-history-element
address@hidden M-p
address@hidden
-Cycles forward through the Ivy command history.
address@hidden indentedblock
address@hidden @kbd{M-i} (@code{ivy-insert-current})
address@hidden ivy-insert-current
address@hidden M-i
address@hidden
-Inserts the current candidate into the minibuffer.
-
-Useful for copying and renaming files, for example: @kbd{M-i} to
-insert the original file name string, edit it, and then @kbd{C-m} to
-complete the renaming.
address@hidden indentedblock
address@hidden @kbd{M-j} (@code{ivy-yank-word})
address@hidden ivy-yank-word
address@hidden M-j
address@hidden
-Inserts the sub-word at point into the minibuffer.
-
-This is similar to @kbd{C-s C-w} with @code{isearch}. Ivy reserves @kbd{C-w}
-for @code{kill-region}.
address@hidden indentedblock
address@hidden @kbd{S-SPC} (@code{ivy-restrict-to-matches})
address@hidden ivy-restrict-to-matches
address@hidden S-SPC
address@hidden
-Deletes the current input, and resets the candidates list to the
-currently restricted matches.
-
-This is how Ivy provides narrowing in successive tiers.
address@hidden indentedblock
address@hidden @kbd{C-r} (@code{ivy-reverse-i-search})
address@hidden ivy-reverse-i-search
address@hidden C-r
address@hidden
-Starts a recursive completion session through the command's
-history.
-
-This works just like @kbd{C-r} at the bash command prompt, where the
-completion candidates are the history items. Upon completion, the
-selected candidate string is inserted into the minibuffer.
address@hidden indentedblock
-
address@hidden Other key bindings
address@hidden Other key bindings
-
address@hidden @kbd{M-w} (@code{ivy-kill-ring-save})
address@hidden ivy-kill-ring-save
address@hidden M-w
address@hidden
-Copies selected candidates to the kill ring.
-
-Copies the region if the region is active.
address@hidden indentedblock
-
address@hidden Hydra in the minibuffer
address@hidden Hydra in the minibuffer
-
address@hidden @kbd{C-o} (@code{hydra-ivy/body})
address@hidden C-o
address@hidden
-Invokes the hydra menu with short key bindings.
address@hidden indentedblock
-
-When Hydra is active, minibuffer editing is disabled and menus
-display short aliases:
-
address@hidden {aaaaa} {aaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaa}
address@hidden Short
address@hidden Normal
address@hidden Command name
address@hidden @kbd{o}
address@hidden @kbd{C-g}
address@hidden @code{keyboard-escape-quit}
address@hidden @kbd{j}
address@hidden @kbd{C-n}
address@hidden @code{ivy-next-line}
address@hidden @kbd{k}
address@hidden @kbd{C-p}
address@hidden @code{ivy-previous-line}
address@hidden @kbd{h}
address@hidden @kbd{M-<}
address@hidden @code{ivy-beginning-of-buffer}
address@hidden @kbd{l}
address@hidden @kbd{M->}
address@hidden @code{ivy-end-of-buffer}
address@hidden @kbd{d}
address@hidden @kbd{C-m}
address@hidden @code{ivy-done}
address@hidden @kbd{f}
address@hidden @kbd{C-j}
address@hidden @code{ivy-alt-done}
address@hidden @kbd{g}
address@hidden @kbd{C-M-m}
address@hidden @code{ivy-call}
address@hidden @kbd{u}
address@hidden @kbd{C-c C-o}
address@hidden @code{ivy-occur}
address@hidden multitable
-
-Hydra reduces key strokes, for example: @kbd{C-n C-n C-n C-n} is @kbd{C-o
-jjjj} in Hydra.
-
-Hydra menu offers these additioanl bindings:
-
address@hidden @kbd{c} (@code{ivy-toggle-calling})
address@hidden ivy-toggle-calling
address@hidden c
address@hidden
-Toggle calling the action after each candidate change. It
-modifies @kbd{j} to @kbd{jg}, @kbd{k} to @kbd{kg} etc.
address@hidden indentedblock
address@hidden @kbd{m} (@code{ivy-toggle-fuzzy})
address@hidden ivy-toggle-fuzzy
address@hidden m
address@hidden
-Toggle the current regexp matcher.
address@hidden indentedblock
address@hidden @kbd{>} (@code{ivy-minibuffer-grow})
address@hidden ivy-minibuffer-grow
address@hidden >
address@hidden
-Increase @code{ivy-height} for the current minibuffer.
address@hidden indentedblock
address@hidden @kbd{<} (@code{ivy-minibuffer-shrink})
address@hidden ivy-minibuffer-shrink
address@hidden <
address@hidden
-Decrease @code{ivy-height} for the current minibuffer.
address@hidden indentedblock
address@hidden @kbd{w} (@code{ivy-prev-action})
address@hidden ivy-prev-action
address@hidden w
address@hidden
-Select the previous action.
address@hidden indentedblock
address@hidden @kbd{s} (@code{ivy-next-action})
address@hidden ivy-next-action
address@hidden s
address@hidden
-Select the next action.
address@hidden indentedblock
address@hidden @kbd{a} (@code{ivy-read-action})
address@hidden ivy-read-action
address@hidden a
address@hidden
-Use a menu to select an action.
address@hidden indentedblock
address@hidden @kbd{C} (@code{ivy-toggle-case-fold})
address@hidden ivy-toggle-case-fold
address@hidden C
address@hidden
-Toggle case folding (match both upper and lower case
-characters for lower case input).
address@hidden indentedblock
-
address@hidden Saving the current completion session to a buffer
address@hidden Saving the current completion session to a buffer
-
address@hidden @kbd{C-c C-o} (@code{ivy-occur})
address@hidden ivy-occur
address@hidden C-c C-o
address@hidden
-Saves the current candidates to a new buffer and exits
-completion.
address@hidden indentedblock
-
-The new buffer is read-only and has a few useful bindings defined.
-
address@hidden @kbd{RET} or @kbd{j} (@code{ivy-occur-press})
address@hidden ivy-occur-press
address@hidden RET
address@hidden j
address@hidden
-Call the current action on the selected candidate.
address@hidden indentedblock
address@hidden @kbd{mouse-1} (@code{ivy-occur-click})
address@hidden ivy-occur-click
address@hidden mouse-1
address@hidden
-Call the current action on the selected candidate.
address@hidden indentedblock
address@hidden @kbd{j} (@code{next-line})
address@hidden j
address@hidden
-Move to next line.
address@hidden indentedblock
address@hidden @kbd{k} (@code{previous-line})
address@hidden k
address@hidden
-Move to previous line.
address@hidden indentedblock
address@hidden @kbd{a} (@code{ivy-occur-read-action})
address@hidden ivy-occur-read-action
address@hidden a
address@hidden
-Read an action and make it current for this buffer.
address@hidden indentedblock
address@hidden @kbd{o} (@code{ivy-occur-dispatch})
address@hidden ivy-occur-dispatch
address@hidden o
address@hidden
-Read an action and call it on the selected candidate.
address@hidden indentedblock
address@hidden @kbd{q} (@code{quit-window})
address@hidden q
address@hidden
-Bury the current buffer.
address@hidden indentedblock
-
-
-Ivy has no limit on the number of active buffers like these.
-
-Ivy takes care of naming buffers uniquely by constructing descriptive
-names. For example: @code{*ivy-occur counsel-describe-variable
-"function$*}.
-
address@hidden Completion Styles
address@hidden Completion Styles
-
-Ivy's completion functions rely on a regex builder - a function that
-transforms a string input to a string regex. All current candidates
-simply have to match this regex. Each collection can be assigned its
-own regex builder by customizing @code{ivy-re-builders-alist}.
-
-The keys of this alist are collection names, and the values are one of
-the following:
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden itemize
-
-A catch-all key, @code{t}, applies to all collections that don't have their
-own key.
-
-The default is:
-
address@hidden
-(setq ivy-re-builders-alist
-      '((t . ivy--regex-plus)))
address@hidden lisp
-
-This example shows a custom regex builder assigned to file name
-completion:
-
address@hidden
-(setq ivy-re-builders-alist
-      '((read-file-name-internal . ivy--regex-fuzzy)
-        (t . ivy--regex-plus)))
address@hidden lisp
-
-Here, @code{read-file-name-internal} is a function that is passed as the
-second argument to @code{completing-read} for file name completion.
-
-The regex builder resolves as follows (in order of priority):
address@hidden
address@hidden
address@hidden argument passed to @code{ivy-read}.
address@hidden
address@hidden argument passed to @code{ivy-read} is a function and has an
-entry on @code{ivy-re-builders-alist}.
address@hidden
address@hidden argument passed to @code{ivy-read} has an entry on
address@hidden
address@hidden
address@hidden has an entry on @code{ivy-re-builders-alist}.
address@hidden
address@hidden has an entry on @code{ivy-re-builders-alist}.
address@hidden
address@hidden
address@hidden enumerate
-
address@hidden
-* ivy--regex-plus::
-* ivy--regex-ignore-order::
-* ivy--regex-fuzzy::
address@hidden menu
-
address@hidden ivy--regex-plus
address@hidden ivy--regex-plus
-
address@hidden is Ivy's default completion method.
-
address@hidden matches by splitting the input by spaces and
-rebuilding it into a regex.
-
-As the search string is typed in Ivy's minibuffer, it is transformed
-into valid regex syntax. If the string is @code{"for example"}, it is
-transformed into
-
address@hidden
-"\\(for\\).*\\(example\\)"
address@hidden lisp
-
-which in regex terminology matches @code{"for"} followed by a wild card and
-then @code{"example"}. Note how Ivy uses the space character to build wild
-cards. To match a literal white space, use an extra space. So to match
-one space type two spaces, to match two spaces type three spaces, and
-so on.
-
-As Ivy transforms typed characters into regex strings, it provides an
-intuitive feedback through font highlights.
-
-Ivy supports regexp negation with @code{"!"}.
-For example, @code{"define key ! ivy quit"} first selects everything
-matching @code{"define.*key"}, then removes everything matching @code{"ivy"},
-and finally removes everything matching @code{"quit"}. What remains is the
-final result set of the negation regexp.
-
-Since Ivy treats minibuffer input as a regexp, the standard regexp
-identifiers work: @code{"^"}, @code{"$"}, @code{"\b"} or @code{"[a-z]"}. The 
exceptions
-are spaces, which translate to @code{".*"}, and @code{"!"} that signal the
-beginning of a negation group.
-
address@hidden ivy--regex-ignore-order
address@hidden ivy--regex-ignore-order
-
address@hidden ignores the order of regexp tokens when
-searching for matching candidates. For instance, the input
address@hidden"for example"} will match @code{"example test for"}.
-
address@hidden ivy--regex-fuzzy
address@hidden ivy--regex-fuzzy
-
address@hidden splits each character with a wild card. Searching
-for @code{"for"} returns all @code{"f.*o.*r"} matches, resulting in a large
-number of hits.  Yet some searches need these extra hits. Ivy sorts
-such large lists using @code{flx} package's scoring mechanism, if it's
-installed.
-
address@hidden m} toggles the current regexp builder.
-
address@hidden Customization
address@hidden Customization
-
address@hidden
-* Faces::
-* Defcustoms::
-* Actions::
-* Packages::
address@hidden menu
-
address@hidden Faces
address@hidden Faces
-
address@hidden @code{ivy-current-match}
address@hidden ivy-current-match
address@hidden
-Highlights the currently selected candidate.
address@hidden indentedblock
address@hidden @code{ivy-minibuffer-match-face-1}
address@hidden ivy-minibuffer-match-face-1
address@hidden
-Highlights the background of the match.
address@hidden indentedblock
address@hidden @code{ivy-minibuffer-match-face-2}
address@hidden ivy-minibuffer-match-face-2
address@hidden
-Highlights the first (modulo 3) matched group.
address@hidden indentedblock
address@hidden @code{ivy-minibuffer-match-face-3}
address@hidden ivy-minibuffer-match-face-3
address@hidden
-Highlights the second (modulo 3) matched group.
address@hidden indentedblock
address@hidden @code{ivy-minibuffer-match-face-4}
address@hidden ivy-minibuffer-match-face-4
address@hidden
-Highlights the third (modulo 3) matched group.
address@hidden indentedblock
address@hidden @code{ivy-confirm-face}
address@hidden ivy-confirm-face
address@hidden
-Highlights the "(confirm)" part of the prompt.
-
-When @code{confirm-nonexistent-file-or-buffer} set to @code{t}, then
-confirming non-existent files in @code{ivy-mode} requires an
-additional @kbd{RET}.
-
-The confirmation prompt will use this face.
-
-For example:
-
address@hidden
-     (setq confirm-nonexistent-file-or-buffer t)
address@hidden lisp
-
-Then call @code{find-file}, enter "eldorado" and press @kbd{RET} - the
-prompt will be appended with "(confirm)". Press @kbd{RET} once more
-to confirm, or any key to continue the completion.
address@hidden indentedblock
address@hidden @code{ivy-match-required-face}
address@hidden ivy-match-required-face
address@hidden
-Highlights the "(match required)" part of the prompt.
-
-When completions have to match available candidates and cannot
-take random input, the "(match required)" prompt signals this
-constraint.
-
-For example, call @code{describe-variable}, enter "waldo" and press
address@hidden - "(match required)" is prompted.
-Press any key for the prompt to disappear.
address@hidden indentedblock
address@hidden @code{ivy-subdir}
address@hidden ivy-subdir
address@hidden
-Highlights directories when completing file names.
address@hidden indentedblock
address@hidden @code{ivy-remote}
address@hidden ivy-remote
address@hidden
-Highlights remote files when completing file names.
address@hidden indentedblock
address@hidden @code{ivy-virtual}
address@hidden ivy-virtual
address@hidden
-Highlights virtual buffers when completing buffer names.
-
-Virtual buffers correspond to bookmarks and recent files list,
address@hidden
-
-Enable virtual buffers with:
-
address@hidden
-     (setq ivy-use-virtual-buffers t)
address@hidden lisp
address@hidden indentedblock
-
address@hidden Defcustoms
address@hidden Defcustoms
-
address@hidden ivy-count-format
-A string that specifies display of number of candidates and
-current candidate, if one exists.
-
-The number of matching candidates by default is shown as a right-
-padded integer value.
-
-To disable showing the number of candidates:
-
address@hidden
-     (setq ivy-count-format "")
address@hidden lisp
-
-To also display the current candidate:
-
address@hidden
-     (setq ivy-count-format "(%d/%d) ")
address@hidden lisp
-
-The @code{format}-style switches this variable uses are described
-in the @code{format} documentation.
address@hidden defopt
-
address@hidden ivy-display-style
-Specifies highlighting candidates in the minibuffer.
-
-The default setting is @code{'fancy} and valid only in Emacs versions
-24.5 or newer.
-
-Set @code{ivy-display-style} to @code{nil} for a plain minibuffer.
address@hidden defopt
-
address@hidden ivy-on-del-error-function
-Specify what when @kbd{DEL} (@code{ivy-backward-delete-char}) throws.
-
-The default behavior is to quit the completion after @kbd{DEL} -- a
-handy key to invoke after mistakenly triggering a completion.
address@hidden defopt
-
address@hidden Actions
address@hidden Actions
-
address@hidden
-* What are actions?::
-* How can different actions be called?::
-* How to modify the actions list?::
-* Example - add two actions to each command::
-* Example - define a new command with several actions::
address@hidden menu
-
address@hidden What are actions?
address@hidden What are actions?
-
-An action is a function that is called after you select a candidate
-during completion. This function takes a single string argument, which
-is the selected candidate.
-
address@hidden Window context when calling an action
address@hidden
-Currently, the action is executed in the minibuffer window
-context. This means e.g. that if you call @code{insert} the text will
-be inserted into the minibuffer.
-
-If you want to execute the action in the initial window from
-which the completion started, use the @code{with-ivy-window} wrapper
-macro.
-
address@hidden
-     (defun ivy-insert-action (x)
-       (with-ivy-window
-         (insert x)))
address@hidden lisp
address@hidden indentedblock
-
address@hidden How can different actions be called?
address@hidden How can different actions be called?
-
address@hidden
address@hidden
address@hidden (@code{ivy-done}) calls the current action.
address@hidden
address@hidden (@code{ivy-dispatching-done}) presents available actions for
-selection, calls it after selection, and then exits.
address@hidden
address@hidden (@code{ivy-dispatching-call}) presents available actions for
-selection, calls it after selection, and then does not exit.
address@hidden itemize
-
address@hidden How to modify the actions list?
address@hidden How to modify the actions list?
-
-Currently, you can append any amount of your own actions to the
-default list of actions. This can be done either for a specific
-command, or for all commands at once.
-
-Usually, the command has only one default action. The convention is to
-use single letters when selecting a command, and the letter @kbd{o} is
-designated for the default command. This way, @kbd{M-o o} should be always
-equivalent to @kbd{C-m}.
-
address@hidden Example - add two actions to each command
address@hidden Example - add two actions to each command
-
-The first action inserts the current candidate into the Ivy window -
-the window from which @code{ivy-read} was called.
-
-The second action copies the current candidate to the kill ring.
-
address@hidden
-(defun ivy-yank-action (x)
-  (kill-new x))
-
-(defun ivy-copy-to-buffer-action (x)
-  (with-ivy-window
-    (insert x)))
-
-(ivy-set-actions
- t
- '(("i" ivy-copy-to-buffer-action "insert")
-   ("y" ivy-yank-action "yank")))
address@hidden lisp
-
-Then in any completion session, @kbd{M-o y} invokes @code{ivy-yank-action}, and
address@hidden i} invokes @code{ivy-copy-to-buffer-action}.
-
address@hidden
-* How to undo adding the two actions::
-* How to add actions to a specific command::
address@hidden menu
-
address@hidden How to undo adding the two actions
address@hidden How to undo adding the two actions
-
-Since @code{ivy-set-actions} modifies the internal dictionary with new
-data, set the extra actions list to @code{nil} by assigning @code{nil} value to
-the @code{t} key as follows:
-
address@hidden
-(ivy-set-actions t nil)
address@hidden lisp
-
address@hidden How to add actions to a specific command
address@hidden How to add actions to a specific command
-
-Use the command name as the key:
-
address@hidden
-(ivy-set-actions
- 'swiper
- '(("i" ivy-copy-to-buffer-action "insert")
-   ("y" ivy-yank-action "yank")))
address@hidden lisp
-
address@hidden Example - define a new command with several actions
address@hidden Example - define a new command with several actions
-
address@hidden
-(defun my-action-1 (x)
-  (message "action-1: %s" x))
-
-(defun my-action-2 (x)
-  (message "action-2: %s" x))
-
-(defun my-action-3 (x)
-  (message "action-3: %s" x))
-
-(defun my-command-with-3-actions ()
-  (interactive)
-  (ivy-read "test: " '("foo" "bar" "baz")
-            :action '(1
-                      ("o" my-action-1 "action 1")
-                      ("j" my-action-2 "action 2")
-                      ("k" my-action-3 "action 3"))))
address@hidden lisp
-
-The number 1 above is the index of the default action. Each
-action has its own string description for easy selection.
-
address@hidden
-* Test the above function with @code{ivy-occur}::
address@hidden menu
-
address@hidden Test the above function with @code{ivy-occur}
address@hidden Test the above function with @code{ivy-occur}
-
-To examine each action with each candidate in a key-efficient way, try:
-
address@hidden
address@hidden
-Call @code{my-command-with-3-actions}
address@hidden
-Press @kbd{C-c C-o} to close the completion window and move to an
-ivy-occur buffer
address@hidden
-Press @kbd{kkk} to move to the first candidate, since the point is most
-likely at the end of the buffer
address@hidden
-Press @kbd{oo} to call the first action
address@hidden
-Press @kbd{oj} and @kbd{ok} to call the second and the third actions
address@hidden
-Press @kbd{j} to move to the next candidate
address@hidden
-Press @kbd{oo}, @kbd{oj}, @kbd{ok}
address@hidden
-Press @kbd{j} to move to the next candidate
address@hidden
-and so address@hidden
address@hidden itemize
-
address@hidden Packages
address@hidden Packages
-
address@hidden @code{org-mode}
address@hidden
address@hidden versions 8.3.3 or later obey
address@hidden (which @code{ivy-mode} sets). Try refiling
-headings with similar names to appreciate @code{ivy-mode}.
address@hidden indentedblock
address@hidden @code{magit}
address@hidden
-Magit requires this setting for ivy completion:
-
address@hidden
-     (setq magit-completing-read-function 'ivy-completing-read)
address@hidden lisp
address@hidden indentedblock
address@hidden @code{find-file-in-project}
address@hidden
-It uses ivy by default if Ivy is installed.
address@hidden indentedblock
address@hidden @code{projectile}
address@hidden
-Projectile requires this setting for ivy completion:
-
address@hidden
-     (setq projectile-completion-system 'ivy)
address@hidden lisp
address@hidden indentedblock
address@hidden @code{helm-make}
address@hidden
-Helm-make requires this setting for ivy completion.
-
address@hidden
-     (setq helm-make-completion-method 'ivy)
address@hidden lisp
address@hidden indentedblock
-
address@hidden Commands
address@hidden Commands
-
address@hidden
-* File Name Completion::
-* Buffer Name Completion::
-* Counsel commands::
address@hidden menu
-
address@hidden File Name Completion
address@hidden File Name Completion
-
-Since file name completion is ubiquitous, Ivy provides extra
-bindings that work here:
-
-
address@hidden @kbd{C-j} (@code{ivy-alt-done})
address@hidden ivy-alt-done
address@hidden C-j
address@hidden
-On a directory, restarts completion from that directory.
-
-On a file or @code{./}, exit completion with the selected candidate.
address@hidden indentedblock
address@hidden @kbd{DEL} (@code{ivy-backward-delete-char})
address@hidden ivy-backward-delete-char
address@hidden DEL
address@hidden
-Restart the completion in the parent directory if current input
-is empty.
address@hidden indentedblock
address@hidden @kbd{//} (@code{self-insert-command})
address@hidden //
address@hidden
-Switch to the root directory.
address@hidden indentedblock
address@hidden @kbd{~} (@code{self-insert-command})
address@hidden ~
address@hidden
-Switch to the home directory.
address@hidden indentedblock
address@hidden @kbd{/} (@code{self-insert-command})
address@hidden /
address@hidden
-If the current input matches an existing directory name exactly,
-switch the completion to that directory.
address@hidden indentedblock
address@hidden @kbd{M-q} (@code{ivy-toggle-regexp-quote})
address@hidden ivy-toggle-regexp-quote
address@hidden M-q
address@hidden
-Toggle between input as regexp or not.
-
-Switch to matching literally since file names include @code{.}, which
-is for matching any char in regexp mode.
address@hidden indentedblock
address@hidden ivy-extra-directories
-Decide if you want to see @code{../} and @code{./} during file name
-completion.
-
-Reason to remove: @code{../} is the same as @kbd{DEL}.
-
-Reason not to remove: navigate anywhere with only @kbd{C-n}, @kbd{C-p}
-and @kbd{C-j}.
-
-Likewise, @code{./} can be removed.
address@hidden defopt
-
address@hidden Using TRAMP
address@hidden
-From any directory, with the empty input, inputting @code{/ssh:} and
-pressing @kbd{C-j} (or @kbd{RET}, which is the same thing) completes for
-host and user names.
-
-For @code{/ssh:user@@} input, completes the domain name.
-
address@hidden works in a similar way to the default completion.
-
-You can also get sudo access for the current directory by
-inputting @code{/sudo::} @kbd{RET}. Using @code{/sudo:} (i.e. single colon 
instead of
-double) will result in a completion session for the desired user.
address@hidden indentedblock
address@hidden History
address@hidden
-File history works the same with @kbd{M-p}, @kbd{M-n}, and @kbd{C-r}, but
-uses a custom code for file name completion that cycles through
-files previously opened. It also works with TRAMP files.
address@hidden indentedblock
-
address@hidden Buffer Name Completion
address@hidden Buffer Name Completion
-
address@hidden ivy-use-virtual-buffers
-When non-nil, add @code{recentf-mode} and bookmarks to
address@hidden completion candidates.
-
-Adding this to Emacs init file:
-
address@hidden
-     (setq ivy-use-virtual-buffers t)
address@hidden lisp
-will add additional virtual buffers to the buffers list for recent
-files. Selecting such virtual buffers, which are highlighted with
address@hidden face, will open the corresponding file.
address@hidden defopt
-
address@hidden Counsel commands
address@hidden Counsel commands
-
-The main advantages of @code{counsel-} functions over their basic
-equivalents in @code{ivy-mode} are:
-
address@hidden
address@hidden
-Multi-actions and non-exiting actions work.
address@hidden
address@hidden can resume the last completion session.
address@hidden
-Customize @code{ivy-set-actions}, @code{ivy-re-builders-alist}.
address@hidden
-Customize individual keymaps, such as @code{counsel-describe-map},
address@hidden, or @code{counsel-find-file-map}, instead of
-customizing @code{ivy-minibuffer-map} that applies to all completion
-sessions.
address@hidden enumerate
-
address@hidden API
address@hidden API
-
-The main (and only) entry point is the @code{ivy-read} function. It takes
-two required arguments and many optional arguments that can be passed
-by a key. The optional @code{:action} argument is highly recommended for
-features such as multi-actions, non-exiting actions, @code{ivy-occur} and
address@hidden
-
address@hidden
-* Required arguments for @code{ivy-read}::
-* Optional arguments for @code{ivy-read}::
-* Example - @code{counsel-describe-function}::
-* Example - @code{counsel-locate}::
address@hidden menu
-
address@hidden Required arguments for @code{ivy-read}
address@hidden Required arguments for @code{ivy-read}
-
address@hidden @code{prompt}
address@hidden
-A format string normally ending in a colon and a space.
-
address@hidden anywhere in the string is replaced by the current number of
-matching candidates. To use a literal @code{%} character, escape it as
address@hidden See also @code{ivy-count-format}.
address@hidden indentedblock
address@hidden @code{collection}
address@hidden
-Either a list of strings, a function, an alist or a hash table.
-
-If a function, then it has to be compatible with
address@hidden
address@hidden indentedblock
-
address@hidden Optional arguments for @code{ivy-read}
address@hidden Optional arguments for @code{ivy-read}
-
address@hidden @code{predicate}
address@hidden
-Is a function to filter the initial collection. It has to be
-compatible with @code{all-completions}. Tip: most of the time, it's
-simpler to just apply this filter to the @code{collection} argument
-itself, e.g. @code{(cl-remove-if-not predicate collection)}.
address@hidden indentedblock
address@hidden @code{require-match}
address@hidden
-When set to a non-nil value, input must match one of the
-candidates. Custom input is not accepted.
address@hidden indentedblock
address@hidden @code{initial-input}
address@hidden
-This string argument is included for compatibility with
address@hidden, which inserts it into the minibuffer.
-
-It's recommended to use the @code{preselect} argument instead of this.
address@hidden indentedblock
address@hidden @code{history}
address@hidden
-Name of the symbol to store history. See @code{completing-read}.
address@hidden indentedblock
address@hidden @code{preselect}
address@hidden
-When set to a string value, select the first candidate matching
-this value.
-
-When set to an integer value, select the candidate with that
-index value.
-
-Every time the input becomes empty, the item corresponding to to
address@hidden is selected.
address@hidden indentedblock
address@hidden @code{keymap}
address@hidden
-A keymap to be composed with @code{ivy-minibuffer-map}. This keymap
-has priority over @code{ivy-minibuffer-map} and can be modified at any
-later stage.
address@hidden indentedblock
address@hidden @code{update-fn}
address@hidden
-Is the function called each time the current candidate changes.
-This function takes no arguments and is called in the
-minibuffer's @code{post-command-hook}. See @code{swiper} for an example
-usage.
address@hidden indentedblock
address@hidden @code{sort}
address@hidden
-When non-nil, use @code{ivy-sort-functions-alist} to sort the
-collection as long as the collection is not larger than
address@hidden
address@hidden indentedblock
address@hidden @code{action}
address@hidden
-Is the function to call after selection. It takes a string
-argument.
address@hidden indentedblock
address@hidden @code{unwind}
address@hidden
-Is the function to call before exiting completion. It takes no
-arguments. This function is called even if the completion is
-interrupted with @kbd{C-g}. See @code{swiper} for an example usage.
address@hidden indentedblock
address@hidden @code{re-builder}
address@hidden
-Is a function that takes a string and returns a valid regex. See
address@hidden Styles} for details.
address@hidden indentedblock
address@hidden @code{matcher}
address@hidden
-Is a function that takes a regex string and a list of strings and
-returns a list of strings matching the regex. Any ordinary Emacs
-matching function will suffice, yet finely tuned matching
-functions can be used. See @code{counsel-find-file} for an example
-usage.
address@hidden indentedblock
address@hidden @code{dynamic-collection}
address@hidden
-When non-nil, @code{collection} will be used to dynamically generate
-the candidates each time the input changes, instead of being used
-once statically with @code{all-completions} to generate a list of
-strings. See @code{counsel-locate} for an example usage.
address@hidden indentedblock
address@hidden @code{caller}
address@hidden
-Is a symbol that uniquely identifies the function that called
address@hidden, which may be useful for further customizations.
address@hidden indentedblock
-
address@hidden Example - @code{counsel-describe-function}
address@hidden Example - @code{counsel-describe-function}
-
-This is a typical example of a function with a non-async collection,
-which is a collection where all the strings in the collection are
-known prior to any input from the user.
-
-Only the first two arguments (along with @code{action}) are essential - the
-rest of the arguments are for fine-tuning, and could be omitted.
-
-The @code{action} argument could also be omitted - but then @code{ivy-read}
-would do nothing except returning the string result, which you could
-later use yourself. However, it's recommended that you use the
address@hidden argument.
-
address@hidden
-(defun counsel-describe-function ()
-  "Forward to `describe-function'."
-  (interactive)
-  (ivy-read "Describe function: "
-            (let (cands)
-              (mapatoms
-               (lambda (x)
-                 (when (fboundp x)
-                   (push (symbol-name x) cands))))
-              cands)
-            :keymap counsel-describe-map
-            :preselect (counsel-symbol-at-point)
-            :history 'counsel-describe-symbol-history
-            :require-match t
-            :sort t
-            :action (lambda (x)
-                      (describe-function
-                       (intern x)))
-            :caller 'counsel-describe-function))
address@hidden lisp
-
-Here are the interesting features of the above function, in the order that 
they appear:
-
address@hidden
address@hidden
-The @code{prompt} argument is a simple string ending in ": ".
address@hidden
-The @code{collection} argument evaluates to a (large) list of strings.
address@hidden
-The @code{keymap} argument is for a custom keymap to supplement 
@code{ivy-minibuffer-map}.
address@hidden
-The @code{preselect} is provided by @code{counsel-symbol-at-point}, which
-returns a symbol near the point. Ivy then selects the first
-candidate from the collection that matches this symbol. To select
-this pre-selected candidate, a @kbd{RET} will suffice. No further user
-input is necessary.
address@hidden
-The @code{history} argument is for keeping the history of this command
-separate from the common history in @code{ivy-history}.
address@hidden
-The @code{require-match} is set to @code{t} since it doesn't make sense to
-call @code{describe-function} on an un-interned symbol.
address@hidden
-The @code{sort} argument is set to @code{t} so choosing between similar
-candidates becomes easier. Sometimes, the collection size will
-exceed @code{ivy-sort-max-size}, which is 30000 by default. In that case
-the sorting will not happen to avoid delays.
-
-Adjust this variable to choose between sorting time and completion
-start-up time.
address@hidden
-The @code{action} argument calls @code{describe-function} on the interned
-selected candidate.
address@hidden
-The @code{caller} argument identifies this completion session. This is
-important, since with the collection being a list of strings and not
-a function name, the only other way for @code{ivy-read} to identify
-"who's calling" and to apply the appropriate customizations is to
-examine @code{this-command}. But @code{this-command} would be modified if
-another command called @code{counsel-describe-function}.
address@hidden itemize
-
address@hidden Example - @code{counsel-locate}
address@hidden Example - @code{counsel-locate}
-
-This is a typical example of a function with an async collection.
-Since the collection function cannot pre-compute all the locatable
-files in memory within reasonable limits (time or memory), it relies
-on user input to filter the universe of possible candidates to a
-manageable size while also continuing to search asynchronously for
-possible candidates. Both the filtering and searching continues with
-each character change of the input with rapid updates to the
-collection presented without idle waiting times. This live update will
-continue as long as there are likely candidates. Eventually updates to
-the minibuffer will stop after user input, filtering, and searching
-have exhausted looking for possible candidates.
-
-Async collections suit long-running shell commands, such as @code{locate}.
-With each new input, a new process starts while the old process is
-killed. The collection is refreshed anew with each new process.
-Meanwhile the user can provide more input characters (for further
-narrowing) or select a candidate from the visible collection.
-
address@hidden
-(defun counsel-locate-function (str)
-  (if (< (length str) 3)
-      (counsel-more-chars 3)
-    (counsel--async-command
-     (format "locate %s '%s'"
-             (mapconcat #'identity counsel-locate-options " ")
-             (counsel-unquote-regex-parens
-              (ivy--regex str))))
-    '("" "working...")))
-
-;;;###autoload
-(defun counsel-locate (&optional initial-input)
-  "Call the \"locate\" shell command.
-INITIAL-INPUT can be given as the initial minibuffer input."
-  (interactive)
-  (ivy-read "Locate: " #'counsel-locate-function
-            :initial-input initial-input
-            :dynamic-collection t
-            :history 'counsel-locate-history
-            :action (lambda (file)
-                      (with-ivy-window
-                        (when file
-                          (find-file file))))
-            :unwind #'counsel-delete-process
-            :caller 'counsel-locate))
address@hidden lisp
-
-Here are the interesting features of the above functions, in the order
-that they appear:
-
address@hidden
address@hidden
address@hidden takes a string argument and returns a list
-of strings. Note that it's not compatible with @code{all-completions},
-but since we're not using that here, might as well use one argument
-instead of three.
address@hidden
address@hidden is a simple function that returns e.g.
address@hidden'("2 chars more")} asking the user for more input.
address@hidden
address@hidden is a very easy API simplification that
-takes a single string argument suitable for
address@hidden So you could prototype your function as
-non-async using @code{shell-command-to-string} and @code{split-string} to
-produce a collection, then decide that you want async and simply swap in
address@hidden
address@hidden
address@hidden is an interactive function with an optional @code{initial-input}.
address@hidden
address@hidden'counsel-locate-function} is passed as the @code{collection} 
argument.
address@hidden
address@hidden is set to t, since this is an async collection.
address@hidden
address@hidden argument uses @code{with-ivy-window} wrapper, since we want to 
open the
-selected file in the same window from which @code{counsel-locate} was
-called.
address@hidden
address@hidden argument is set to @code{#'counsel-delete-process}: when we 
press @kbd{C-g}
-we want to kill the running process created by
address@hidden
address@hidden
address@hidden argument identifies this command for easier customization.
address@hidden itemize
-
address@hidden Variable Index
address@hidden Variable Index
-
address@hidden vr
-
address@hidden Keystroke Index
address@hidden Keystroke Index
-
address@hidden ky
-
address@hidden
\ No newline at end of file
diff --git a/packages/ivy/ivy-hydra.el b/packages/ivy/ivy-hydra.el
deleted file mode 100644
index d4b8e5f..0000000
--- a/packages/ivy/ivy-hydra.el
+++ /dev/null
@@ -1,103 +0,0 @@
-;;; ivy-hydra.el --- Additional key bindings for Ivy  -*- lexical-binding: t 
-*-
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.9.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.9.0") (hydra "0.13.4"))
-;; Keywords: completion, matching, bindings
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; This package provides the `hydra-ivy/body' command, which is a
-;; quasi-prefix map, with many useful bindings.  These bindings are
-;; shorter than usual, using mostly unprefixed keys.
-
-;;; Code:
-(require 'ivy)
-(require 'hydra)
-
-(defun ivy--matcher-desc ()
-  (if (eq ivy--regex-function
-          'ivy--regex-fuzzy)
-      "fuzzy"
-    "ivy"))
-
-(defhydra hydra-ivy (:hint nil
-                     :color pink)
-  "
-^ ^ ^ ^ ^ ^ | ^Call^      ^ ^  | ^Cancel^ | ^Options^ | Action _w_/_s_/_a_: 
%-14s(ivy-action-name)
-^-^-^-^-^-^-+-^-^---------^-^--+-^-^------+-^-^-------+-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------
-^ ^ _k_ ^ ^ | _f_ollow occ_u_r | _i_nsert | _c_: calling %-5s(if ivy-calling 
\"on\" \"off\") _C_ase-fold: %-10`ivy-case-fold-search
-_h_ ^+^ _l_ | _d_one      ^ ^  | _o_ops   | _m_: matcher 
%-5s(ivy--matcher-desc)^^^^^^^^^^^^ _t_runcate: %-11`truncate-lines
-^ ^ _j_ ^ ^ | _g_o        ^ ^  | ^ ^      | _<_/_>_: 
shrink/grow^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _D_efinition of this menu
-"
-  ;; arrows
-  ("h" ivy-beginning-of-buffer)
-  ("j" ivy-next-line)
-  ("k" ivy-previous-line)
-  ("l" ivy-end-of-buffer)
-  ;; actions
-  ("o" keyboard-escape-quit :exit t)
-  ("C-g" keyboard-escape-quit :exit t)
-  ("i" nil)
-  ("C-o" nil)
-  ("f" ivy-alt-done :exit nil)
-  ("C-j" ivy-alt-done :exit nil)
-  ("d" ivy-done :exit t)
-  ("g" ivy-call)
-  ("C-m" ivy-done :exit t)
-  ("c" ivy-toggle-calling)
-  ("m" ivy-toggle-fuzzy)
-  (">" ivy-minibuffer-grow)
-  ("<" ivy-minibuffer-shrink)
-  ("w" ivy-prev-action)
-  ("s" ivy-next-action)
-  ("a" ivy-read-action)
-  ("t" (setq truncate-lines (not truncate-lines)))
-  ("C" ivy-toggle-case-fold)
-  ("u" ivy-occur :exit t)
-  ("D" (ivy-exit-with-action
-        (lambda (_) (find-function 'hydra-ivy/body)))
-       :exit t))
-
-(defun ivy-dispatching-done-hydra ()
-  "Select one of the available actions and call `ivy-done'."
-  (interactive)
-  (let ((actions (ivy-state-action ivy-last)))
-    (if (null (ivy--actionp actions))
-        (ivy-done)
-      (funcall
-       (eval
-        `(defhydra ivy-read-action (:color teal)
-           "action"
-           ,@(mapcar (lambda (x)
-                       (list (nth 0 x)
-                             `(progn
-                                (ivy-set-action ',(nth 1 x))
-                                (ivy-done))
-                             (nth 2 x)))
-                     (cdr actions))
-           ("M-o" nil "back")))))))
-
-(define-key ivy-minibuffer-map (kbd "M-o") 'ivy-dispatching-done-hydra)
-
-(provide 'ivy-hydra)
-
-;;; ivy-hydra.el ends here
diff --git a/packages/ivy/ivy-overlay.el b/packages/ivy/ivy-overlay.el
deleted file mode 100644
index 78344c7..0000000
--- a/packages/ivy/ivy-overlay.el
+++ /dev/null
@@ -1,114 +0,0 @@
-;;; ivy-overlay.el --- Overlay display functions for Ivy  -*- lexical-binding: 
t -*-
-
-;; Copyright (C) 2016-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-;; Keywords: convenience
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; This package allows to setup Ivy's completion at point to actually
-;; show the candidates and the input at point, instead of in the
-;; minibuffer.
-
-;;; Code:
-(defface ivy-cursor
-  '((t (:background "black"
-        :foreground "white")))
-  "Cursor face for inline completion."
-  :group 'ivy-faces)
-
-(defvar ivy--old-cursor-type t)
-
-(defvar ivy-overlay-at nil
-  "Overlay variable for `ivy-display-function-overlay'.")
-
-(defun ivy-left-pad (str width)
-  "Pad STR from left with WIDTH spaces."
-  (let ((padding (make-string width ?\ )))
-    (mapconcat (lambda (x)
-                 (setq x (concat padding x))
-                 (if (> (length x) (window-width))
-                     (concat
-                      (substring x 0 (- (window-width) 4))
-                      "...")
-                   x))
-               (split-string str "\n")
-               "\n")))
-
-(declare-function company-abort "ext:company")
-
-(defun ivy-overlay-cleanup ()
-  "Clean up after `ivy-display-function-overlay'."
-  (when (overlayp ivy-overlay-at)
-    (delete-overlay ivy-overlay-at)
-    (setq ivy-overlay-at nil))
-  (unless cursor-type
-    (setq cursor-type ivy--old-cursor-type))
-  (when (fboundp 'company-abort)
-    (company-abort)))
-
-(defun ivy-overlay-show-after (str)
-  "Display STR in an overlay at point.
-
-First, fill each line of STR with spaces to the current column.
-Then attach the overlay the character before point."
-  (if ivy-overlay-at
-      (progn
-        (move-overlay ivy-overlay-at (1- (point)) (line-end-position))
-        (overlay-put ivy-overlay-at 'invisible nil))
-    (setq ivy-overlay-at (make-overlay (1- (point)) (line-end-position)))
-    (overlay-put ivy-overlay-at 'priority 9999))
-  (overlay-put ivy-overlay-at 'display str)
-  (overlay-put ivy-overlay-at 'after-string ""))
-
-(declare-function org-current-level "org")
-(defvar org-indent-indentation-per-level)
-
-(defun ivy-display-function-overlay (str)
-  "Called from the minibuffer, display STR in an overlay in Ivy window.
-Hide the minibuffer contents and cursor."
-  (add-face-text-property (minibuffer-prompt-end) (point-max)
-                          '(:foreground "white"))
-  (let ((cursor-pos (1+ (- (point) (minibuffer-prompt-end))))
-        (ivy-window (ivy--get-window ivy-last)))
-    (setq cursor-type nil)
-    (with-selected-window ivy-window
-      (when cursor-type
-        (setq ivy--old-cursor-type cursor-type))
-      (setq cursor-type nil)
-      (let ((overlay-str
-             (concat
-              (buffer-substring (max 1 (1- (point))) (point))
-              ivy-text
-              (if (eolp)
-                  " "
-                "")
-              (buffer-substring (point) (line-end-position))
-              (ivy-left-pad
-               str
-               (+ (if (eq major-mode 'org-mode)
-                      (* org-indent-indentation-per-level (org-current-level))
-                    0)
-                  (save-excursion
-                    (goto-char ivy-completion-beg)
-                    (current-column)))))))
-        (add-face-text-property cursor-pos (1+ cursor-pos)
-                                'ivy-cursor t overlay-str)
-        (ivy-overlay-show-after overlay-str)))))
-
-(provide 'ivy-overlay)
-;;; ivy-overlay.el ends here
diff --git a/packages/ivy/ivy-test.el b/packages/ivy/ivy-test.el
deleted file mode 100644
index 8961ae4..0000000
--- a/packages/ivy/ivy-test.el
+++ /dev/null
@@ -1,429 +0,0 @@
-;;; ivy-test.el --- tests for ivy
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-(require 'ert)
-
-;; useful for #'ivy-read-remap. It must arrive before (require 'ivy)
-(define-key global-map (kbd "<S-right>") #'end-of-buffer)
-
-(require 'ivy)
-(require 'counsel)
-
-(defvar ivy-expr nil
-  "Holds a test expression to evaluate with `ivy-eval'.")
-
-(defvar ivy-result nil
-  "Holds the eval result of `ivy-expr' by `ivy-eval'.")
-
-(defun ivy-eval ()
-  "Evaluate `ivy-expr'."
-  (interactive)
-  (setq ivy-result (eval ivy-expr)))
-
-(global-set-key (kbd "C-c e") 'ivy-eval)
-
-(defun ivy-with (expr keys)
-  "Evaluate EXPR followed by KEYS."
-  (let ((ivy-expr expr))
-    (execute-kbd-macro
-     (vconcat (kbd "C-c e")
-              (kbd keys)))
-    ivy-result))
-
-(ert-deftest ivy-read ()
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
-                     "C-m")
-           "blue"))
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
-                     "y C-m")
-           "yellow"))
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
-                     "y DEL b C-m")
-           "blue"))
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
-                     "z C-m")
-           "z"))
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
-                     "y <backspace> C-m")
-           "blue"))
-  (should (equal
-           (ivy-with '(let ((ivy-re-builders-alist '((t . ivy--regex-fuzzy))))
-                       (ivy-read "pattern: " '("package-list-packages" 
"something-else")))
-                     "plp C-m")
-           "package-list-packages"))
-  (should (equal
-           (ivy-with '(ivy-read "test" '("aaab" "aaac"))
-                     "a C-n <tab> C-m")
-           "aaac"))
-  (should (equal
-           (ivy-with '(ivy-read "test" '(("foo" . "bar")))
-                     "asdf C-m")
-           "asdf"))
-  (should (equal
-           (ivy-with
-            '(with-output-to-string
-              (ivy-read "test" '(("foo" . "bar"))
-               :action (lambda (x) (prin1 x))))
-            "f C-m")
-           "(#(\"foo\" 0 1 (idx 0)) . \"bar\")"))
-  (should (equal
-           (ivy-with
-            '(with-output-to-string
-              (ivy-read "test" '(("foo" . "bar"))
-               :action (lambda (x) (prin1 x))))
-            "asdf C-m")
-           "\"asdf\""))
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("can do" "can" "can't do"))
-                     "can C-m")
-           "can")))
-
-(ert-deftest ivy-read-remap ()
-  (should (equal
-           (ivy-with '(ivy-read "pattern: " '("blue" "yellow" "red"))
-                  "<S-right> C-m")
-           "red")))
-
-(ert-deftest swiper--re-builder ()
-  (setq swiper--width 4)
-  (should (string= (swiper--re-builder "^")
-                   "."))
-  (should (string= (swiper--re-builder "^a")
-                   "^ ?\\(a\\)"))
-  (should (string= (swiper--re-builder "^a b")
-                   "^ \\(a\\).*?\\(b\\)")))
-
-(ert-deftest ivy--split ()
-  (should (equal (ivy--split "King of the who?")
-                 '("King" "of" "the" "who?")))
-  (should (equal (ivy--split "The  Brittons.")
-                 '("The Brittons.")))
-  (should (equal (ivy--split "Who  are the  Brittons?")
-                 '("Who are" "the Brittons?")))
-  (should (equal (ivy--split "We're  all  Britons and   I   am your   king.")
-                 '("We're all Britons"
-                   "and  I  am"
-                   "your  king.")))
-  (should (equal (ivy--split "^[^ ]") '("^[^ ]")))
-  (should (equal (ivy--split "^[^ ] bar") '("^[^ ]" "bar"))))
-
-(ert-deftest ivy--regex ()
-  (should (equal (ivy--regex
-                  "\\(?:interactive\\|swiper\\) \\(?:list\\|symbol\\)")
-                 
"\\(\\(?:interactive\\|swiper\\)\\).*?\\(\\(?:list\\|symbol\\)\\)")))
-
-(ert-deftest ivy--regex-fuzzy ()
-  (should (string= (ivy--regex-fuzzy "tmux")
-                   "\\(t\\).*?\\(m\\).*?\\(u\\).*?\\(x\\)"))
-  (should (string= (ivy--regex-fuzzy "^tmux")
-                   "^\\(t\\).*?\\(m\\).*?\\(u\\).*?\\(x\\)"))
-  (should (string= (ivy--regex-fuzzy "^tmux$")
-                   "^\\(t\\).*?\\(m\\).*?\\(u\\).*?\\(x\\)$"))
-  (should (string= (ivy--regex-fuzzy "")
-                   ""))
-  (should (string= (ivy--regex-fuzzy "^")
-                   "^"))
-  (should (string= (ivy--regex-fuzzy "$")
-                   "$")))
-
-(ert-deftest ivy--regex-ignore-order ()
-  (should (equal (ivy--regex-ignore-order "tmux")
-                 '(("tmux" . t))))
-  (should (equal (ivy--regex-ignore-order "^tmux")
-                 '(("^tmux" . t))))
-  (should (equal (ivy--regex-ignore-order "^tmux$")
-                 '(("^tmux$" . t))))
-  (should (equal (ivy--regex-ignore-order "")
-                 ""))
-  (should (equal (ivy--regex-ignore-order "^")
-                 '(("^" . t))))
-  (should (equal (ivy--regex-ignore-order "$")
-                 '(("$" . t))))
-  (should (equal (ivy--regex-ignore-order "one two")
-                 '(("one" . t) ("two" . t))))
-  (should (equal (ivy--regex-ignore-order "one two !three")
-                 '(("one" . t) ("two" . t) ("three"))))
-  (should (equal (ivy--regex-ignore-order "one two !three four")
-                 '(("one" . t) ("two" . t) ("three") ("four"))))
-  (should (equal (ivy--regex-ignore-order "!three four")
-                 '(("" . t) (("three") ("four")))))
-  (should (equal (ivy--regex-ignore-order "foo[ bar[xy]")
-                 '(("foo\\[" . t) ("bar[xy]" . t)))))
-
-(ert-deftest ivy--format ()
-  (should (string= (let ((ivy--index 10)
-                         (ivy-format-function (lambda (x) (mapconcat 
#'identity x "\n")))
-                         (cands '("NAME"
-                                  "SYNOPSIS"
-                                  "DESCRIPTION"
-                                  "FUNCTION LETTERS"
-                                  "SWITCHES"
-                                  "DIAGNOSTICS"
-                                  "EXAMPLE 1"
-                                  "EXAMPLE 2"
-                                  "EXAMPLE 3"
-                                  "SEE ALSO"
-                                  "AUTHOR")))
-                     (ivy--format cands))
-                   #("\nDESCRIPTION\nFUNCTION 
LETTERS\nSWITCHES\nDIAGNOSTICS\nEXAMPLE 1\nEXAMPLE 2\nEXAMPLE 3\nSEE 
ALSO\nAUTHOR"
-                     0 90 (read-only nil)
-                     90 96 (face ivy-current-match read-only nil)))))
-
-(ert-deftest ivy--filter ()
-  (setq ivy-last (make-ivy-state))
-  (should (equal (ivy--filter "the" '("foo" "the" "The"))
-                 '("the" "The")))
-  (should (equal (ivy--filter "The" '("foo" "the" "The"))
-                 '("The"))))
-
-(ert-deftest counsel-unquote-regex-parens ()
-  (should (equal (counsel-unquote-regex-parens
-                  (ivy--regex "foo bar"))
-                 "(foo).*?(bar)"))
-  (should (equal (counsel-unquote-regex-parens
-                  (ivy--regex "(foo bar"))
-                 "(\\(foo).*?(bar)")))
-
-(ert-deftest colir-color-parse ()
-  (should (equal (colir-color-parse "#ab1234")
-                 ;; (color-name-to-rgb "#ab1234")
-                 '(0.6705882352941176
-                   0.07058823529411765
-                   0.20392156862745098))))
-
-
-;;* prefix arg tests
-;;** tests with no prefix
-(ert-deftest ivy-no-prefix-arg ()
-  "Tests with no prefix arg."
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-m")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-j")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-M-j")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-M-m")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-M-n")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-M-p")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "M-o o")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "TAB TAB")
-           nil)))
-
-;;** tests with one prefix
-(ert-deftest ivy-one-prefix-arg ()
-  "Tests with no prefix arg."
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-m")
-           '(4)))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-j")
-           '(4)))
-  ;; C-M-j does not pass a prefix on.
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-M-j")
-           nil))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-M-m")
-           '(4)))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-M-n")
-           '(4)))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u C-M-p")
-           '(4)))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "C-u M-o o")
-           '(4)))
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action
-               '(1 ("o" (lambda (x)
-                          (setq res ivy-current-prefix-arg)))
-                 ("p" (lambda (x)
-                        (setq res ivy-current-prefix-arg)))))
-              res)
-            "C-u M-o p")
-           '(4)))
-  ;; TAB TAB does not pass prefix arg
-  (should (equal
-           (ivy-with
-            '(let (res)
-              (ivy-read "pattern: " '("blue" "yellow")
-               :action (lambda (x)
-                         (setq res ivy-current-prefix-arg)))
-              res)
-            "TAB TAB")
-           nil)))
-
-
-(ert-deftest ivy-numeric-prefix-arg ()
-  (should (equal
-           (ivy-with
-            '(let (res)
-               (ivy-read "pattern: " '("blue" "yellow")
-                         :action (lambda (x)
-                                   (setq res ivy-current-prefix-arg)))
-               res)
-            "M-1 M-2 M-3 C-m")
-           123))
-  (should (equal
-           (ivy-with
-            '(let (res)
-               (ivy-read "pattern: " '("blue" "yellow")
-                         :action (lambda (x)
-                                   (setq res ivy-current-prefix-arg)))
-               res)
-            "C-u 123 C-m")
-           123)))
-
-(ert-deftest ivy-re-match ()
-  (should (ivy-re-match '(("counsel" . t)) "(defun counsel"))
-  (should (ivy-re-match '(("defun" . t) ("counsel" . t)) "(defun counsel"))
-  (should (ivy-re-match '(("counsel" . t) ("defun" . t)) "(defun counsel"))
-  (should (not (ivy-re-match '(("counsel" . nil) ("defun" . t)) "(defun 
counsel")))
-  (should (not (ivy-re-match '(("defun" . t) ("counsel" . nil)) "(defun 
counsel"))))
-
-(ert-deftest ivy-read-preselect ()
-  (should (equal
-           (ivy-with
-            '(ivy-read "test: "
-              (list "abc" "default" "def")
-              :preselect 1)
-            "RET")
-           "default"))
-  (should (equal
-           (ivy-with
-            '(ivy-read "test: "
-              (list "abc" "default" "def")
-              :preselect "defa")
-            "RET")
-           "default")))
-
-(provide 'ivy-test)
diff --git a/packages/ivy/ivy.el b/packages/ivy/ivy.el
deleted file mode 100644
index d4b1e65..0000000
--- a/packages/ivy/ivy.el
+++ /dev/null
@@ -1,3705 +0,0 @@
-;;; ivy.el --- Incremental Vertical completYon -*- lexical-binding: t -*-
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.9.0
-;; Package-Requires: ((emacs "24.1"))
-;; Keywords: matching
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; This package provides `ivy-read' as an alternative to
-;; `completing-read' and similar functions.
-;;
-;; There's no intricate code to determine the best candidate.
-;; Instead, the user can navigate to it with `ivy-next-line' and
-;; `ivy-previous-line'.
-;;
-;; The matching is done by splitting the input text by spaces and
-;; re-building it into a regex.
-;; So "for example" is transformed into "\\(for\\).*\\(example\\)".
-
-;;; Code:
-(require 'cl-lib)
-(require 'ffap)
-(require 'ivy-overlay)
-
-;;* Customization
-(defgroup ivy nil
-  "Incremental vertical completion."
-  :group 'convenience)
-
-(defgroup ivy-faces nil
-  "Font-lock faces for `ivy'."
-  :group 'ivy
-  :group 'faces)
-
-(defface ivy-current-match
-  '((((class color) (background light))
-     :background "#1a4b77" :foreground "white")
-    (((class color) (background dark))
-     :background "#65a7e2" :foreground "black"))
-  "Face used by Ivy for highlighting the current match.")
-
-(defface ivy-minibuffer-match-face-1
-  '((((class color) (background light))
-     :background "#d3d3d3")
-    (((class color) (background dark))
-     :background "#555555"))
-  "The background face for `ivy' minibuffer matches.")
-
-(defface ivy-minibuffer-match-face-2
-  '((((class color) (background light))
-     :background "#e99ce8" :weight bold)
-    (((class color) (background dark))
-     :background "#777777" :weight bold))
-  "Face for `ivy' minibuffer matches numbered 1 modulo 3.")
-
-(defface ivy-minibuffer-match-face-3
-  '((((class color) (background light))
-     :background "#bbbbff" :weight bold)
-    (((class color) (background dark))
-     :background "#7777ff" :weight bold))
-  "Face for `ivy' minibuffer matches numbered 2 modulo 3.")
-
-(defface ivy-minibuffer-match-face-4
-  '((((class color) (background light))
-     :background "#ffbbff" :weight bold)
-    (((class color) (background dark))
-     :background "#8a498a" :weight bold))
-  "Face for `ivy' minibuffer matches numbered 3 modulo 3.")
-
-(defface ivy-confirm-face
-  '((t :foreground "ForestGreen" :inherit minibuffer-prompt))
-  "Face used by Ivy for a confirmation prompt.")
-
-(defface ivy-match-required-face
-  '((t :foreground "red" :inherit minibuffer-prompt))
-  "Face used by Ivy for a match required prompt.")
-
-(defface ivy-subdir
-  '((t :inherit dired-directory))
-  "Face used by Ivy for highlighting subdirs in the alternatives.")
-
-(defface ivy-modified-buffer
-  '((t :inherit default))
-  "Face used by Ivy for highlighting modified file visiting buffers.")
-
-(defface ivy-remote
-  '((((class color) (background light))
-     :foreground "#110099")
-    (((class color) (background dark))
-     :foreground "#7B6BFF"))
-  "Face used by Ivy for highlighting remotes in the alternatives.")
-
-(defface ivy-virtual
-  '((t :inherit font-lock-builtin-face))
-  "Face used by Ivy for matching virtual buffer names.")
-
-(defface ivy-action
-  '((t :inherit font-lock-builtin-face))
-  "Face used by Ivy for displaying keys in `ivy-read-action'.")
-
-(setcdr (assoc load-file-name custom-current-group-alist) 'ivy)
-
-(defcustom ivy-height 10
-  "Number of lines for the minibuffer window."
-  :type 'integer)
-
-(defcustom ivy-count-format "%-4d "
-  "The style to use for displaying the current candidate count for `ivy-read'.
-Set this to \"\" to suppress the count visibility.
-Set this to \"(%d/%d) \" to display both the index and the count."
-  :type '(choice
-          (const :tag "Count disabled" "")
-          (const :tag "Count matches" "%-4d ")
-          (const :tag "Count matches and show current match" "(%d/%d) ")
-          string))
-
-(defcustom ivy-add-newline-after-prompt nil
-  "When non-nil, add a newline after the `ivy-read' prompt."
-  :type 'boolean)
-
-(defcustom ivy-wrap nil
-  "When non-nil, wrap around after the first and the last candidate."
-  :type 'boolean)
-
-(defcustom ivy-display-style (unless (version< emacs-version "24.5") 'fancy)
-  "The style for formatting the minibuffer.
-
-By default, the matched strings are copied as is.
-
-The fancy display style highlights matching parts of the regexp,
-a behavior similar to `swiper'.
-
-This setting depends on `add-face-text-property' - a C function
-available as of Emacs 24.5. Fancy style will render poorly in
-earlier versions of Emacs."
-  :type '(choice
-          (const :tag "Plain" nil)
-          (const :tag "Fancy" fancy)))
-
-(defcustom ivy-on-del-error-function 'minibuffer-keyboard-quit
-  "The handler for when `ivy-backward-delete-char' throws.
-Usually a quick exit out of the minibuffer."
-  :type 'function)
-
-(defcustom ivy-extra-directories '("../" "./")
-  "Add this to the front of the list when completing file names.
-Only \"./\" and \"../\" apply here. They appear in reverse order."
-  :type '(repeat :tag "Dirs"
-          (choice
-           (const :tag "Parent Directory" "../")
-           (const :tag "Current Directory" "./"))))
-
-(defcustom ivy-use-virtual-buffers nil
-  "When non-nil, add `recentf-mode' and bookmarks to `ivy-switch-buffer'."
-  :type 'boolean)
-
-(defcustom ivy-display-function nil
-  "Decide where to display the candidates.
-This function takes a string with the current matching candidates
-and has to display it somewhere.
-See https://github.com/abo-abo/swiper/wiki/ivy-display-function.";
-  :type '(choice
-          (const :tag "Minibuffer" nil)
-          (const :tag "LV" ivy-display-function-lv)
-          (const :tag "Popup" ivy-display-function-popup)
-          (const :tag "Overlay" ivy-display-function-overlay)))
-
-(defvar ivy-display-functions-alist
-  '((ivy-completion-in-region . ivy-display-function-overlay))
-  "An alist for customizing `ivy-display-function'.")
-
-(defcustom ivy-completing-read-handlers-alist
-  '((tmm-menubar . completing-read-default)
-    (tmm-shortcut . completing-read-default))
-  "An alist of handlers to replace `completing-read' in `ivy-mode'."
-  :type '(alist :key-type function :value-type function))
-
-(defvar ivy--actions-list nil
-  "A list of extra actions per command.")
-
-(defun ivy-set-actions (cmd actions)
-  "Set CMD extra exit points to ACTIONS."
-  (setq ivy--actions-list
-        (plist-put ivy--actions-list cmd actions)))
-
-(defun ivy-add-actions (cmd actions)
-  "Add CMD extra exit points to ACTIONS."
-  (setq ivy--actions-list
-        (plist-put ivy--actions-list cmd
-                   (delete-dups
-                    (append
-                     actions
-                     (plist-get ivy--actions-list cmd))))))
-
-(defvar ivy--prompts-list nil)
-
-(defun ivy-set-prompt (caller prompt-fn)
-  "Associate CALLER with PROMPT-FN.
-PROMPT-FN is a function of no arguments that returns a prompt string."
-  (setq ivy--prompts-list
-        (plist-put ivy--prompts-list caller prompt-fn)))
-
-(defvar ivy--display-transformers-list nil
-  "A list of str->str transformers per command.")
-
-(defun ivy-set-display-transformer (cmd transformer)
-  "Set CMD a displayed candidate TRANSFORMER.
-
-It's a lambda that takes a string one of the candidates in the
-collection and returns a string for display, the same candidate
-plus some extra information.
-
-This lambda is called only on the `ivy-height' candidates that
-are about to be displayed, not on the whole collection."
-  (setq ivy--display-transformers-list
-        (plist-put ivy--display-transformers-list cmd transformer)))
-
-(defvar ivy--sources-list nil
-  "A list of extra sources per command.")
-
-(defun ivy-set-sources (cmd sources)
-  "Attach to CMD a list of extra SOURCES.
-
-Each static source is a function that takes no argument and
-returns a list of strings.
-
-The (original-source) determines the position of the original
-dynamic source.
-
-Extra dynamic sources aren't supported yet.
-
-Example:
-
-    (defun small-recentf ()
-      (cl-subseq recentf-list 0 20))
-
-    (ivy-set-sources
-     'counsel-locate
-     '((small-recentf)
-       (original-source)))"
-  (setq ivy--sources-list
-        (plist-put ivy--sources-list cmd sources)))
-
-(defvar ivy-current-prefix-arg nil
-  "Prefix arg to pass to actions.
-This is a global variable that is set by ivy functions for use in
-action functions.")
-
-;;* Keymap
-(require 'delsel)
-(defvar ivy-minibuffer-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-m") 'ivy-done)
-    (define-key map (kbd "C-M-m") 'ivy-call)
-    (define-key map (kbd "C-j") 'ivy-alt-done)
-    (define-key map (kbd "C-M-j") 'ivy-immediate-done)
-    (define-key map (kbd "TAB") 'ivy-partial-or-done)
-    (define-key map [remap next-line] 'ivy-next-line)
-    (define-key map [remap previous-line] 'ivy-previous-line)
-    (define-key map (kbd "C-s") 'ivy-next-line-or-history)
-    (define-key map (kbd "C-r") 'ivy-reverse-i-search)
-    (define-key map (kbd "SPC") 'self-insert-command)
-    (define-key map [remap delete-backward-char] 'ivy-backward-delete-char)
-    (define-key map [remap backward-delete-char-untabify] 
'ivy-backward-delete-char)
-    (define-key map [remap backward-kill-word] 'ivy-backward-kill-word)
-    (define-key map [remap delete-char] 'ivy-delete-char)
-    (define-key map [remap forward-char] 'ivy-forward-char)
-    (define-key map [remap kill-word] 'ivy-kill-word)
-    (define-key map [remap beginning-of-buffer] 'ivy-beginning-of-buffer)
-    (define-key map [remap end-of-buffer] 'ivy-end-of-buffer)
-    (define-key map (kbd "M-n") 'ivy-next-history-element)
-    (define-key map (kbd "M-p") 'ivy-previous-history-element)
-    (define-key map (kbd "C-g") 'minibuffer-keyboard-quit)
-    (define-key map [remap scroll-up-command] 'ivy-scroll-up-command)
-    (define-key map [remap scroll-down-command] 'ivy-scroll-down-command)
-    (define-key map (kbd "C-v") 'ivy-scroll-up-command)
-    (define-key map (kbd "M-v") 'ivy-scroll-down-command)
-    (define-key map (kbd "C-M-n") 'ivy-next-line-and-call)
-    (define-key map (kbd "C-M-p") 'ivy-previous-line-and-call)
-    (define-key map (kbd "M-r") 'ivy-toggle-regexp-quote)
-    (define-key map (kbd "M-j") 'ivy-yank-word)
-    (define-key map (kbd "M-i") 'ivy-insert-current)
-    (define-key map (kbd "C-o") 'hydra-ivy/body)
-    (define-key map (kbd "M-o") 'ivy-dispatching-done)
-    (define-key map (kbd "C-M-o") 'ivy-dispatching-call)
-    (define-key map [remap kill-line] 'ivy-kill-line)
-    (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
-    (define-key map [remap kill-ring-save] 'ivy-kill-ring-save)
-    (define-key map (kbd "C-'") 'ivy-avy)
-    (define-key map (kbd "C-M-a") 'ivy-read-action)
-    (define-key map (kbd "C-c C-o") 'ivy-occur)
-    (define-key map (kbd "C-c C-a") 'ivy-toggle-ignore)
-    (define-key map (kbd "C-c C-s") 'ivy-rotate-sort)
-    (define-key map [remap describe-mode] 'ivy-help)
-    map)
-  "Keymap used in the minibuffer.")
-(autoload 'hydra-ivy/body "ivy-hydra" "" t)
-
-(defvar ivy-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [remap switch-to-buffer]
-      'ivy-switch-buffer)
-    (define-key map [remap switch-to-buffer-other-window]
-      'ivy-switch-buffer-other-window)
-    map)
-  "Keymap for `ivy-mode'.")
-
-;;* Globals
-(cl-defstruct ivy-state
-  prompt collection
-  predicate require-match initial-input
-  history preselect keymap update-fn sort
-  ;; The frame in which `ivy-read' was called
-  frame
-  ;; The window in which `ivy-read' was called
-  window
-  ;; The buffer in which `ivy-read' was called
-  buffer
-  ;; The value of `ivy-text' to be used by `ivy-occur'
-  text
-  action
-  unwind
-  re-builder
-  matcher
-  ;; When this is non-nil, call it for each input change to get new candidates
-  dynamic-collection
-  ;; A lambda that transforms candidates only for display
-  display-transformer-fn
-  directory
-  caller
-  current)
-
-(defvar ivy-last (make-ivy-state)
-  "The last parameters passed to `ivy-read'.
-
-This should eventually become a stack so that you could use
-`ivy-read' recursively.")
-
-(defvar ivy-recursive-last nil)
-
-(defvar ivy-recursive-restore t
-  "When non-nil, restore the above state when exiting the minibuffer.
-This variable is let-bound to nil by functions that take care of
-the restoring themselves.")
-
-(defsubst ivy-set-action (action)
-  "Set the current `ivy-last' field to ACTION."
-  (setf (ivy-state-action ivy-last) action))
-
-(defun ivy-thing-at-point ()
-  "Return a string that corresponds to the current thing at point."
-  (or
-   (thing-at-point 'url)
-   (and (eq (ivy-state-collection ivy-last) 'read-file-name-internal)
-        (ffap-file-at-point))
-   (let (s)
-     (cond ((stringp (setq s (thing-at-point 'symbol)))
-            (if (string-match "\\`[`']?\\(.*?\\)'?\\'" s)
-                (match-string 1 s)
-              s))
-           ((looking-at "(+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")
-            (match-string-no-properties 1))
-           (t
-            "")))))
-
-(defvar ivy-history nil
-  "History list of candidates entered in the minibuffer.
-
-Maximum length of the history list is determined by the value
-of `history-length'.")
-
-(defvar ivy--directory nil
-  "Current directory when completing file names.")
-
-(defvar ivy--length 0
-  "Store the amount of viable candidates.")
-
-(defvar ivy-text ""
-  "Store the user's string as it is typed in.")
-
-(defvar ivy--index 0
-  "Store the index of the current candidate.")
-
-(defvar ivy-exit nil
-  "Store `done' if the completion was successfully selected.
-Otherwise, store nil.")
-
-(defvar ivy--all-candidates nil
-  "Store the candidates passed to `ivy-read'.")
-
-(defvar ivy--extra-candidates '((original-source))
-  "Store candidates added by the extra sources.
-
-This is an internal-use alist.  Each key is a function name, or
-original-source (which represents where the current dynamic
-candidates should go).
-
-Each value is an evaluation of the function, in case of static
-sources.  These values will subsequently be filtered on `ivy-text'.
-
-This variable is set by `ivy-read' and used by `ivy--set-candidates'.")
-
-(defcustom ivy-use-ignore-default t
-  "The default policy for user-configured candidate filtering."
-  :type '(choice
-          (const :tag "Ignore ignored always" always)
-          (const :tag "Ignore ignored when others exist" t)
-          (const :tag "Don't ignore" nil)))
-
-(defvar ivy-use-ignore t
-  "Store policy for user-configured candidate filtering.
-This may be changed dynamically by `ivy-toggle-ignore'.
-Use `ivy-use-ignore-default' for a permanent configuration.")
-
-(defvar ivy--default nil
-  "Default initial input.")
-
-(defvar ivy--prompt nil
-  "Store the format-style prompt.
-When non-nil, it should contain at least one %d.")
-
-(defvar ivy--prompt-extra ""
-  "Temporary modifications to the prompt.")
-
-(defvar ivy--old-re nil
-  "Store the old regexp.")
-
-(defvar ivy--old-cands nil
-  "Store the candidates matched by `ivy--old-re'.")
-
-(defvar ivy--regex-function 'ivy--regex
-  "Current function for building a regex.")
-
-(defvar ivy--highlight-function 'ivy--highlight-default
-  "Current function for formatting the candidates.")
-
-(defvar ivy--subexps 0
-  "Number of groups in the current `ivy--regex'.")
-
-(defvar ivy--full-length nil
-  "The total amount of candidates when :dynamic-collection is non-nil.")
-
-(defvar ivy--old-text ""
-  "Store old `ivy-text' for dynamic completion.")
-
-(defcustom ivy-case-fold-search-default 'auto
-  "The default value for `ivy-case-fold-search'."
-  :type '(choice
-          (const :tag "Auto" auto)
-          (const :tag "Always" always)
-          (const :tag "Never" nil)))
-
-(defvar ivy-case-fold-search ivy-case-fold-search-default
-  "Store the current overriding `case-fold-search'.")
-
-(defvar Info-current-file)
-
-(eval-and-compile
-  (unless (fboundp 'defvar-local)
-    (defmacro defvar-local (var val &optional docstring)
-      "Define VAR as a buffer-local variable with default value VAL."
-      (declare (debug defvar) (doc-string 3))
-      (list 'progn (list 'defvar var val docstring)
-            (list 'make-variable-buffer-local (list 'quote var)))))
-  (unless (fboundp 'setq-local)
-    (defmacro setq-local (var val)
-      "Set variable VAR to value VAL in current buffer."
-      (list 'set (list 'make-local-variable (list 'quote var)) val))))
-
-(defmacro ivy-quit-and-run (&rest body)
-  "Quit the minibuffer and run BODY afterwards."
-  `(progn
-     (put 'quit 'error-message "")
-     (run-at-time nil nil
-                  (lambda ()
-                    (put 'quit 'error-message "Quit")
-                    ,@body))
-     (minibuffer-keyboard-quit)))
-
-(defun ivy-exit-with-action (action)
-  "Quit the minibuffer and call ACTION afterwards."
-  (ivy-set-action
-   `(lambda (x)
-      (funcall ',action x)
-      (ivy-set-action ',(ivy-state-action ivy-last))))
-  (setq ivy-exit 'done)
-  (exit-minibuffer))
-
-(defmacro with-ivy-window (&rest body)
-  "Execute BODY in the window from which `ivy-read' was called."
-  (declare (indent 0)
-           (debug t))
-  `(with-selected-window (ivy--get-window ivy-last)
-     ,@body))
-
-(defun ivy--done (text)
-  "Insert TEXT and exit minibuffer."
-  (insert
-   (setf (ivy-state-current ivy-last)
-         (if (and ivy--directory
-                  (not (eq (ivy-state-history ivy-last) 'grep-files-history)))
-             (expand-file-name text ivy--directory)
-           text)))
-  (setq ivy-exit 'done)
-  (exit-minibuffer))
-
-;;* Commands
-(defun ivy-done ()
-  "Exit the minibuffer with the selected candidate."
-  (interactive)
-  (setq ivy-current-prefix-arg current-prefix-arg)
-  (delete-minibuffer-contents)
-  (cond ((or (> ivy--length 0)
-             ;; the action from `ivy-dispatching-done' may not need a
-             ;; candidate at all
-             (eq this-command 'ivy-dispatching-done))
-         (ivy--done (ivy-state-current ivy-last)))
-        ((memq (ivy-state-collection ivy-last)
-               '(read-file-name-internal internal-complete-buffer))
-         (if (or (not (eq confirm-nonexistent-file-or-buffer t))
-                 (equal " (confirm)" ivy--prompt-extra))
-             (ivy--done ivy-text)
-           (setq ivy--prompt-extra " (confirm)")
-           (insert ivy-text)
-           (ivy--exhibit)))
-        ((memq (ivy-state-require-match ivy-last)
-               '(nil confirm confirm-after-completion))
-         (ivy--done ivy-text))
-        (t
-         (setq ivy--prompt-extra " (match required)")
-         (insert ivy-text)
-         (ivy--exhibit))))
-
-(defvar ivy-read-action-format-function 'ivy-read-action-format-default
-  "Function used to transform the actions list into a docstring.")
-
-(defun ivy-read-action-format-default (actions)
-  "Create a docstring from ACTIONS.
-
-ACTIONS is a list.  Each list item is a list of 3 items:
-key (a string), cmd and doc (a string)."
-  (format "%s\n%s\n"
-          (if (eq this-command 'ivy-read-action)
-              "Select action: "
-            (ivy-state-current ivy-last))
-          (mapconcat
-           (lambda (x)
-             (format "%s: %s"
-                     (propertize
-                      (car x)
-                      'face 'ivy-action)
-                     (nth 2 x)))
-           actions
-           "\n")))
-
-(defun ivy-read-action ()
-  "Change the action to one of the available ones.
-
-Return nil for `minibuffer-keyboard-quit' or wrong key during the
-selection, non-nil otherwise."
-  (interactive)
-  (let ((actions (ivy-state-action ivy-last)))
-    (if (null (ivy--actionp actions))
-        t
-      (let* ((hint (funcall ivy-read-action-format-function (cdr actions)))
-             (resize-mini-windows t)
-             (key (string (read-key hint)))
-             (action-idx (cl-position-if
-                          (lambda (x) (equal (car x) key))
-                          (cdr actions))))
-        (cond ((string= key "")
-               nil)
-              ((null action-idx)
-               (message "%s is not bound" key)
-               nil)
-              (t
-               (message "")
-               (setcar actions (1+ action-idx))
-               (ivy-set-action actions)))))))
-
-(defun ivy-shrink-after-dispatching ()
-  "Shrink the window after dispatching when action list is too large."
-  (let ((window (selected-window)))
-    (window-resize window (- ivy-height (window-height window)))))
-
-(defun ivy-dispatching-done ()
-  "Select one of the available actions and call `ivy-done'."
-  (interactive)
-  (when (ivy-read-action)
-    (ivy-done))
-  (ivy-shrink-after-dispatching))
-
-(defun ivy-dispatching-call ()
-  "Select one of the available actions and call `ivy-call'."
-  (interactive)
-  (setq ivy-current-prefix-arg current-prefix-arg)
-  (let ((actions (copy-sequence (ivy-state-action ivy-last))))
-    (unwind-protect
-         (when (ivy-read-action)
-           (ivy-call))
-      (ivy-set-action actions)))
-  (ivy-shrink-after-dispatching))
-
-(defun ivy-build-tramp-name (x)
-  "Reconstruct X into a path.
-Is is a cons cell, related to `tramp-get-completion-function'."
-  (let ((user (car x))
-        (domain (cadr x)))
-    (if user
-        (concat user "@" domain)
-      domain)))
-
-(declare-function tramp-get-completion-function "tramp")
-(declare-function Info-find-node "info")
-
-(defun ivy-alt-done (&optional arg)
-  "Exit the minibuffer with the selected candidate.
-When ARG is t, exit with current text, ignoring the candidates."
-  (interactive "P")
-  (setq ivy-current-prefix-arg current-prefix-arg)
-  (cond (arg
-         (ivy-immediate-done))
-        (ivy--directory
-         (ivy--directory-done))
-        ((eq (ivy-state-collection ivy-last) 'Info-read-node-name-1)
-         (if (member (ivy-state-current ivy-last) '("(./)" "(../)"))
-             (ivy-quit-and-run
-              (ivy-read "Go to file: " 'read-file-name-internal
-                        :action (lambda (x)
-                                  (Info-find-node
-                                   (expand-file-name x ivy--directory)
-                                   "Top"))))
-           (ivy-done)))
-        (t
-         (ivy-done))))
-
-(defun ivy--directory-done ()
-  "Handle exit from the minibuffer when completing file names."
-  (let (dir)
-    (cond
-      ((equal ivy-text "/sudo::")
-       (setq dir (concat ivy-text ivy--directory))
-       (ivy--cd dir)
-       (ivy--exhibit))
-      ((and
-        (> ivy--length 0)
-        (not (string= (ivy-state-current ivy-last) "./"))
-        (setq dir (ivy-expand-file-if-directory (ivy-state-current ivy-last))))
-       (ivy--cd dir)
-       (ivy--exhibit))
-      ((and (not (string= ivy-text ""))
-            (ignore-errors (file-exists-p ivy-text)))
-       (if (file-directory-p ivy-text)
-           (ivy--cd (expand-file-name
-                     (file-name-as-directory ivy-text) ivy--directory))
-         (ivy-done)))
-      ((or (and (equal ivy--directory "/")
-                (string-match "\\`[^/]+:.*:.*\\'" ivy-text))
-           (string-match "\\`/[^/]+:.*:.*\\'" ivy-text))
-       (ivy-done))
-      ((or (and (equal ivy--directory "/")
-                (cond ((string-match
-                        "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
-                        ivy-text))
-                      ((string-match
-                        "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
-                        (ivy-state-current ivy-last))
-                       (setq ivy-text (ivy-state-current ivy-last)))))
-           (string-match
-            "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
-            ivy-text))
-       (let ((method (match-string 1 ivy-text))
-             (user (match-string 2 ivy-text))
-             (rest (match-string 3 ivy-text))
-             res)
-         (require 'tramp)
-         (dolist (x (tramp-get-completion-function method))
-           (setq res (append res (funcall (car x) (cadr x)))))
-         (setq res (delq nil res))
-         (when user
-           (dolist (x res)
-             (setcar x user)))
-         (setq res (cl-delete-duplicates res :test #'equal))
-         (let* ((old-ivy-last ivy-last)
-                (enable-recursive-minibuffers t)
-                (host (ivy-read "address@hidden: "
-                                (mapcar #'ivy-build-tramp-name res)
-                                :initial-input rest)))
-           (setq ivy-last old-ivy-last)
-           (when host
-             (setq ivy--directory "/")
-             (ivy--cd (concat "/" method ":" host ":"))))))
-      (t
-       (ivy-done)))))
-
-(defun ivy-expand-file-if-directory (file-name)
-  "Expand FILE-NAME as directory.
-When this directory doesn't exist, return nil."
-  (when (stringp file-name)
-    (let ((full-name
-           ;; Ignore host name must not match method "ssh"
-           (ignore-errors
-             (file-name-as-directory
-              (expand-file-name file-name ivy--directory)))))
-      (when (and full-name (file-directory-p full-name))
-        full-name))))
-
-(defcustom ivy-tab-space nil
-  "When non-nil, `ivy-partial-or-done' should insert a space."
-  :type 'boolean)
-
-(defun ivy-partial-or-done ()
-  "Complete the minibuffer text as much as possible.
-If the text hasn't changed as a result, forward to `ivy-alt-done'."
-  (interactive)
-  (if (and (eq (ivy-state-collection ivy-last) #'read-file-name-internal)
-           (or (and (equal ivy--directory "/")
-                    (string-match "\\`[^/]+:.*\\'" ivy-text))
-               (string-match "\\`/" ivy-text)))
-      (let ((default-directory ivy--directory)
-            dir)
-        (minibuffer-complete)
-        (setq ivy-text (ivy--input))
-        (when (setq dir (ivy-expand-file-if-directory ivy-text))
-          (ivy--cd dir)))
-    (or (ivy-partial)
-        (when (or (eq this-command last-command)
-                  (eq ivy--length 1))
-          (ivy-alt-done)))))
-
-(defun ivy-partial ()
-  "Complete the minibuffer text as much as possible."
-  (interactive)
-  (let* ((parts (or (split-string ivy-text " " t) (list "")))
-         (postfix (car (last parts)))
-         (completion-ignore-case t)
-         (startp (string-match "^\\^" postfix))
-         (new (try-completion (if startp
-                                  (substring postfix 1)
-                                postfix)
-                              (if (ivy-state-dynamic-collection ivy-last)
-                                  ivy--all-candidates
-                                (mapcar (lambda (str)
-                                          (let ((i (string-match postfix str)))
-                                            (when i
-                                              (substring str i))))
-                                        ivy--old-cands)))))
-    (cond ((eq new t) nil)
-          ((string= new ivy-text) nil)
-          (new
-           (delete-region (minibuffer-prompt-end) (point-max))
-           (setcar (last parts)
-                   (if startp
-                       (concat "^" new)
-                     new))
-           (insert (mapconcat #'identity parts " ")
-                   (if ivy-tab-space " " ""))
-           t))))
-
-(defun ivy-immediate-done ()
-  "Exit the minibuffer with current input instead of current candidate."
-  (interactive)
-  (delete-minibuffer-contents)
-  (insert (setf (ivy-state-current ivy-last)
-                (if (and ivy--directory
-                         (not (eq (ivy-state-history ivy-last)
-                                  'grep-files-history)))
-                    (expand-file-name ivy-text ivy--directory)
-                  ivy-text)))
-  (setq ivy-exit 'done)
-  (exit-minibuffer))
-
-;;;###autoload
-(defun ivy-resume ()
-  "Resume the last completion session."
-  (interactive)
-  (if (null (ivy-state-action ivy-last))
-      (user-error "The last session isn't compatible with `ivy-resume'")
-    (when (eq (ivy-state-caller ivy-last) 'swiper)
-      (switch-to-buffer (ivy-state-buffer ivy-last)))
-    (with-current-buffer (ivy-state-buffer ivy-last)
-      (let ((default-directory (ivy-state-directory ivy-last)))
-        (ivy-read
-         (ivy-state-prompt ivy-last)
-         (ivy-state-collection ivy-last)
-         :predicate (ivy-state-predicate ivy-last)
-         :require-match (ivy-state-require-match ivy-last)
-         :initial-input ivy-text
-         :history (ivy-state-history ivy-last)
-         :preselect (unless (eq (ivy-state-collection ivy-last)
-                                'read-file-name-internal)
-                      (ivy-state-current ivy-last))
-         :keymap (ivy-state-keymap ivy-last)
-         :update-fn (ivy-state-update-fn ivy-last)
-         :sort (ivy-state-sort ivy-last)
-         :action (ivy-state-action ivy-last)
-         :unwind (ivy-state-unwind ivy-last)
-         :re-builder (ivy-state-re-builder ivy-last)
-         :matcher (ivy-state-matcher ivy-last)
-         :dynamic-collection (ivy-state-dynamic-collection ivy-last)
-         :caller (ivy-state-caller ivy-last))))))
-
-(defvar-local ivy-calling nil
-  "When non-nil, call the current action when `ivy--index' changes.")
-
-(defun ivy-set-index (index)
-  "Set `ivy--index' to INDEX."
-  (setq ivy--index index)
-  (when ivy-calling
-    (ivy--exhibit)
-    (ivy-call)))
-
-(defun ivy-beginning-of-buffer ()
-  "Select the first completion candidate."
-  (interactive)
-  (ivy-set-index 0))
-
-(defun ivy-end-of-buffer ()
-  "Select the last completion candidate."
-  (interactive)
-  (ivy-set-index (1- ivy--length)))
-
-(defun ivy-scroll-up-command ()
-  "Scroll the candidates upward by the minibuffer height."
-  (interactive)
-  (ivy-set-index (min (1- (+ ivy--index ivy-height))
-                      (1- ivy--length))))
-
-(defun ivy-scroll-down-command ()
-  "Scroll the candidates downward by the minibuffer height."
-  (interactive)
-  (ivy-set-index (max (1+ (- ivy--index ivy-height))
-                      0)))
-
-(defun ivy-minibuffer-grow ()
-  "Grow the minibuffer window by 1 line."
-  (interactive)
-  (setq-local max-mini-window-height
-              (cl-incf ivy-height)))
-
-(defun ivy-minibuffer-shrink ()
-  "Shrink the minibuffer window by 1 line."
-  (interactive)
-  (unless (<= ivy-height 2)
-    (setq-local max-mini-window-height
-                (cl-decf ivy-height))
-    (window-resize (selected-window) -1)))
-
-(defun ivy-next-line (&optional arg)
-  "Move cursor vertically down ARG candidates."
-  (interactive "p")
-  (setq arg (or arg 1))
-  (let ((index (+ ivy--index arg)))
-    (if (> index (1- ivy--length))
-        (if ivy-wrap
-            (ivy-beginning-of-buffer)
-          (ivy-set-index (1- ivy--length)))
-      (ivy-set-index index))))
-
-(defun ivy-next-line-or-history (&optional arg)
-  "Move cursor vertically down ARG candidates.
-If the input is empty, select the previous history element instead."
-  (interactive "p")
-  (if (string= ivy-text "")
-      (ivy-previous-history-element 1)
-    (ivy-next-line arg)))
-
-(defun ivy-previous-line (&optional arg)
-  "Move cursor vertically up ARG candidates."
-  (interactive "p")
-  (setq arg (or arg 1))
-  (let ((index (- ivy--index arg)))
-    (if (< index 0)
-        (if ivy-wrap
-            (ivy-end-of-buffer)
-          (ivy-set-index 0))
-      (ivy-set-index index))))
-
-(defun ivy-previous-line-or-history (arg)
-  "Move cursor vertically up ARG candidates.
-If the input is empty, select the previous history element instead."
-  (interactive "p")
-  (when (string= ivy-text "")
-    (ivy-previous-history-element 1))
-  (ivy-previous-line arg))
-
-(defun ivy-toggle-calling ()
-  "Flip `ivy-calling'."
-  (interactive)
-  (when (setq ivy-calling (not ivy-calling))
-    (ivy-call)))
-
-(defun ivy-toggle-ignore ()
-  "Toggle user-configured candidate filtering."
-  (interactive)
-  (setq ivy-use-ignore
-        (if ivy-use-ignore
-            nil
-          (or ivy-use-ignore-default t)))
-  ;; invalidate cache
-  (setq ivy--old-cands nil))
-
-(defun ivy--get-action (state)
-  "Get the action function from STATE."
-  (let ((action (ivy-state-action state)))
-    (when action
-      (if (functionp action)
-          action
-        (cadr (nth (car action) action))))))
-
-(defun ivy--get-window (state)
-  "Get the window from STATE."
-  (if (ivy-state-p state)
-      (let ((window (ivy-state-window state)))
-        (if (window-live-p window)
-            window
-          (if (= (length (window-list)) 1)
-              (selected-window)
-            (next-window))))
-    (selected-window)))
-
-(defun ivy--actionp (x)
-  "Return non-nil when X is a list of actions."
-  (and x (listp x) (not (memq (car x) '(closure lambda)))))
-
-(defcustom ivy-action-wrap nil
-  "When non-nil, `ivy-next-action' and `ivy-prev-action' wrap."
-  :type 'boolean)
-
-(defun ivy-next-action ()
-  "When the current action is a list, scroll it forwards."
-  (interactive)
-  (let ((action (ivy-state-action ivy-last)))
-    (when (ivy--actionp action)
-      (let ((len (1- (length action)))
-            (idx (car action)))
-        (if (>= idx len)
-            (when ivy-action-wrap
-              (setf (car action) 1))
-          (cl-incf (car action)))))))
-
-(defun ivy-prev-action ()
-  "When the current action is a list, scroll it backwards."
-  (interactive)
-  (let ((action (ivy-state-action ivy-last)))
-    (when (ivy--actionp action)
-      (if (<= (car action) 1)
-          (when ivy-action-wrap
-            (setf (car action) (1- (length action))))
-        (cl-decf (car action))))))
-
-(defun ivy-action-name ()
-  "Return the name associated with the current action."
-  (let ((action (ivy-state-action ivy-last)))
-    (if (ivy--actionp action)
-        (format "[%d/%d] %s"
-                (car action)
-                (1- (length action))
-                (nth 2 (nth (car action) action)))
-      "[1/1] default")))
-
-(defvar ivy-inhibit-action nil
-  "When non-nil, `ivy-call' does nothing.
-
-Example use:
-
-    (let* ((ivy-inhibit-action t)
-          (str (counsel-locate \"lispy.el\")))
-     ;; do whatever with str - the corresponding file will not be opened
-     )")
-
-(defun ivy-recursive-restore ()
-  (when (and ivy-recursive-last
-             ivy-recursive-restore
-             (not (eq ivy-last ivy-recursive-last)))
-    (ivy--reset-state (setq ivy-last ivy-recursive-last))))
-
-(defun ivy-call ()
-  "Call the current action without exiting completion."
-  (interactive)
-  (unless
-      (or
-       ;; this is needed for testing in ivy-with which seems to call ivy-call
-       ;; again, and this-command is nil in that case.
-       (null this-command)
-       (memq this-command '(ivy-done
-                            ivy-alt-done
-                            ivy-dispatching-done)))
-    (setq ivy-current-prefix-arg current-prefix-arg))
-  (unless ivy-inhibit-action
-    (let ((action (ivy--get-action ivy-last)))
-      (when action
-        (let* ((collection (ivy-state-collection ivy-last))
-               (x (cond
-                    ;; Alist type.
-                    ((and (consp collection)
-                          (consp (car collection))
-                          ;; Previously, the cdr of the selected
-                          ;; candidate would be returned.  Now, the
-                          ;; whole candidate is returned.
-                          (let (idx)
-                            (if (setq idx (get-text-property
-                                           0 'idx (ivy-state-current 
ivy-last)))
-                                (nth idx collection)
-                              (assoc (ivy-state-current ivy-last)
-                                     collection)))))
-                    (ivy--directory
-                     (expand-file-name
-                      (ivy-state-current ivy-last)
-                      ivy--directory))
-                    ((equal (ivy-state-current ivy-last) "")
-                     ivy-text)
-                    (t
-                     (ivy-state-current ivy-last)))))
-          (if (eq action 'identity)
-              (funcall action x)
-            (select-window (ivy--get-window ivy-last))
-            (prog1 (with-current-buffer (ivy-state-buffer ivy-last)
-                     (unwind-protect (funcall action x)
-                       (ivy-recursive-restore)))
-              (unless (or (eq ivy-exit 'done)
-                          (equal (selected-window)
-                                 (active-minibuffer-window))
-                          (null (active-minibuffer-window)))
-                (select-window (active-minibuffer-window))))))))))
-
-(defun ivy-next-line-and-call (&optional arg)
-  "Move cursor vertically down ARG candidates.
-Call the permanent action if possible."
-  (interactive "p")
-  (ivy-next-line arg)
-  (ivy--exhibit)
-  (ivy-call))
-
-(defun ivy-previous-line-and-call (&optional arg)
-  "Move cursor vertically down ARG candidates.
-Call the permanent action if possible."
-  (interactive "p")
-  (ivy-previous-line arg)
-  (ivy--exhibit)
-  (ivy-call))
-
-(defun ivy-previous-history-element (arg)
-  "Forward to `previous-history-element' with ARG."
-  (interactive "p")
-  (previous-history-element arg)
-  (ivy--cd-maybe)
-  (move-end-of-line 1)
-  (ivy--maybe-scroll-history))
-
-(defun ivy-next-history-element (arg)
-  "Forward to `next-history-element' with ARG."
-  (interactive "p")
-  (if (and (= minibuffer-history-position 0)
-           (equal ivy-text ""))
-      (progn
-        (insert ivy--default)
-        (when (and (with-ivy-window (derived-mode-p 'prog-mode))
-                   (eq (ivy-state-caller ivy-last) 'swiper)
-                   (not (file-exists-p ivy--default))
-                   (not (ffap-url-p ivy--default))
-                   (not (ivy-state-dynamic-collection ivy-last))
-                   (> (point) (minibuffer-prompt-end)))
-          (undo-boundary)
-          (insert "\\_>")
-          (goto-char (minibuffer-prompt-end))
-          (insert "\\_<")
-          (forward-char (+ 2 (length ivy--default)))))
-    (next-history-element arg))
-  (ivy--cd-maybe)
-  (move-end-of-line 1)
-  (ivy--maybe-scroll-history))
-
-(defvar ivy-ffap-url-functions nil
-  "List of functions that check if the point is on a URL.")
-
-(defun ivy--cd-maybe ()
-  "Check if the current input points to a different directory.
-If so, move to that directory, while keeping only the file name."
-  (when ivy--directory
-    (let ((input (ivy--input))
-          url)
-      (if (setq url (or (ffap-url-p input)
-                        (with-ivy-window
-                          (cl-reduce
-                           (lambda (a b)
-                             (or a (funcall b)))
-                           ivy-ffap-url-functions
-                           :initial-value nil))))
-          (ivy-exit-with-action
-           (lambda (_)
-             (funcall ffap-url-fetcher url)))
-        (setq input (expand-file-name input))
-        (let ((file (file-name-nondirectory input))
-              (dir (expand-file-name (file-name-directory input))))
-          (if (string= dir ivy--directory)
-              (progn
-                (delete-minibuffer-contents)
-                (insert file))
-            (ivy--cd dir)
-            (insert file)))))))
-
-(defun ivy--maybe-scroll-history ()
-  "If the selected history element has an index, scroll there."
-  (let ((idx (ignore-errors
-               (get-text-property
-                (minibuffer-prompt-end)
-                'ivy-index))))
-    (when idx
-      (ivy--exhibit)
-      (ivy-set-index idx))))
-
-(defun ivy--cd (dir)
-  "When completing file names, move to directory DIR."
-  (if (null ivy--directory)
-      (error "Unexpected")
-    (setq ivy--old-cands nil)
-    (setq ivy--old-re nil)
-    (ivy-set-index 0)
-    (setq ivy--all-candidates
-          (ivy--sorted-files (setq ivy--directory dir)))
-    (setq ivy-text "")
-    (delete-minibuffer-contents)))
-
-(defun ivy-backward-delete-char ()
-  "Forward to `backward-delete-char'.
-On error (read-only), call `ivy-on-del-error-function'."
-  (interactive)
-  (if (and ivy--directory (= (minibuffer-prompt-end) (point)))
-      (progn
-        (ivy--cd (file-name-directory
-                  (directory-file-name
-                   (expand-file-name
-                    ivy--directory))))
-        (ivy--exhibit))
-    (condition-case nil
-        (backward-delete-char 1)
-      (error
-       (when ivy-on-del-error-function
-         (funcall ivy-on-del-error-function))))))
-
-(defun ivy-delete-char (arg)
-  "Forward to `delete-char' ARG."
-  (interactive "p")
-  (unless (= (point) (line-end-position))
-    (delete-char arg)))
-
-(defun ivy-forward-char (arg)
-  "Forward to `forward-char' ARG."
-  (interactive "p")
-  (unless (= (point) (line-end-position))
-    (forward-char arg)))
-
-(defun ivy-kill-word (arg)
-  "Forward to `kill-word' ARG."
-  (interactive "p")
-  (unless (= (point) (line-end-position))
-    (kill-word arg)))
-
-(defun ivy-kill-line ()
-  "Forward to `kill-line'."
-  (interactive)
-  (if (eolp)
-      (kill-region (minibuffer-prompt-end) (point))
-    (kill-line)))
-
-(defun ivy-backward-kill-word ()
-  "Forward to `backward-kill-word'."
-  (interactive)
-  (if (and ivy--directory (= (minibuffer-prompt-end) (point)))
-      (progn
-        (ivy--cd (file-name-directory
-                  (directory-file-name
-                   (expand-file-name
-                    ivy--directory))))
-        (ivy--exhibit))
-    (ignore-errors
-      (let ((pt (point)))
-        (forward-word -1)
-        (delete-region (point) pt)))))
-
-(defvar ivy--regexp-quote 'regexp-quote
-  "Store the regexp quoting state.")
-
-(defun ivy-toggle-regexp-quote ()
-  "Toggle the regexp quoting."
-  (interactive)
-  (setq ivy--old-re nil)
-  (cl-rotatef ivy--regex-function ivy--regexp-quote))
-
-(defvar avy-all-windows)
-(defvar avy-action)
-(defvar avy-keys)
-(defvar avy-keys-alist)
-(defvar avy-style)
-(defvar avy-styles-alist)
-(declare-function avy--process "ext:avy")
-(declare-function avy--style-fn "ext:avy")
-
-(eval-after-load 'avy
-  '(add-to-list 'avy-styles-alist '(ivy-avy . pre)))
-
-(defun ivy-avy ()
-  "Jump to one of the current ivy candidates."
-  (interactive)
-  (unless (require 'avy nil 'noerror)
-    (error "Package avy isn't installed"))
-  (let* ((avy-all-windows nil)
-         (avy-keys (or (cdr (assq 'ivy-avy avy-keys-alist))
-                       avy-keys))
-         (avy-style (or (cdr (assq 'ivy-avy
-                                   avy-styles-alist))
-                        avy-style))
-         (candidate
-          (let ((candidates))
-            (save-excursion
-              (save-restriction
-                (narrow-to-region
-                 (window-start)
-                 (window-end))
-                (goto-char (point-min))
-                (forward-line)
-                (while (< (point) (point-max))
-                  (push
-                   (cons (point)
-                         (selected-window))
-                   candidates)
-                  (forward-line))))
-            (setq avy-action #'identity)
-            (avy--process
-             (nreverse candidates)
-             (avy--style-fn avy-style)))))
-    (when (numberp candidate)
-      (ivy-set-index (- (line-number-at-pos candidate) 2))
-      (ivy--exhibit)
-      (ivy-done))))
-
-(defun ivy-sort-file-function-default (x y)
-  "Compare two files X and Y.
-Prioritize directories."
-  (if (get-text-property 0 'dirp x)
-      (if (get-text-property 0 'dirp y)
-          (string< x y)
-        t)
-    (if (get-text-property 0 'dirp y)
-        nil
-      (string< x y))))
-
-(declare-function ido-file-extension-lessp "ido")
-
-(defun ivy-sort-file-function-using-ido (x y)
-  "Compare two files X and Y using `ido-file-extensions-order'.
-
-This function is suitable as a replacement for
-`ivy-sort-file-function-default' in `ivy-sort-functions-alist'."
-  (if (and (bound-and-true-p ido-file-extensions-order))
-      (ido-file-extension-lessp x y)
-    (ivy-sort-file-function-default x y)))
-
-(defcustom ivy-sort-functions-alist
-  '((read-file-name-internal . ivy-sort-file-function-default)
-    (internal-complete-buffer . nil)
-    (counsel-git-grep-function . nil)
-    (Man-goto-section . nil)
-    (org-refile . nil)
-    (t . string-lessp))
-  "An alist of sorting functions for each collection function.
-Interactive functions that call completion fit in here as well.
-
-Nil means no sorting, which is useful to turn off the sorting for
-functions that have candidates in the natural buffer order, like
-`org-refile' or `Man-goto-section'.
-
-A list can be used to associate multiple sorting functions with a
-collection. The car of the list is the current sort
-function. This list can be rotated with `ivy-rotate-sort'.
-
-The entry associated with t is used for all fall-through cases.
-
-See also `ivy-sort-max-size'."
-  :type
-  '(alist
-    :key-type (choice
-               (const :tag "Fall-through" t)
-               (symbol :tag "Collection"))
-    :value-type (choice
-                 (const :tag "Plain sort" string-lessp)
-                 (const :tag "File sort" ivy-sort-file-function-default)
-                 (const :tag "No sort" nil)
-                 (function :tag "Custom function")
-                 (repeat (function :tag "Custom function"))))
-  :group 'ivy)
-
-(defun ivy--sort-function (collection)
-  "Retrieve sort function from `ivy-sort-functions-alist'"
-  (cdr (assoc collection ivy-sort-functions-alist)))
-
-(defun ivy-rotate-sort ()
-  "Rotate through sorting functions available for current collection.
-This only has an effect if multiple sorting functions are
-specified for the current collection in
-`ivy-sort-functions-alist'."
-  (interactive)
-  (let ((cell (assoc (ivy-state-collection ivy-last) 
ivy-sort-functions-alist)))
-    (when (consp (cdr cell))
-      (setcdr cell `(,@(cddr cell) ,(cadr cell)))
-      (ivy--reset-state ivy-last))))
-
-(defvar ivy-index-functions-alist
-  '((swiper . ivy-recompute-index-swiper)
-    (swiper-multi . ivy-recompute-index-swiper)
-    (counsel-git-grep . ivy-recompute-index-swiper)
-    (counsel-grep . ivy-recompute-index-swiper-async)
-    (t . ivy-recompute-index-zero))
-  "An alist of index recomputing functions for each collection function.
-When the input changes, the appropriate function returns an
-integer - the index of the matched candidate that should be
-selected.")
-
-(defvar ivy-re-builders-alist
-  '((t . ivy--regex-plus))
-  "An alist of regex building functions for each collection function.
-
-Each key is (in order of priority):
-1. The actual collection function, e.g. `read-file-name-internal'.
-2. The symbol passed by :caller into `ivy-read'.
-3. `this-command'.
-4. t.
-
-Each value is a function that should take a string and return a
-valid regex or a regex sequence (see below).
-
-Possible choices: `ivy--regex', `regexp-quote',
-`ivy--regex-plus', `ivy--regex-fuzzy'.
-
-If a function returns a list, it should format like this:
-'((\"matching-regexp\" . t) (\"non-matching-regexp\") ...).
-
-The matches will be filtered in a sequence, you can mix the
-regexps that should match and that should not match as you
-like.")
-
-(defvar ivy-highlight-functions-alist
-  '((ivy--regex-ignore-order . ivy--highlight-ignore-order)
-    (ivy--regex-fuzzy . ivy--highlight-fuzzy))
-  "An alist of highlighting functions for each regex buidler function.")
-
-(defvar ivy-initial-inputs-alist
-  '((org-refile . "^")
-    (org-agenda-refile . "^")
-    (org-capture-refile . "^")
-    (counsel-M-x . "^")
-    (counsel-describe-function . "^")
-    (counsel-describe-variable . "^")
-    (man . "^")
-    (woman . "^"))
-  "Command to initial input table.")
-
-(defcustom ivy-sort-max-size 30000
-  "Sorting won't be done for collections larger than this."
-  :type 'integer)
-
-(defun ivy--sorted-files (dir &optional predicate)
-  "Return the list of files in DIR.
-When PREDICATE is not nil, use it to filter the result.
-Directories come first."
-  (let* ((default-directory dir)
-         (seq (condition-case nil
-                  (all-completions "" 'read-file-name-internal)
-                (error
-                 (directory-files dir))))
-         sort-fn)
-    (if (equal dir "/")
-        seq
-      (setq seq (delete "./" (delete "../" seq)))
-      (when (eq (setq sort-fn (ivy--sort-function 'read-file-name-internal))
-                #'ivy-sort-file-function-default)
-        (setq seq (mapcar (lambda (x)
-                            (propertize x 'dirp (string-match-p "/\\'" x)))
-                          seq)))
-      (when sort-fn
-        (setq seq (cl-sort seq sort-fn)))
-      (dolist (dir ivy-extra-directories)
-        (push dir seq))
-      (if predicate
-          (cl-remove-if-not predicate seq)
-        seq))))
-
-;;** Entry Point
-;;;###autoload
-(cl-defun ivy-read (prompt collection
-                    &key
-                      predicate require-match initial-input
-                      history preselect keymap update-fn sort
-                      action unwind re-builder matcher
-                      dynamic-collection caller)
-  "Read a string in the minibuffer, with completion.
-
-PROMPT is a format string, normally ending in a colon and a
-space; %d anywhere in the string is replaced by the current
-number of matching candidates. For the literal % character,
-escape it with %%. See also `ivy-count-format'.
-
-COLLECTION is either a list of strings, a function, an alist, or
-a hash table.
-
-PREDICATE is applied to filter out the COLLECTION immediately.
-This argument is for `completing-read' compat.
-
-When REQUIRE-MATCH is non-nil, only members of COLLECTION can be
-selected, i.e. custom text.
-
-If INITIAL-INPUT is not nil, then insert that input in the
-minibuffer initially.
-
-HISTORY is a name of a variable to hold the completion session
-history.
-
-KEYMAP is composed with `ivy-minibuffer-map'.
-
-If PRESELECT is not nil, then select the corresponding candidate
-out of the ones that match the INITIAL-INPUT.
-
-UPDATE-FN is called each time the current candidate(s) is changed.
-
-When SORT is t, use `ivy-sort-functions-alist' for sorting.
-
-ACTION is a lambda function to call after selecting a result. It
-takes a single string argument.
-
-UNWIND is a lambda function to call before exiting.
-
-RE-BUILDER is a lambda function to call to transform text into a
-regex pattern.
-
-MATCHER is to override matching.
-
-DYNAMIC-COLLECTION is a boolean to specify if the list of
-candidates is updated after each input by calling COLLECTION.
-
-CALLER is a symbol to uniquely identify the caller to `ivy-read'.
-It is used, along with COLLECTION, to determine which
-customizations apply to the current completion session."
-  (let ((extra-actions (delete-dups
-                        (append (plist-get ivy--actions-list t)
-                                (plist-get ivy--actions-list this-command)
-                                (plist-get ivy--actions-list caller)))))
-    (when extra-actions
-      (setq action
-            (cond ((functionp action)
-                   `(1
-                     ("o" ,action "default")
-                     ,@extra-actions))
-                  ((null action)
-                   `(1
-                     ("o" identity "default")
-                     ,@extra-actions))
-                  (t
-                   (delete-dups (append action extra-actions)))))))
-  (let ((extra-sources (plist-get ivy--sources-list caller)))
-    (if extra-sources
-        (progn
-          (setq ivy--extra-candidates nil)
-          (dolist (source extra-sources)
-            (cond ((equal source '(original-source))
-                   (setq ivy--extra-candidates
-                         (cons source ivy--extra-candidates)))
-                  ((null (cdr source))
-                   (setq ivy--extra-candidates
-                         (cons
-                          (list (car source) (funcall (car source)))
-                          ivy--extra-candidates))))))
-      (setq ivy--extra-candidates '((original-source)))))
-  (let ((ivy-recursive-last (and (active-minibuffer-window) ivy-last))
-        (transformer-fn
-         (plist-get ivy--display-transformers-list
-                    (or caller (and (functionp collection)
-                                    collection))))
-        (ivy-display-function
-         (unless (window-minibuffer-p)
-           (cdr (assoc caller ivy-display-functions-alist)))))
-    (setq ivy-last
-          (make-ivy-state
-           :prompt prompt
-           :collection collection
-           :predicate predicate
-           :require-match require-match
-           :initial-input initial-input
-           :history history
-           :preselect preselect
-           :keymap keymap
-           :update-fn update-fn
-           :sort sort
-           :action action
-           :frame (selected-frame)
-           :window (selected-window)
-           :buffer (current-buffer)
-           :unwind unwind
-           :re-builder re-builder
-           :matcher matcher
-           :dynamic-collection dynamic-collection
-           :display-transformer-fn transformer-fn
-           :directory default-directory
-           :caller caller))
-    (ivy--reset-state ivy-last)
-    (prog1
-        (unwind-protect
-             (minibuffer-with-setup-hook
-                 #'ivy--minibuffer-setup
-               (let* ((hist (or history 'ivy-history))
-                      (minibuffer-completion-table collection)
-                      (minibuffer-completion-predicate predicate)
-                      (resize-mini-windows
-                       (cond
-                         ((display-graphic-p) nil)
-                         ((null resize-mini-windows) 'grow-only)
-                         (t resize-mini-windows))))
-                 (read-from-minibuffer
-                  prompt
-                  (ivy-state-initial-input ivy-last)
-                  (make-composed-keymap keymap ivy-minibuffer-map)
-                  nil
-                  hist)
-                 (when (eq ivy-exit 'done)
-                   (let ((item (if ivy--directory
-                                   (ivy-state-current ivy-last)
-                                 ivy-text)))
-                     (unless (equal item "")
-                       (set hist (cons (propertize item 'ivy-index ivy--index)
-                                       (delete item
-                                               (cdr (symbol-value hist))))))))
-                 (ivy-state-current ivy-last)))
-          (remove-hook 'post-command-hook #'ivy--exhibit)
-          (ivy-overlay-cleanup)
-          (when (setq unwind (ivy-state-unwind ivy-last))
-            (funcall unwind))
-          (unless (eq ivy-exit 'done)
-            (ivy-recursive-restore)))
-      (ivy-call)
-      (when (> (length (ivy-state-current ivy-last)) 0)
-        (remove-text-properties 0 1 '(idx) (ivy-state-current ivy-last))))))
-
-(defun ivy--reset-state (state)
-  "Reset the ivy to STATE.
-This is useful for recursive `ivy-read'."
-  (unless (equal (selected-frame) (ivy-state-frame state))
-    (select-window (active-minibuffer-window)))
-  (let ((prompt (or (ivy-state-prompt state) ""))
-        (collection (ivy-state-collection state))
-        (predicate (ivy-state-predicate state))
-        (history (ivy-state-history state))
-        (preselect (ivy-state-preselect state))
-        (sort (ivy-state-sort state))
-        (re-builder (ivy-state-re-builder state))
-        (dynamic-collection (ivy-state-dynamic-collection state))
-        (initial-input (ivy-state-initial-input state))
-        (require-match (ivy-state-require-match state))
-        (caller (ivy-state-caller state)))
-    (unless initial-input
-      (setq initial-input (cdr (assoc this-command
-                                      ivy-initial-inputs-alist))))
-    (setq ivy--directory nil)
-    (setq ivy-case-fold-search ivy-case-fold-search-default)
-    (setq ivy--regex-function
-          (or re-builder
-              (and (functionp collection)
-                   (cdr (assoc collection ivy-re-builders-alist)))
-              (and caller
-                   (cdr (assoc caller ivy-re-builders-alist)))
-              (cdr (assoc this-command ivy-re-builders-alist))
-              (cdr (assoc t ivy-re-builders-alist))
-              'ivy--regex))
-    (setq ivy--subexps 0)
-    (setq ivy--regexp-quote 'regexp-quote)
-    (setq ivy--old-text "")
-    (setq ivy--full-length nil)
-    (setq ivy-text "")
-    (setq ivy-calling nil)
-    (setq ivy-use-ignore ivy-use-ignore-default)
-    (let (reb)
-      (setq ivy--highlight-function
-            (if (and (eq ivy--regex-function 'swiper--re-builder)
-                     (setq reb (cdr (assoc t ivy-re-builders-alist)))
-                     (setq reb (cdr (assoc reb 
ivy-highlight-functions-alist))))
-                reb
-              (or (cdr (assoc ivy--regex-function
-                              ivy-highlight-functions-alist))
-                  #'ivy--highlight-default))))
-    (let (coll sort-fn)
-      (cond ((eq collection 'Info-read-node-name-1)
-             (if (equal Info-current-file "dir")
-                 (setq coll
-                       (mapcar (lambda (x) (format "(%s)" x))
-                               (cl-delete-duplicates
-                                (all-completions "(" collection predicate)
-                                :test #'equal)))
-               (setq coll (all-completions "" collection predicate))))
-            ((eq collection 'read-file-name-internal)
-             (setq ivy--directory default-directory)
-             (when (and initial-input
-                        (not (equal initial-input "")))
-               (cond ((file-directory-p initial-input)
-                      (when (and (eq this-command 'dired-do-copy)
-                                 (equal (file-name-nondirectory initial-input)
-                                        ""))
-                        (setf (ivy-state-preselect state) (setq preselect 
nil)))
-                      (setq ivy--directory initial-input)
-                      (setq initial-input nil)
-                      (when preselect
-                        (let ((preselect-directory
-                               (file-name-directory preselect)))
-                          (when (and preselect-directory
-                                     (not (equal
-                                           (expand-file-name
-                                            preselect-directory)
-                                           (expand-file-name ivy--directory))))
-                            (setf (ivy-state-preselect state)
-                                  (setq preselect nil))))))
-                     ((ignore-errors
-                        (file-exists-p (file-name-directory initial-input)))
-                      (setq ivy--directory (file-name-directory initial-input))
-                      (setf (ivy-state-preselect state)
-                            (file-name-nondirectory initial-input)))))
-             (require 'dired)
-             (when preselect
-               (let ((preselect-directory (file-name-directory preselect)))
-                 (unless (or (null preselect-directory)
-                             (string= preselect-directory
-                                      default-directory))
-                   (setq ivy--directory preselect-directory))
-                 (setf
-                  (ivy-state-preselect state)
-                  (setq preselect (file-name-nondirectory preselect)))))
-             (setq coll (ivy--sorted-files ivy--directory predicate))
-             (when initial-input
-               (unless (or require-match
-                           (equal initial-input default-directory)
-                           (equal initial-input ""))
-                 (setq coll (cons initial-input coll)))
-               (unless (and (ivy-state-action ivy-last)
-                            (not (equal (ivy--get-action ivy-last) 'identity)))
-                 (setq initial-input nil))))
-            ((eq collection 'internal-complete-buffer)
-             (setq coll (ivy--buffer-list "" ivy-use-virtual-buffers 
predicate)))
-            (dynamic-collection
-             (setq coll (funcall collection ivy-text)))
-            ((and (consp collection) (listp (car collection)))
-             (if (and sort (setq sort-fn (ivy--sort-function caller)))
-                 (progn
-                   (setq sort nil)
-                   (setq coll (mapcar #'car
-                                      (cl-sort
-                                       (copy-sequence collection)
-                                       sort-fn))))
-               (setq collection
-                     (setf (ivy-state-collection ivy-last)
-                           (cl-remove-if-not predicate collection)))
-               (setq coll (all-completions "" collection)))
-             (let ((i 0))
-               (ignore-errors
-                 ;; cm can be read-only
-                 (dolist (cm coll)
-                   (add-text-properties 0 1 `(idx ,i) cm)
-                   (cl-incf i)))))
-            ((or (functionp collection)
-                 (byte-code-function-p collection)
-                 (vectorp collection)
-                 (hash-table-p collection)
-                 (and (listp collection) (symbolp (car collection))))
-             (setq coll (all-completions "" collection predicate)))
-            (t
-             (setq coll collection)))
-      (when sort
-        (if (and (functionp collection)
-                 (setq sort-fn (ivy--sort-function collection)))
-            (when (not (eq collection 'read-file-name-internal))
-              (setq coll (cl-sort coll sort-fn)))
-          (when (and (not (eq history 'org-refile-history))
-                     (<= (length coll) ivy-sort-max-size)
-                     (setq sort-fn (ivy--sort-function caller)))
-            (setq coll (cl-sort (copy-sequence coll) sort-fn)))))
-      (setq coll (ivy--set-candidates coll))
-      (when preselect
-        (unless (or (not (stringp preselect))
-                    (and require-match
-                         (not (eq collection 'internal-complete-buffer)))
-                    dynamic-collection
-                    (let ((re (regexp-quote preselect)))
-                      (cl-find-if (lambda (x) (string-match re x))
-                                  coll)))
-          (setq coll (cons preselect coll))))
-      (setq ivy--old-re nil)
-      (setq ivy--old-cands nil)
-      (when (integerp preselect)
-        (setq ivy--old-re "")
-        (ivy-set-index preselect))
-      (when initial-input
-        ;; Needed for anchor to work
-        (setq ivy--old-cands coll)
-        (setq ivy--old-cands (ivy--filter initial-input coll)))
-      (setq ivy--all-candidates coll)
-      (unless (integerp preselect)
-        (ivy-set-index (or
-                        (and dynamic-collection
-                             ivy--index)
-                        (and preselect
-                             (ivy--preselect-index
-                              preselect
-                              (if initial-input
-                                  ivy--old-cands
-                                coll)))
-                        0))))
-    (setq ivy-exit nil)
-    (setq ivy--default
-          (if (region-active-p)
-              (buffer-substring
-               (region-beginning)
-               (region-end))
-            (ivy-thing-at-point)))
-    (setq ivy--prompt (ivy-add-prompt-count prompt))
-    (setf (ivy-state-initial-input ivy-last) initial-input)))
-
-(defun ivy-add-prompt-count (prompt)
-  (cond ((string-match "%.*d" prompt)
-         prompt)
-        ((null ivy-count-format)
-         (error
-          "`ivy-count-format' can't be nil.  Set it to \"\" instead"))
-        ((string-match "%d.*%d" ivy-count-format)
-         (let ((w (length (number-to-string
-                           (length ivy--all-candidates))))
-               (s (copy-sequence ivy-count-format)))
-           (string-match "%d" s)
-           (match-end 0)
-           (string-match "%d" s (match-end 0))
-           (setq s (replace-match (format "%%-%dd" w) nil nil s))
-           (string-match "%d" s)
-           (concat (replace-match (format "%%%dd" w) nil nil s)
-                   prompt)))
-        ((string-match "%.*d" ivy-count-format)
-         (concat ivy-count-format prompt))
-        (ivy--directory
-         prompt)
-        (t
-         prompt)))
-
-;;;###autoload
-(defun ivy-completing-read (prompt collection
-                            &optional predicate require-match initial-input
-                              history def inherit-input-method)
-  "Read a string in the minibuffer, with completion.
-
-This interface conforms to `completing-read' and can be used for
-`completing-read-function'.
-
-PROMPT is a string that normally ends in a colon and a space.
-COLLECTION is either a list of strings, an alist, an obarray, or a hash table.
-PREDICATE limits completion to a subset of COLLECTION.
-REQUIRE-MATCH is a boolean value.  See `completing-read'.
-INITIAL-INPUT is a string inserted into the minibuffer initially.
-HISTORY is a list of previously selected inputs.
-DEF is the default value.
-INHERIT-INPUT-METHOD is currently ignored."
-  (let ((handler (assoc this-command ivy-completing-read-handlers-alist)))
-    (if handler
-        (funcall (cdr handler)
-                 prompt collection
-                 predicate require-match
-                 initial-input history
-                 def inherit-input-method)
-      ;; See the doc of `completing-read'.
-      (when (consp history)
-        (when (numberp (cdr history))
-          (setq initial-input (nth (1- (cdr history))
-                                   (symbol-value (car history)))))
-        (setq history (car history)))
-      (ivy-read (replace-regexp-in-string "%" "%%" prompt)
-                collection
-                :predicate predicate
-                :require-match (and collection require-match)
-                :initial-input (if (consp initial-input)
-                                   (car initial-input)
-                                 (if (and (stringp initial-input)
-                                          (string-match "\\+" initial-input))
-                                     (replace-regexp-in-string
-                                      "\\+" "\\\\+" initial-input)
-                                   initial-input))
-                :preselect (if (listp def) (car def) def)
-                :history history
-                :keymap nil
-                :sort t
-                :caller (cond ((called-interactively-p 'any)
-                               this-command)
-                              ((and collection (symbolp collection))
-                               collection))))))
-
-(defvar ivy-completion-beg nil
-  "Completion bounds start.")
-
-(defvar ivy-completion-end nil
-  "Completion bounds end.")
-
-(declare-function mc/all-fake-cursors "ext:multiple-cursors-core")
-
-(defun ivy-completion-in-region-action (str)
-  "Insert STR, erasing the previous one.
-The previous string is between `ivy-completion-beg' and `ivy-completion-end'."
-  (when (consp str)
-    (setq str (cdr str)))
-  (when (stringp str)
-    (let ((fake-cursors (and (featurep 'multiple-cursors)
-                             (mc/all-fake-cursors)))
-          (pt (point))
-          (beg ivy-completion-beg)
-          (end ivy-completion-end))
-      (when ivy-completion-beg
-        (delete-region
-         ivy-completion-beg
-         ivy-completion-end))
-      (setq ivy-completion-beg
-            (move-marker (make-marker) (point)))
-      (insert (substring-no-properties str))
-      (setq ivy-completion-end
-            (move-marker (make-marker) (point)))
-      (save-excursion
-        (dolist (cursor fake-cursors)
-          (goto-char (overlay-start cursor))
-          (delete-region (+ (point) (- beg pt))
-                         (+ (point) (- end pt)))
-          (insert (substring-no-properties str))
-          ;; manually move the fake cursor
-          (move-overlay cursor (point) (1+ (point)))
-          (move-marker (overlay-get cursor 'point) (point))
-          (move-marker (overlay-get cursor 'mark) (point)))))))
-
-(defun ivy-completion-common-length (str)
-  "Return the length of the first `completions-common-part' face in STR."
-  (let ((pos 0)
-        (len (length str))
-        face-sym)
-    (while (and (<= pos len)
-                (let ((prop (or (prog1 (get-text-property
-                                        pos 'face str)
-                                  (setq face-sym 'face))
-                                (prog1 (get-text-property
-                                        pos 'font-lock-face str)
-                                  (setq face-sym 'font-lock-face)))))
-                  (not (eq 'completions-common-part
-                           (if (listp prop) (car prop) prop)))))
-      (setq pos (1+ pos)))
-    (if (< pos len)
-        (or (next-single-property-change pos face-sym str) len)
-      0)))
-
-(defun ivy-completion-in-region (start end collection &optional predicate)
-  "An Ivy function suitable for `completion-in-region-function'."
-  (let* ((enable-recursive-minibuffers t)
-         (str (buffer-substring-no-properties start end))
-         (completion-ignore-case case-fold-search)
-         (comps
-          (completion-all-completions str collection predicate (- end start)))
-         (ivy--prompts-list (if (window-minibuffer-p)
-                                ivy--prompts-list
-                              '(ivy-completion-in-region (lambda nil)))))
-    (if (null comps)
-        (message "No matches")
-      (let ((len (min (ivy-completion-common-length (car comps))
-                      (length str))))
-        (nconc comps nil)
-        (setq ivy-completion-beg (- end len))
-        (setq ivy-completion-end end)
-        (if (null (cdr comps))
-            (if (string= str (car comps))
-                (message "Sole match")
-              (setf (ivy-state-window ivy-last) (selected-window))
-              (ivy-completion-in-region-action
-               (substring-no-properties
-                (car comps))))
-          (let* ((w (1+ (floor (log (length comps) 10))))
-                 (ivy-count-format (if (string= ivy-count-format "")
-                                       ivy-count-format
-                                     (format "%%-%dd " w)))
-                 (prompt (format "(%s): " str)))
-            (and
-             (ivy-read (if (string= ivy-count-format "")
-                           prompt
-                         (replace-regexp-in-string "%" "%%" prompt))
-                       ;; remove 'completions-first-difference face
-                       (mapcar #'substring-no-properties comps)
-                       :predicate predicate
-                       :action #'ivy-completion-in-region-action
-                       :caller 'ivy-completion-in-region)
-             t)))))))
-
-(defcustom ivy-do-completion-in-region t
-  "When non-nil `ivy-mode' will set `completion-in-region-function'."
-  :type 'boolean)
-
-;;;###autoload
-(define-minor-mode ivy-mode
-  "Toggle Ivy mode on or off.
-Turn Ivy mode on if ARG is positive, off otherwise.
-Turning on Ivy mode sets `completing-read-function' to
-`ivy-completing-read'.
-
-Global bindings:
-\\{ivy-mode-map}
-
-Minibuffer bindings:
-\\{ivy-minibuffer-map}"
-  :group 'ivy
-  :global t
-  :keymap ivy-mode-map
-  :lighter " ivy"
-  (if ivy-mode
-      (progn
-        (setq completing-read-function 'ivy-completing-read)
-        (when ivy-do-completion-in-region
-          (setq completion-in-region-function 'ivy-completion-in-region)))
-    (setq completing-read-function 'completing-read-default)
-    (setq completion-in-region-function 'completion--in-region)))
-
-(defun ivy--preselect-index (preselect candidates)
-  "Return the index of PRESELECT in CANDIDATES."
-  (cond ((integerp preselect)
-         preselect)
-        ((cl-position preselect candidates :test #'equal))
-        ((stringp preselect)
-         (let ((re preselect))
-           (cl-position-if
-            (lambda (x)
-              (string-match re x))
-            candidates)))))
-
-;;* Implementation
-;;** Regex
-(defun ivy-re-match (re-seq str)
-  "Return non-nil if RE-SEQ matches STR.
-
-RE-SEQ is a list of (RE . MATCH-P).
-
-RE is a regular expression.
-
-MATCH-P is t when RE should match STR and nil when RE should not
-match STR.
-
-Each element of RE-SEQ must match for the funtion to return true.
-
-This concept is used to generalize regular expressions for
-`ivy--regex-plus' and `ivy--regex-ignore-order'."
-  (let ((res t)
-        re)
-    (while (and res (setq re (pop re-seq)))
-      (setq res
-            (if (cdr re)
-                (string-match-p (car re) str)
-              (not (string-match-p (car re) str)))))
-    res))
-
-(defvar ivy--regex-hash
-  (make-hash-table :test #'equal)
-  "Store pre-computed regex.")
-
-(defun ivy--split (str)
-  "Split STR into a list by single spaces.
-The remaining spaces stick to their left.
-This allows to \"quote\" N spaces by inputting N+1 spaces."
-  (let ((len (length str))
-        start0
-        (start1 0)
-        res s
-        match-len)
-    (while (and (string-match " +" str start1)
-                (< start1 len))
-      (if (and (> (match-beginning 0) 2)
-               (string= "[^" (substring
-                              str
-                              (- (match-beginning 0) 2)
-                              (match-beginning 0))))
-          (progn
-            (setq start1 (match-end 0))
-            (setq start0 0))
-        (setq match-len (- (match-end 0) (match-beginning 0)))
-        (if (= match-len 1)
-            (progn
-              (when start0
-                (setq start1 start0)
-                (setq start0 nil))
-              (push (substring str start1 (match-beginning 0)) res)
-              (setq start1 (match-end 0)))
-          (setq str (replace-match
-                     (make-string (1- match-len) ?\ )
-                     nil nil str))
-          (setq start0 (or start0 start1))
-          (setq start1 (1- (match-end 0))))))
-    (if start0
-        (push (substring str start0) res)
-      (setq s (substring str start1))
-      (unless (= (length s) 0)
-        (push s res)))
-    (nreverse res)))
-
-(defun ivy--regex (str &optional greedy)
-  "Re-build regex pattern from STR in case it has a space.
-When GREEDY is non-nil, join words in a greedy way."
-  (let ((hashed (unless greedy
-                  (gethash str ivy--regex-hash))))
-    (if hashed
-        (prog1 (cdr hashed)
-          (setq ivy--subexps (car hashed)))
-      (when (string-match "\\([^\\]\\|^\\)\\\\$" str)
-        (setq str (substring str 0 -1)))
-      (cdr (puthash str
-                    (let ((subs (ivy--split str)))
-                      (if (= (length subs) 1)
-                          (cons
-                           (setq ivy--subexps 0)
-                           (car subs))
-                        (cons
-                         (setq ivy--subexps (length subs))
-                         (mapconcat
-                          (lambda (x)
-                            (if (string-match "\\`\\\\([^?].*\\\\)\\'" x)
-                                x
-                              (format "\\(%s\\)" x)))
-                          subs
-                          (if greedy
-                              ".*"
-                            ".*?")))))
-                    ivy--regex-hash)))))
-
-(defun ivy--legal-regex-p (str)
-  "Return t if STR is valid regular expression."
-  (condition-case nil
-      (progn
-        (string-match-p str "")
-        t)
-    (invalid-regexp nil)))
-
-(defun ivy--regex-ignore-order--part (str &optional discard)
-  "Re-build regex from STR by splitting at spaces.
-Ignore the order of each group. If any substring is not a valid
-regex, treat it as a literal string."
-  (let* ((subs (split-string str " +" t))
-         (len (length subs)))
-    (cl-case len
-      (0
-       "")
-      (t
-       (mapcar (lambda (s)
-                 (cons (if (ivy--legal-regex-p s) s (regexp-quote s))
-                       (not discard)))
-               subs)))))
-
-(defun ivy--regex-ignore-order (str)
-  "Re-build regex from STR by splitting at spaces.
-Ignore the order of each group. Everything before \"!\" should
-match. Everything after \"!\" should not match."
-  (let ((parts (split-string str "!" t)))
-    (cl-case (length parts)
-      (0
-       "")
-      (1
-       (if (string= (substring str 0 1) "!")
-           (list (cons "" t)
-                 (ivy--regex-ignore-order--part (car parts) t))
-         (ivy--regex-ignore-order--part (car parts))))
-      (2
-       (append
-        (ivy--regex-ignore-order--part (car parts))
-        (ivy--regex-ignore-order--part (cadr parts) t)))
-      (t (error "Unexpected: use only one !")))))
-
-(defun ivy--regex-plus (str)
-  "Build a regex sequence from STR.
-Spaces are wild card characters, everything before \"!\" should
-match. Everything after \"!\" should not match."
-  (let ((parts (split-string str "!" t)))
-    (cl-case (length parts)
-      (0
-       "")
-      (1
-       (if (string= (substring str 0 1) "!")
-           (list (cons "" t)
-                 (list (ivy--regex (car parts))))
-         (ivy--regex (car parts))))
-      (2
-       (cons
-        (cons (ivy--regex (car parts)) t)
-        (mapcar #'list (split-string (cadr parts) " " t))))
-      (t (error "Unexpected: use only one !")))))
-
-(defun ivy--regex-fuzzy (str)
-  "Build a regex sequence from STR.
-Insert .* between each char."
-  (if (string-match "\\`\\(\\^?\\)\\(.*?\\)\\(\\$?\\)\\'" str)
-      (prog1
-          (concat (match-string 1 str)
-                  (mapconcat
-                   (lambda (x)
-                     (format "\\(%c\\)" x))
-                   (string-to-list (match-string 2 str))
-                   ".*?")
-                  (match-string 3 str))
-        (setq ivy--subexps (length (match-string 2 str))))
-    str))
-
-(defcustom ivy-fixed-height-minibuffer nil
-  "When non nil, fix the height of the minibuffer during ivy
-completion at `ivy-height'. This effectively sets the minimum
-height at this level and tries to ensure that it does not change
-depending on the number of candidates."
-  :group 'ivy
-  :type 'boolean)
-
-;;** Rest
-(defun ivy--minibuffer-setup ()
-  "Setup ivy completion in the minibuffer."
-  (set (make-local-variable 'completion-show-inline-help) nil)
-  (set (make-local-variable 'minibuffer-default-add-function)
-       (lambda ()
-         (list ivy--default)))
-  (set (make-local-variable 'inhibit-field-text-motion) nil)
-  (when (display-graphic-p)
-    (setq truncate-lines t))
-  (setq-local max-mini-window-height ivy-height)
-  (when ivy-fixed-height-minibuffer
-    (set-window-text-height (selected-window)
-                            (+ ivy-height
-                               (if ivy-add-newline-after-prompt
-                                   1
-                                 0))))
-  (add-hook 'post-command-hook #'ivy--exhibit nil t)
-  ;; show completions with empty input
-  (ivy--exhibit))
-
-(defun ivy--input ()
-  "Return the current minibuffer input."
-  ;; assume one-line minibuffer input
-  (buffer-substring-no-properties
-   (minibuffer-prompt-end)
-   (line-end-position)))
-
-(defun ivy--cleanup ()
-  "Delete the displayed completion candidates."
-  (save-excursion
-    (goto-char (minibuffer-prompt-end))
-    (delete-region (line-end-position) (point-max))))
-
-(defun ivy-cleanup-string (str)
-  "Remove unwanted text properties from STR."
-  (remove-text-properties 0 (length str) '(field) str)
-  str)
-
-(defvar ivy-set-prompt-text-properties-function
-  'ivy-set-prompt-text-properties-default
-  "Function to set the text properties of the default ivy prompt.
-Called with two arguments, PROMPT and STD-PROPS.
-The returned value should be the updated PROMPT.")
-
-(defun ivy-set-prompt-text-properties-default (prompt std-props)
-  (ivy--set-match-props prompt "confirm"
-                        `(face ivy-confirm-face ,@std-props))
-  (ivy--set-match-props prompt "match required"
-                        `(face ivy-match-required-face ,@std-props))
-  prompt)
-
-(defun ivy-prompt ()
-  "Return the current prompt."
-  (let ((fn (plist-get ivy--prompts-list (ivy-state-caller ivy-last))))
-    (if fn
-        (condition-case nil
-            (funcall fn)
-          (error
-           (warn "`counsel-prompt-function' should take 0 args")
-           ;; old behavior
-           (funcall fn (ivy-state-prompt ivy-last))))
-      ivy--prompt)))
-
-(defun ivy--insert-prompt ()
-  "Update the prompt according to `ivy--prompt'."
-  (when (setq ivy--prompt (ivy-prompt))
-    (unless (memq this-command '(ivy-done ivy-alt-done ivy-partial-or-done
-                                 counsel-find-symbol))
-      (setq ivy--prompt-extra ""))
-    (let (head tail)
-      (if (string-match "\\(.*\\): \\'" ivy--prompt)
-          (progn
-            (setq head (match-string 1 ivy--prompt))
-            (setq tail ": "))
-        (setq head (substring ivy--prompt 0 -1))
-        (setq tail " "))
-      (let ((inhibit-read-only t)
-            (std-props '(front-sticky t rear-nonsticky t field t read-only t))
-            (n-str
-             (concat
-              (if (and (bound-and-true-p minibuffer-depth-indicate-mode)
-                       (> (minibuffer-depth) 1))
-                  (format "[%d] " (minibuffer-depth))
-                "")
-              (concat
-               (if (string-match "%d.*%d" ivy-count-format)
-                   (format head
-                           (1+ ivy--index)
-                           (or (and (ivy-state-dynamic-collection ivy-last)
-                                    ivy--full-length)
-                               ivy--length))
-                 (format head
-                         (or (and (ivy-state-dynamic-collection ivy-last)
-                                  ivy--full-length)
-                             ivy--length)))
-               ivy--prompt-extra
-               tail)))
-            (d-str (if ivy--directory
-                       (abbreviate-file-name ivy--directory)
-                     "")))
-        (save-excursion
-          (goto-char (point-min))
-          (delete-region (point-min) (minibuffer-prompt-end))
-          (let ((len-n (length n-str))
-                (len-d (length d-str))
-                (ww (window-width)))
-            (setq n-str
-                  (cond ((> (+ len-n len-d) ww)
-                         (concat n-str "\n" d-str "\n"))
-                        ((> (+ len-n len-d (length ivy-text)) ww)
-                         (concat n-str d-str "\n"))
-                        (t
-                         (concat n-str d-str)))))
-          (when ivy-add-newline-after-prompt
-            (setq n-str (concat n-str "\n")))
-          (let ((regex (format "\\([^\n]\\{%d\\}\\)[^\n]" (window-width))))
-            (while (string-match regex n-str)
-              (setq n-str (replace-match
-                           (concat (match-string 1 n-str) "\n")
-                           nil t n-str 1))))
-          (set-text-properties 0 (length n-str)
-                               `(face minibuffer-prompt ,@std-props)
-                               n-str)
-          (setq n-str (funcall ivy-set-prompt-text-properties-function
-                               n-str std-props))
-          (insert n-str))
-        ;; get out of the prompt area
-        (constrain-to-field nil (point-max))))))
-
-(defun ivy--set-match-props (str match props &optional subexp)
-  "Set STR text properties for regexp group SUBEXP that match MATCH to PROPS.
-If SUBEXP is nil, the text properties are applied to the whole match."
-  (when (null subexp)
-    (setq subexp 0))
-  (when (string-match match str)
-    (set-text-properties
-     (match-beginning subexp)
-     (match-end subexp)
-     props
-     str)))
-
-(defvar inhibit-message)
-
-(defun ivy--sort-maybe (collection)
-  "Sort COLLECTION if needed."
-  (let ((sort (ivy-state-sort ivy-last)))
-    (if (null sort)
-        collection
-      (let ((sort-fn (or (and (functionp sort) sort)
-                         (ivy--sort-function (ivy-state-collection ivy-last))
-                         (ivy--sort-function t))))
-        (if (functionp sort-fn)
-            (cl-sort (copy-sequence collection) sort-fn)
-          collection)))))
-
-(defun ivy--magic-file-slash ()
-  (cond ((member ivy-text ivy--all-candidates)
-         (ivy--cd (expand-file-name ivy-text ivy--directory)))
-        ((string-match "//\\'" ivy-text)
-         (if (and default-directory
-                  (string-match "\\`[[:alpha:]]:/" default-directory))
-             (ivy--cd (match-string 0 default-directory))
-           (ivy--cd "/")))
-        ((string-match "\\`/ssh:" ivy-text)
-         (ivy--cd (file-name-directory ivy-text)))
-        ((string-match "[[:alpha:]]:/\\'" ivy-text)
-         (let ((drive-root (match-string 0 ivy-text)))
-           (when (file-exists-p drive-root)
-             (ivy--cd drive-root))))
-        ((and (file-exists-p ivy-text)
-              (not (string= ivy-text "/"))
-              (file-directory-p ivy-text))
-         (ivy--cd ivy-text))
-        ((and (or (> ivy--index 0)
-                  (= ivy--length 1)
-                  (not (string= ivy-text "/")))
-              (let ((default-directory ivy--directory))
-                (and
-                 (not (equal (ivy-state-current ivy-last) ""))
-                 (file-directory-p (ivy-state-current ivy-last))
-                 (file-exists-p (ivy-state-current ivy-last)))))
-         (ivy--cd
-          (expand-file-name (ivy-state-current ivy-last) ivy--directory)))))
-
-(defcustom ivy-magic-tilde t
-  "When non-nil, ~ will move home when selecting files.
-Otherwise, ~/ will move home."
-  :type 'boolean)
-
-(defun ivy--exhibit ()
-  "Insert Ivy completions display.
-Should be run via minibuffer `post-command-hook'."
-  (when (memq 'ivy--exhibit post-command-hook)
-    (let ((inhibit-field-text-motion nil))
-      (constrain-to-field nil (point-max)))
-    (setq ivy-text (ivy--input))
-    (if (ivy-state-dynamic-collection ivy-last)
-        ;; while-no-input would cause annoying
-        ;; "Waiting for process to die...done" message interruptions
-        (let ((inhibit-message t))
-          (unless (equal ivy--old-text ivy-text)
-            (while-no-input
-              (setq ivy--all-candidates
-                    (ivy--sort-maybe
-                     (funcall (ivy-state-collection ivy-last) ivy-text)))
-              (setq ivy--old-text ivy-text)))
-          (when ivy--all-candidates
-            (ivy--insert-minibuffer
-             (ivy--format ivy--all-candidates))))
-      (cond (ivy--directory
-             (cond ((or (string= "~/" ivy-text)
-                        (and (string= "~" ivy-text)
-                             ivy-magic-tilde))
-                    (ivy--cd (expand-file-name "~/")))
-                   ((string-match "/\\'" ivy-text)
-                    (ivy--magic-file-slash))))
-            ((eq (ivy-state-collection ivy-last) 'internal-complete-buffer)
-             (when (or (and (string-match "\\` " ivy-text)
-                            (not (string-match "\\` " ivy--old-text)))
-                       (and (string-match "\\` " ivy--old-text)
-                            (not (string-match "\\` " ivy-text))))
-               (setq ivy--all-candidates
-                     (if (and (> (length ivy-text) 0)
-                              (eq (aref ivy-text 0)
-                                  ?\ ))
-                         (ivy--buffer-list " ")
-                       (ivy--buffer-list "" ivy-use-virtual-buffers)))
-               (setq ivy--old-re nil))))
-      (ivy--insert-minibuffer
-       (with-current-buffer (ivy-state-buffer ivy-last)
-         (ivy--format
-          (ivy--filter ivy-text ivy--all-candidates))))
-      (setq ivy--old-text ivy-text))))
-
-(defun ivy--insert-minibuffer (text)
-  "Insert TEXT into minibuffer with appropriate cleanup."
-  (let ((resize-mini-windows nil)
-        (update-fn (ivy-state-update-fn ivy-last))
-        (old-mark (marker-position (mark-marker)))
-        deactivate-mark)
-    (ivy--cleanup)
-    (when update-fn
-      (funcall update-fn))
-    (ivy--insert-prompt)
-    ;; Do nothing if while-no-input was aborted.
-    (when (stringp text)
-      (if ivy-display-function
-          (funcall ivy-display-function text)
-        (let ((buffer-undo-list t))
-          (save-excursion
-            (forward-line 1)
-            (insert text)))))
-    (when (display-graphic-p)
-      (ivy--resize-minibuffer-to-fit))
-    ;; prevent region growing due to text remove/add
-    (when (region-active-p)
-      (set-mark old-mark))))
-
-(defun ivy--resize-minibuffer-to-fit ()
-  "Resize the minibuffer window size to fit the text in the minibuffer."
-  (unless (frame-root-window-p (minibuffer-window))
-    (with-selected-window (minibuffer-window)
-      (if (fboundp 'window-text-pixel-size)
-          (let ((text-height (cdr (window-text-pixel-size)))
-                (body-height (window-body-height nil t)))
-            (when (> text-height body-height)
-              ;; Note: the size increment needs to be at least
-              ;; frame-char-height, otherwise resizing won't do
-              ;; anything.
-              (let ((delta (max (- text-height body-height)
-                                (frame-char-height))))
-                (window-resize nil delta nil t t))))
-        (let ((text-height (count-screen-lines))
-              (body-height (window-body-height)))
-          (when (> text-height body-height)
-            (window-resize nil (- text-height body-height) nil t)))))))
-
-(declare-function colir-blend-face-background "ext:colir")
-
-(defun ivy--add-face (str face)
-  "Propertize STR with FACE.
-`font-lock-append-text-property' is used, since it's better than
-`propertize' or `add-face-text-property' in this case."
-  (require 'colir)
-  (condition-case nil
-      (progn
-        (colir-blend-face-background 0 (length str) face str)
-        (let ((foreground (face-foreground face)))
-          (when foreground
-            (add-face-text-property
-             0 (length str)
-             `(:foreground ,foreground)
-             nil
-             str))))
-    (error
-     (ignore-errors
-       (font-lock-append-text-property 0 (length str) 'face face str))))
-  str)
-
-(declare-function flx-make-string-cache "ext:flx")
-(declare-function flx-score "ext:flx")
-
-(defvar ivy--flx-cache nil)
-
-(eval-after-load 'flx
-  '(setq ivy--flx-cache (flx-make-string-cache)))
-
-(defun ivy-toggle-case-fold ()
-  "Toggle the case folding between nil and auto/always.
-
-If auto, `case-fold-search' is t, when the input is all lower case,
-otherwise nil.
-
-If always, `case-fold-search' is always t, regardless of the input.
-
-Otherwise `case-fold-search' is always nil, regardless of the input.
-
-In any completion session, the case folding starts in
-`ivy-case-fold-search-default'."
-  (interactive)
-  (setq ivy-case-fold-search
-        (if ivy-case-fold-search
-            nil
-          (or ivy-case-fold-search-default 'auto)))
-  ;; reset cache so that the candidate list updates
-  (setq ivy--old-re nil))
-
-(defun ivy--re-filter (re candidates)
-  "Return all RE matching CANDIDATES.
-RE is a list of cons cells, with a regexp car and a boolean cdr.
-When the cdr is t, the car must match.
-Otherwise, the car must not match."
-  (let ((re-list (if (stringp re) (list (cons re t)) re))
-        (res candidates))
-    (dolist (re re-list)
-      (setq res
-            (ignore-errors
-              (funcall
-               (if (cdr re)
-                   #'cl-remove-if-not
-                 #'cl-remove-if)
-               (let ((re-str (car re)))
-                 (lambda (x) (string-match re-str x)))
-               res))))
-    res))
-
-(defun ivy--filter (name candidates)
-  "Return all items that match NAME in CANDIDATES.
-CANDIDATES are assumed to be static."
-  (let ((re (funcall ivy--regex-function name)))
-    (if (and (equal re ivy--old-re)
-             ivy--old-cands)
-        ;; quick caching for "C-n", "C-p" etc.
-        ivy--old-cands
-      (let* ((re-str (if (listp re) (caar re) re))
-             (matcher (ivy-state-matcher ivy-last))
-             (case-fold-search
-              (and ivy-case-fold-search
-                   (or (eq ivy-case-fold-search 'always)
-                       (string= name (downcase name)))))
-             (cands (cond
-                      (matcher
-                       (funcall matcher re candidates))
-                      ((and ivy--old-re
-                            (stringp re)
-                            (stringp ivy--old-re)
-                            (not (string-match "\\\\" ivy--old-re))
-                            (not (equal ivy--old-re ""))
-                            (memq (cl-search
-                                   (if (string-match "\\\\)\\'" ivy--old-re)
-                                       (substring ivy--old-re 0 -2)
-                                     ivy--old-re)
-                                   re)
-                                  '(0 2)))
-                       (ignore-errors
-                         (cl-remove-if-not
-                          (lambda (x) (string-match re x))
-                          ivy--old-cands)))
-                      (t
-                       (ivy--re-filter re candidates)))))
-        (if (memq (cdr (assoc (ivy-state-caller ivy-last)
-                              ivy-index-functions-alist))
-                  '(ivy-recompute-index-swiper
-                    ivy-recompute-index-swiper-async))
-            (progn
-              (ivy--recompute-index name re-str cands)
-              (setq ivy--old-cands (ivy--sort name cands)))
-          (setq ivy--old-cands (ivy--sort name cands))
-          (ivy--recompute-index name re-str ivy--old-cands))
-        (setq ivy--old-re
-              (if (eq ivy--highlight-function 'ivy--highlight-ignore-order)
-                  re
-                (if ivy--old-cands
-                    re-str
-                  "")))
-        ivy--old-cands))))
-
-(defun ivy--set-candidates (x)
-  "Update `ivy--all-candidates' with X."
-  (let (res)
-    (dolist (source ivy--extra-candidates)
-      (if (equal source '(original-source))
-          (if (null res)
-              (setq res x)
-            (setq res (append x res)))
-        (setq ivy--old-re nil)
-        (setq res (append
-                   (ivy--filter ivy-text (cadr source))
-                   res))))
-    (setq ivy--all-candidates res)))
-
-(defcustom ivy-sort-matches-functions-alist
-  '((t . nil)
-    (ivy-switch-buffer . ivy-sort-function-buffer))
-  "An alist of functions for sorting matching candidates.
-
-Unlike `ivy-sort-functions-alist', which is used to sort the
-whole collection only once, this alist of functions are used to
-sort only matching candidates after each change in input.
-
-The alist KEY is either a collection function or t to match
-previously unmatched collection functions.
-
-The alist VAL is a sorting function with the signature of
-`ivy--prefix-sort'."
-  :type '(alist
-          :key-type (choice
-                     (const :tag "Fall-through" t)
-                     (symbol :tag "Collection"))
-          :value-type
-          (choice
-           (const :tag "Don't sort" nil)
-           (const :tag "Put prefix matches ahead" 'ivy--prefix-sort)
-           (function :tag "Custom sort function"))))
-
-(defun ivy--sort-files-by-date (_name candidates)
-  "Re-sort CANDIDATES according to file modification date."
-  (let ((default-directory ivy--directory))
-    (cl-sort (copy-sequence candidates)
-             (lambda (f1 f2)
-               (time-less-p
-                (nth 5 (file-attributes f2))
-                (nth 5 (file-attributes f1)))))))
-
-(defvar ivy--flx-featurep (require 'flx nil 'noerror))
-
-(defun ivy--sort (name candidates)
-  "Re-sort CANDIDATES by NAME.
-All CANDIDATES are assumed to match NAME."
-  (let ((key (or (ivy-state-caller ivy-last)
-                 (when (functionp (ivy-state-collection ivy-last))
-                   (ivy-state-collection ivy-last))))
-        fun)
-    (cond ((and ivy--flx-featurep
-                (eq ivy--regex-function 'ivy--regex-fuzzy))
-           (ivy--flx-sort name candidates))
-          ((setq fun (cdr (or (assoc key ivy-sort-matches-functions-alist)
-                              (assoc t ivy-sort-matches-functions-alist))))
-           (funcall fun name candidates))
-          (t
-           candidates))))
-
-(defun ivy--prefix-sort (name candidates)
-  "Re-sort CANDIDATES.
-Prefix matches to NAME are put ahead of the list."
-  (if (or (string-match "^\\^" name) (string= name ""))
-      candidates
-    (let ((re-prefix (concat "^" (funcall ivy--regex-function name)))
-          res-prefix
-          res-noprefix)
-      (dolist (s candidates)
-        (if (string-match re-prefix s)
-            (push s res-prefix)
-          (push s res-noprefix)))
-      (nconc
-       (nreverse res-prefix)
-       (nreverse res-noprefix)))))
-
-(defvar ivy--virtual-buffers nil
-  "Store the virtual buffers alist.")
-
-(defun ivy-sort-function-buffer (name candidates)
-  "Re-sort CANDIDATES, a list of buffer names that contain NAME.
-Sort open buffers before virtual buffers, and prefix matches
-before substring matches."
-  (if (or (string-match "^\\^" name) (string= name ""))
-      candidates
-    (let* ((base-re (funcall ivy--regex-function name))
-           (base-re (if (consp base-re) (caar base-re) base-re))
-           (re-prefix (concat "^\\*" base-re))
-           res-prefix
-           res-noprefix
-           res-virtual-prefix
-           res-virtual-noprefix)
-      (unless (cl-find-if (lambda (s) (string-match re-prefix s)) candidates)
-        (setq re-prefix (concat "^" base-re)))
-      (dolist (s candidates)
-        (cond
-          ((and (assoc s ivy--virtual-buffers) (string-match re-prefix s))
-           (push s res-virtual-prefix))
-          ((assoc s ivy--virtual-buffers)
-           (push s res-virtual-noprefix))
-          ((string-match re-prefix s)
-           (push s res-prefix))
-          (t
-           (push s res-noprefix))))
-      (nconc
-       (nreverse res-prefix)
-       (nreverse res-noprefix)
-       (nreverse res-virtual-prefix)
-       (nreverse res-virtual-noprefix)))))
-
-(defun ivy--recompute-index (name re-str cands)
-  (let* ((caller (ivy-state-caller ivy-last))
-         (func (or (and caller (cdr (assoc caller ivy-index-functions-alist)))
-                   (cdr (assoc t ivy-index-functions-alist))
-                   #'ivy-recompute-index-zero)))
-    (unless (eq this-command 'ivy-resume)
-      (ivy-set-index
-       (or
-        (cl-position (if (and (> (length name) 0)
-                              (eq ?^ (aref name 0)))
-                         (substring name 1)
-                       name) cands
-                       :test #'equal)
-        (and ivy--directory
-             (cl-position
-              (concat re-str "/") cands
-              :test #'equal))
-        (and (eq caller 'ivy-switch-buffer)
-             (> (length name) 0)
-             0)
-        (and (not (string= name ""))
-             (not (and ivy--flx-featurep
-                       (eq ivy--regex-function 'ivy--regex-fuzzy)
-                       (< (length cands) 200)))
-             ivy--old-cands
-             (cl-position (nth ivy--index ivy--old-cands)
-                          cands))
-        (funcall func re-str cands))))
-    (when (or (string= name "")
-              (string= name "^"))
-      (ivy-set-index
-       (or (ivy--preselect-index
-            (ivy-state-preselect ivy-last)
-            cands)
-           ivy--index)))))
-
-(defun ivy-recompute-index-swiper (_re-str cands)
-  (condition-case nil
-      (let ((tail (nthcdr ivy--index ivy--old-cands))
-            idx)
-        (if (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
-            (progn
-              (while (and tail (null idx))
-                ;; Compare with eq to handle equal duplicates in cands
-                (setq idx (cl-position (pop tail) cands)))
-              (or
-               idx
-               (1- (length cands))))
-          (if ivy--old-cands
-              ivy--index
-            ;; already in ivy-state-buffer
-            (let ((n (line-number-at-pos))
-                  (res 0)
-                  (i 0))
-              (dolist (c cands)
-                (when (eq n (read (get-text-property 0 'swiper-line-number c)))
-                  (setq res i))
-                (cl-incf i))
-              res))))
-    (error 0)))
-
-(defun ivy-recompute-index-swiper-async (_re-str cands)
-  (if (null ivy--old-cands)
-      (let ((ln (with-ivy-window
-                  (line-number-at-pos))))
-        (or
-         ;; closest to current line going forwards
-         (cl-position-if (lambda (x)
-                           (>= (string-to-number x) ln))
-                         cands)
-         ;; closest to current line going backwards
-         (1- (length cands))))
-    (let ((tail (nthcdr ivy--index ivy--old-cands))
-          idx)
-      (if (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
-          (progn
-            (while (and tail (null idx))
-              ;; Compare with `equal', since the collection is re-created
-              ;; each time with `split-string'
-              (setq idx (cl-position (pop tail) cands :test #'equal)))
-            (or idx 0))
-        ivy--index))))
-
-(defun ivy-recompute-index-zero (_re-str _cands)
-  0)
-
-(defcustom ivy-minibuffer-faces
-  '(ivy-minibuffer-match-face-1
-    ivy-minibuffer-match-face-2
-    ivy-minibuffer-match-face-3
-    ivy-minibuffer-match-face-4)
-  "List of `ivy' faces for minibuffer group matches."
-  :type '(repeat :tag "Faces"
-          (choice
-           (const ivy-minibuffer-match-face-1)
-           (const ivy-minibuffer-match-face-2)
-           (const ivy-minibuffer-match-face-3)
-           (const ivy-minibuffer-match-face-4)
-           (face :tag "Other face"))))
-
-(defvar ivy-flx-limit 200
-  "Used to conditionally turn off flx sorting.
-
-When the amount of matching candidates exceeds this limit, then
-no sorting is done.")
-
-(defun ivy--flx-propertize (x)
-  "X is (cons (flx-score STR ...) STR)."
-  (let ((str (copy-sequence (cdr x)))
-        (i 0)
-        (last-j -2))
-    (dolist (j (cdar x))
-      (unless (eq j (1+ last-j))
-        (cl-incf i))
-      (setq last-j j)
-      (ivy-add-face-text-property
-       j (1+ j)
-       (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
-            ivy-minibuffer-faces)
-       str))
-    str))
-
-(defun ivy--flx-sort (name cands)
-  "Sort according to closeness to string NAME the string list CANDS."
-  (condition-case nil
-      (let* (
-             ;; an optimized regex for fuzzy matching
-             ;; "abc" → "\\`[^a]*a[^b]*b[^c]*c"
-             (fuzzy-regex (if (= (elt name 0) ?^)
-                              (concat "^"
-                                      (regexp-quote (substring name 1 2))
-                                      (mapconcat
-                                       (lambda (x)
-                                         (setq x (string x))
-                                         (concat "[^" x "]*" (regexp-quote x)))
-                                       (substring name 2)
-                                       ""))
-                            (concat "^"
-                                    (mapconcat
-                                     (lambda (x)
-                                       (setq x (string x))
-                                       (concat "[^" x "]*" (regexp-quote x)))
-                                     name
-                                     ""))))
-
-             ;; strip off the leading "^" for flx matching
-             (flx-name (if (string-match "^\\^" name)
-                           (substring name 1)
-                         name))
-
-             (cands-left)
-             (cands-to-sort))
-
-        ;; filter out non-matching candidates
-        (dolist (cand cands)
-          (when (string-match fuzzy-regex cand)
-            (push cand cands-left)))
-
-        ;; pre-sort the candidates by length before partitioning
-        (setq cands-left (sort cands-left
-                               (lambda (c1 c2)
-                                 (< (length c1)
-                                    (length c2)))))
-
-        ;; partition the candidates into sorted and unsorted groups
-        (dotimes (_n (min (length cands-left) ivy-flx-limit))
-          (push (pop cands-left) cands-to-sort))
-
-        (append
-         ;; compute all of the flx scores in one pass and sort
-         (mapcar #'car
-                 (sort (mapcar
-                        (lambda (cand)
-                          (cons cand
-                                (car (flx-score cand
-                                                flx-name
-                                                ivy--flx-cache))))
-                        cands-to-sort)
-                       (lambda (c1 c2)
-                         ;; break ties by length
-                         (if (/= (cdr c1) (cdr c2))
-                             (> (cdr c1)
-                                (cdr c2))
-                           (< (length (car c1))
-                              (length (car c2)))))))
-
-         ;; add the unsorted candidates
-         cands-left))
-    (error
-     cands)))
-
-(defcustom ivy-format-function 'ivy-format-function-default
-  "Function to transform the list of candidates into a string.
-This string is inserted into the minibuffer."
-  :type '(choice
-          (const :tag "Default" ivy-format-function-default)
-          (const :tag "Arrow prefix" ivy-format-function-arrow)
-          (const :tag "Full line" ivy-format-function-line)))
-
-(defun ivy--truncate-string (str width)
-  "Truncate STR to WIDTH."
-  (if (> (string-width str) width)
-      (concat (substring str 0 (min (- width 3)
-                                    (- (length str) 3))) "...")
-    str))
-
-(defun ivy--format-function-generic (selected-fn other-fn strs separator)
-  "Transform CAND-PAIRS into a string for minibuffer.
-SELECTED-FN and OTHER-FN each take one string argument.
-SEPARATOR is used to join the candidates."
-  (let ((i -1))
-    (mapconcat
-     (lambda (str)
-       (let ((curr (eq (cl-incf i) ivy--index)))
-         (if curr
-             (funcall selected-fn str)
-           (funcall other-fn str))))
-     strs
-     separator)))
-
-(defun ivy-format-function-default (cands)
-  "Transform CAND-PAIRS into a string for minibuffer."
-  (ivy--format-function-generic
-   (lambda (str)
-     (ivy--add-face str 'ivy-current-match))
-   #'identity
-   cands
-   "\n"))
-
-(defun ivy-format-function-arrow (cands)
-  "Transform CAND-PAIRS into a string for minibuffer."
-  (ivy--format-function-generic
-   (lambda (str)
-     (concat "> " (ivy--add-face str 'ivy-current-match)))
-   (lambda (str)
-     (concat "  " str))
-   cands
-   "\n"))
-
-(defun ivy-format-function-line (cands)
-  "Transform CAND-PAIRS into a string for minibuffer."
-  (ivy--format-function-generic
-   (lambda (str)
-     (ivy--add-face (concat str "\n") 'ivy-current-match))
-   (lambda (str)
-     (concat str "\n"))
-   cands
-   ""))
-
-(defun ivy-add-face-text-property (start end face str)
-  (if (fboundp 'add-face-text-property)
-      (add-face-text-property
-       start end face nil str)
-    (font-lock-append-text-property
-     start end 'face face str)))
-
-(defun ivy--highlight-ignore-order (str)
-  "Highlight STR, using the ignore-order method."
-  (when (consp ivy--old-re)
-    (let ((i 1))
-      (dolist (re ivy--old-re)
-        (when (string-match (car re) str)
-          (ivy-add-face-text-property
-           (match-beginning 0) (match-end 0)
-           (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
-                ivy-minibuffer-faces)
-           str))
-        (cl-incf i))))
-  str)
-
-(defun ivy--highlight-fuzzy (str)
-  "Highlight STR, using the fuzzy method."
-  (if ivy--flx-featurep
-      (let ((flx-name (if (string-match "^\\^" ivy-text)
-                          (substring ivy-text 1)
-                        ivy-text)))
-        (ivy--flx-propertize
-         (cons (flx-score str flx-name ivy--flx-cache) str)))
-    (ivy--highlight-default str)))
-
-(defun ivy--highlight-default (str)
-  "Highlight STR, using the default method."
-  (unless ivy--old-re
-    (setq ivy--old-re (funcall ivy--regex-function ivy-text)))
-  (let ((start
-         (if (and (memq (ivy-state-caller ivy-last)
-                        '(counsel-git-grep counsel-ag counsel-rg counsel-pt))
-                  (string-match "^[^:]+:[^:]+:" str))
-             (match-end 0)
-           0)))
-    (ignore-errors
-      (while (and (string-match ivy--old-re str start)
-                  (> (- (match-end 0) (match-beginning 0)) 0))
-        (setq start (match-end 0))
-        (let ((i 0))
-          (while (<= i ivy--subexps)
-            (let ((face
-                   (cond ((zerop ivy--subexps)
-                          (cadr ivy-minibuffer-faces))
-                         ((zerop i)
-                          (car ivy-minibuffer-faces))
-                         (t
-                          (nth (1+ (mod (+ i 2)
-                                        (1- (length ivy-minibuffer-faces))))
-                               ivy-minibuffer-faces)))))
-              (ivy-add-face-text-property
-               (match-beginning i) (match-end i)
-               face str))
-            (cl-incf i))))))
-  str)
-
-(defun ivy--format-minibuffer-line (str)
-  (if (eq ivy-display-style 'fancy)
-      (funcall ivy--highlight-function (copy-sequence str))
-    (copy-sequence str)))
-
-(ivy-set-display-transformer
- 'counsel-find-file 'ivy-read-file-transformer)
-(ivy-set-display-transformer
- 'read-file-name-internal 'ivy-read-file-transformer)
-
-(defun ivy-read-file-transformer (str)
-  (if (string-match-p "/\\'" str)
-      (propertize str 'face 'ivy-subdir)
-    str))
-
-(defun ivy--format (cands)
-  "Return a string for CANDS suitable for display in the minibuffer.
-CANDS is a list of strings."
-  (setq ivy--length (length cands))
-  (when (>= ivy--index ivy--length)
-    (ivy-set-index (max (1- ivy--length) 0)))
-  (if (null cands)
-      (setf (ivy-state-current ivy-last) "")
-    (let* ((half-height (/ ivy-height 2))
-           (start (max 0 (- ivy--index half-height)))
-           (end (min (+ start (1- ivy-height)) ivy--length))
-           (start (max 0 (min start (- end (1- ivy-height)))))
-           (cands (cl-subseq cands start end))
-           (index (- ivy--index start))
-           transformer-fn)
-      (setf (ivy-state-current ivy-last) (copy-sequence (nth index cands)))
-      (when (setq transformer-fn (ivy-state-display-transformer-fn ivy-last))
-        (with-ivy-window
-          (setq cands (mapcar transformer-fn cands))))
-      (let* ((ivy--index index)
-             (cands (mapcar
-                     #'ivy--format-minibuffer-line
-                     cands))
-             (res (concat "\n" (funcall ivy-format-function cands))))
-        (put-text-property 0 (length res) 'read-only nil res)
-        res))))
-
-(defvar recentf-list)
-
-(defcustom ivy-virtual-abbreviate 'name
-  "The mode of abbreviation for virtual buffer names."
-  :type '(choice
-          (const :tag "Only name" name)
-          (const :tag "Full path" full)
-          ;; eventually, uniquify
-          ))
-
-(defun ivy--virtual-buffers ()
-  "Adapted from `ido-add-virtual-buffers-to-list'."
-  (unless recentf-mode
-    (recentf-mode 1))
-  (let ((bookmarks (and (boundp 'bookmark-alist)
-                        (copy-sequence bookmark-alist)))
-        virtual-buffers)
-    (dolist (head (append
-                   (copy-sequence recentf-list)
-                   (delq nil (mapcar
-                              (lambda (bookmark)
-                                (let (file)
-                                  (when (setq file (assoc 'filename bookmark))
-                                    (unless (string= (cdr file)
-                                                     "   - no file -")
-                                      (cons (car bookmark)
-                                            (cdr file))))))
-                              bookmarks))))
-      (let ((file-name (if (stringp head)
-                           head
-                         (cdr head)))
-            name)
-        (setq name
-              (if (eq ivy-virtual-abbreviate 'name)
-                  (file-name-nondirectory file-name)
-                (expand-file-name file-name)))
-        (when (equal name "")
-          (if (consp head)
-              (setq name (car head))
-            (setq name (file-name-nondirectory
-                        (directory-file-name file-name)))))
-        (and (not (equal name ""))
-             (null (get-file-buffer file-name))
-             (not (assoc name virtual-buffers))
-             (push (cons name file-name) virtual-buffers))))
-    (when virtual-buffers
-      (dolist (comp virtual-buffers)
-        (put-text-property 0 (length (car comp))
-                           'face 'ivy-virtual
-                           (car comp)))
-      (setq ivy--virtual-buffers (nreverse virtual-buffers))
-      (mapcar #'car ivy--virtual-buffers))))
-
-(defcustom ivy-ignore-buffers '("\\` ")
-  "List of regexps or functions matching buffer names to ignore."
-  :type '(repeat (choice regexp function)))
-
-(defvar ivy-switch-buffer-faces-alist '((dired-mode . ivy-subdir)
-                                        (org-mode . org-level-4))
-  "Store face customizations for `ivy-switch-buffer'.
-Each KEY is `major-mode', each VALUE is a face name.")
-
-(defun ivy--buffer-list (str &optional virtual predicate)
-  "Return the buffers that match STR.
-When VIRTUAL is non-nil, add virtual buffers."
-  (delete-dups
-   (append
-    (mapcar
-     (lambda (x)
-       (if (with-current-buffer x
-             (and default-directory
-                  (file-remote-p
-                   (abbreviate-file-name default-directory))))
-           (propertize x 'face 'ivy-remote)
-         (let ((face (with-current-buffer x
-                       (cdr (assoc major-mode
-                                   ivy-switch-buffer-faces-alist)))))
-           (if face
-               (propertize x 'face face)
-             x))))
-     (all-completions str 'internal-complete-buffer predicate))
-    (and virtual
-         (ivy--virtual-buffers)))))
-
-(defvar ivy-views (and nil
-                       `(("ivy + *scratch* {}"
-                          (vert
-                           (file ,(expand-file-name "ivy.el"))
-                           (buffer "*scratch*")))
-                         ("swiper + *scratch* {}"
-                          (horz
-                           (file ,(expand-file-name "swiper.el"))
-                           (buffer "*scratch*")))))
-  "Store window configurations selectable by `ivy-switch-buffer'.
-
-The default value is given as an example.
-
-Each element is a list of (NAME TREE). NAME is a string, it's
-recommended to end it with a distinctive snippet e.g. \"{}\" so
-that it's easy to distinguish the window configurations.
-
-TREE is a nested list with the following valid cars:
-- vert: split the window vertically
-- horz: split the window horizontally
-- file: open the specified file
-- buffer: open the specified buffer
-
-TREE can be nested multiple times to have mulitple window splits.")
-
-(defun ivy-default-view-name ()
-  (let* ((default-view-name
-          (concat "{} "
-                  (mapconcat #'identity
-                             (cl-sort
-                              (mapcar (lambda (w)
-                                        (with-current-buffer (window-buffer w)
-                                          (if (buffer-file-name)
-                                              (file-name-nondirectory
-                                               (buffer-file-name))
-                                            (buffer-name))))
-                                      (window-list))
-                              #'string<)
-                             " ")))
-         (view-name-re (concat "\\`"
-                               (regexp-quote default-view-name)
-                               " \\([0-9]+\\)"))
-         old-view)
-    (cond ((setq old-view
-                 (cl-find-if
-                  (lambda (x)
-                    (string-match view-name-re (car x)))
-                  ivy-views))
-           (format "%s %d"
-                   default-view-name
-                   (1+ (string-to-number
-                        (match-string 1 (car old-view))))))
-          ((assoc default-view-name ivy-views)
-           (concat default-view-name " 1"))
-          (t
-           default-view-name))))
-
-(defun ivy-push-view ()
-  "Push the current window tree on `ivy-views'.
-Currently, the split configuration (i.e. horizonal or vertical)
-and point positions are saved, but the split positions aren't.
-Use `ivy-pop-view' to delete any item from `ivy-views'."
-  (interactive)
-  (let* ((view (cl-labels
-                   ((ft (tr)
-                      (if (consp tr)
-                          (if (eq (car tr) t)
-                              (cons 'vert
-                                    (mapcar #'ft (cddr tr)))
-                            (cons 'horz
-                                  (mapcar #'ft (cddr tr))))
-                        (with-current-buffer (window-buffer tr)
-                          (cond ((buffer-file-name)
-                                 (list 'file (buffer-file-name) (point)))
-                                ((eq major-mode 'dired-mode)
-                                 (list 'file default-directory (point)))
-                                (t
-                                 (list 'buffer (buffer-name) (point))))))))
-                 (ft (car (window-tree)))))
-         (view-name (ivy-read "Name view: " nil
-                              :initial-input (ivy-default-view-name))))
-    (when view-name
-      (push (list view-name view) ivy-views))))
-
-(defun ivy-pop-view-action (view)
-  "Delete VIEW from `ivy-views'."
-  (setq ivy-views (delete view ivy-views))
-  (setq ivy--all-candidates
-        (delete (car view) ivy--all-candidates))
-  (setq ivy--old-cands nil))
-
-(defun ivy-pop-view ()
-  "Delete a view to delete from `ivy-views'."
-  (interactive)
-  (ivy-read "Pop view: " ivy-views
-            :preselect (caar ivy-views)
-            :action #'ivy-pop-view-action
-            :caller 'ivy-pop-view))
-
-(defun ivy-source-views ()
-  (mapcar #'car ivy-views))
-
-(ivy-set-sources
- 'ivy-switch-buffer
- '((original-source)
-   (ivy-source-views)))
-
-(defun ivy-set-view-recur (view)
-  (cond ((eq (car view) 'vert)
-         (let* ((wnd1 (selected-window))
-                (wnd2 (split-window-vertically))
-                (views (cdr view))
-                (v (pop views)))
-           (with-selected-window wnd1
-             (ivy-set-view-recur v))
-           (while (setq v (pop views))
-             (with-selected-window wnd2
-               (ivy-set-view-recur v))
-             (when views
-               (setq wnd2 (split-window-vertically))))))
-        ((eq (car view) 'horz)
-         (let* ((wnd1 (selected-window))
-                (wnd2 (split-window-horizontally))
-                (views (cdr view))
-                (v (pop views)))
-           (with-selected-window wnd1
-             (ivy-set-view-recur v))
-           (while (setq v (pop views))
-             (with-selected-window wnd2
-               (ivy-set-view-recur v))
-             (when views
-               (setq wnd2 (split-window-horizontally))))))
-        ((eq (car view) 'file)
-         (let* ((name (nth 1 view))
-                (virtual (assoc name ivy--virtual-buffers))
-                buffer)
-           (cond ((setq buffer (get-buffer name))
-                  (switch-to-buffer buffer nil 'force-same-window))
-                 (virtual
-                  (find-file (cdr virtual)))
-                 ((file-exists-p name)
-                  (find-file name))))
-         (when (and (> (length view) 2)
-                    (numberp (nth 2 view)))
-           (goto-char (nth 2 view))))
-        ((eq (car view) 'buffer)
-         (switch-to-buffer (nth 1 view))
-         (when (and (> (length view) 2)
-                    (numberp (nth 2 view)))
-           (goto-char (nth 2 view))))
-        ((eq (car view) 'sexp)
-         (eval (nth 1 view)))))
-
-(defun ivy--switch-buffer-action (buffer)
-  "Switch to BUFFER.
-BUFFER may be a string or nil."
-  (with-ivy-window
-    (if (zerop (length buffer))
-        (switch-to-buffer
-         ivy-text nil 'force-same-window)
-      (let ((virtual (assoc buffer ivy--virtual-buffers))
-            (view (assoc buffer ivy-views)))
-        (cond ((and virtual
-                    (not (get-buffer buffer)))
-               (find-file (cdr virtual)))
-              (view
-               (delete-other-windows)
-               (let (
-                     ;; silence "Directory has changed on disk"
-                     (inhibit-message t))
-                 (ivy-set-view-recur (cadr view))))
-              (t
-               (switch-to-buffer
-                buffer nil 'force-same-window)))))))
-
-(defun ivy--switch-buffer-other-window-action (buffer)
-  "Switch to BUFFER in other window.
-BUFFER may be a string or nil."
-  (if (zerop (length buffer))
-      (switch-to-buffer-other-window ivy-text)
-    (let ((virtual (assoc buffer ivy--virtual-buffers)))
-      (if (and virtual
-               (not (get-buffer buffer)))
-          (find-file-other-window (cdr virtual))
-        (switch-to-buffer-other-window buffer)))))
-
-(defun ivy--rename-buffer-action (buffer)
-  "Rename BUFFER."
-  (let ((new-name (read-string "Rename buffer (to new name): ")))
-    (with-current-buffer buffer
-      (rename-buffer new-name))))
-
-(defvar ivy-switch-buffer-map (make-sparse-keymap))
-
-(ivy-set-actions
- 'ivy-switch-buffer
- '(("k"
-    (lambda (x)
-      (kill-buffer x)
-      (ivy--reset-state ivy-last))
-    "kill")
-   ("j"
-    ivy--switch-buffer-other-window-action
-    "other window")
-   ("r"
-    ivy--rename-buffer-action
-    "rename")))
-
-(defun ivy--switch-buffer-matcher (regexp candidates)
-  "Return REGEXP-matching CANDIDATES.
-Skip buffers that match `ivy-ignore-buffers'."
-  (let ((res (ivy--re-filter regexp candidates)))
-    (if (or (null ivy-use-ignore)
-            (null ivy-ignore-buffers))
-        res
-      (or (cl-remove-if
-           (lambda (buf)
-             (cl-find-if
-              (lambda (f-or-r)
-                (if (functionp f-or-r)
-                    (funcall f-or-r buf)
-                  (string-match-p f-or-r buf)))
-              ivy-ignore-buffers))
-           res)
-          (and (eq ivy-use-ignore t)
-               res)))))
-
-(ivy-set-display-transformer
- 'ivy-switch-buffer 'ivy-switch-buffer-transformer)
-(ivy-set-display-transformer
- 'internal-complete-buffer 'ivy-switch-buffer-transformer)
-
-(defun ivy-switch-buffer-transformer (str)
-  (let ((b (get-buffer str)))
-    (if (and b
-             (buffer-file-name b)
-             (buffer-modified-p b))
-        (propertize str 'face 'ivy-modified-buffer)
-      str)))
-
-(defun ivy-switch-buffer-occur ()
-  "Occur function for `ivy-switch-buffer' that uses `ibuffer'."
-  (let* ((cand-regexp
-          (concat "\\(" (mapconcat #'regexp-quote ivy--old-cands "\\|") "\\)"))
-         (new-qualifier `((name . ,cand-regexp))))
-    (ibuffer nil (buffer-name) new-qualifier)))
-
-;;;###autoload
-(defun ivy-switch-buffer ()
-  "Switch to another buffer."
-  (interactive)
-  (let ((this-command 'ivy-switch-buffer))
-    (ivy-read "Switch to buffer: " 'internal-complete-buffer
-              :matcher #'ivy--switch-buffer-matcher
-              :preselect (buffer-name (other-buffer (current-buffer)))
-              :action #'ivy--switch-buffer-action
-              :keymap ivy-switch-buffer-map
-              :caller 'ivy-switch-buffer)))
-
-;;;###autoload
-(defun ivy-switch-buffer-other-window ()
-  "Switch to another buffer in another window."
-  (interactive)
-  (ivy-read "Switch to buffer in other window: " 'internal-complete-buffer
-            :matcher #'ivy--switch-buffer-matcher
-            :preselect (buffer-name (other-buffer (current-buffer)))
-            :action #'ivy--switch-buffer-other-window-action
-            :keymap ivy-switch-buffer-map
-            :caller 'ivy-switch-buffer-other-window))
-
-(define-obsolete-function-alias 'ivy-recentf 'counsel-recentf "0.8.0")
-
-(defun ivy-yank-word ()
-  "Pull next word from buffer into search string."
-  (interactive)
-  (let (amend)
-    (with-ivy-window
-      (let ((pt (point))
-            (le (line-end-position)))
-        (forward-word 1)
-        (if (> (point) le)
-            (goto-char pt)
-          (setq amend (buffer-substring-no-properties pt (point))))))
-    (when amend
-      (insert (replace-regexp-in-string "  +" " " amend)))))
-
-(defun ivy-kill-ring-save ()
-  "Store the current candidates into the kill ring.
-If the region is active, forward to `kill-ring-save' instead."
-  (interactive)
-  (if (region-active-p)
-      (call-interactively 'kill-ring-save)
-    (kill-new
-     (mapconcat
-      #'identity
-      ivy--old-cands
-      "\n"))))
-
-(defun ivy-insert-current ()
-  "Make the current candidate into current input.
-Don't finish completion."
-  (interactive)
-  (delete-minibuffer-contents)
-  (if (and ivy--directory
-           (string-match "/$" (ivy-state-current ivy-last)))
-      (insert (substring (ivy-state-current ivy-last) 0 -1))
-    (insert (ivy-state-current ivy-last))))
-
-(defun ivy-toggle-fuzzy ()
-  "Toggle the re builder between `ivy--regex-fuzzy' and `ivy--regex-plus'."
-  (interactive)
-  (setq ivy--old-re nil)
-  (if (eq ivy--regex-function 'ivy--regex-fuzzy)
-      (setq ivy--regex-function 'ivy--regex-plus)
-    (setq ivy--regex-function 'ivy--regex-fuzzy)))
-
-(defun ivy-reverse-i-search ()
-  "Enter a recursive `ivy-read' session using the current history.
-The selected history element will be inserted into the minibuffer."
-  (interactive)
-  (let ((enable-recursive-minibuffers t)
-        (history (symbol-value (ivy-state-history ivy-last)))
-        (old-last ivy-last)
-        (ivy-recursive-restore nil))
-    (ivy-read "Reverse-i-search: "
-              history
-              :action (lambda (x)
-                        (ivy--reset-state
-                         (setq ivy-last old-last))
-                        (delete-minibuffer-contents)
-                        (insert (substring-no-properties x))
-                        (ivy--cd-maybe)))))
-
-(defun ivy-restrict-to-matches ()
-  "Restrict candidates to current matches and erase input."
-  (interactive)
-  (delete-minibuffer-contents)
-  (setq ivy--all-candidates
-        (ivy--filter ivy-text ivy--all-candidates)))
-
-;;* Occur
-(defvar-local ivy-occur-last nil
-  "Buffer-local value of `ivy-last'.
-Can't re-use `ivy-last' because using e.g. `swiper' in the same
-buffer would modify `ivy-last'.")
-
-(defvar ivy-occur-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-1] 'ivy-occur-click)
-    (define-key map (kbd "RET") 'ivy-occur-press-and-switch)
-    (define-key map (kbd "j") 'ivy-occur-next-line)
-    (define-key map (kbd "k") 'ivy-occur-previous-line)
-    (define-key map (kbd "h") 'backward-char)
-    (define-key map (kbd "l") 'forward-char)
-    (define-key map (kbd "f") 'ivy-occur-press)
-    (define-key map (kbd "g") 'ivy-occur-revert-buffer)
-    (define-key map (kbd "a") 'ivy-occur-read-action)
-    (define-key map (kbd "o") 'ivy-occur-dispatch)
-    (define-key map (kbd "c") 'ivy-occur-toggle-calling)
-    (define-key map (kbd "q") 'quit-window)
-    map)
-  "Keymap for Ivy Occur mode.")
-
-(defun ivy-occur-toggle-calling ()
-  "Toggle `ivy-calling'."
-  (interactive)
-  (if (setq ivy-calling (not ivy-calling))
-      (progn
-        (setq mode-name "Ivy-Occur [calling]")
-        (ivy-occur-press))
-    (setq mode-name "Ivy-Occur"))
-  (force-mode-line-update))
-
-(defun ivy-occur-next-line (&optional arg)
-  "Move the cursor down ARG lines.
-When `ivy-calling' isn't nil, call `ivy-occur-press'."
-  (interactive "p")
-  (forward-line arg)
-  (when ivy-calling
-    (ivy-occur-press)))
-
-(defun ivy-occur-previous-line (&optional arg)
-  "Move the cursor up ARG lines.
-When `ivy-calling' isn't nil, call `ivy-occur-press'."
-  (interactive "p")
-  (forward-line (- arg))
-  (when ivy-calling
-    (ivy-occur-press)))
-
-(define-derived-mode ivy-occur-mode fundamental-mode "Ivy-Occur"
-  "Major mode for output from \\[ivy-occur].
-
-\\{ivy-occur-mode-map}"
-  (setq-local view-read-only nil))
-
-(defvar ivy-occur-grep-mode-map
-  (let ((map (copy-keymap ivy-occur-mode-map)))
-    (define-key map (kbd "C-x C-q") 'ivy-wgrep-change-to-wgrep-mode)
-    map)
-  "Keymap for Ivy Occur Grep mode.")
-
-(define-derived-mode ivy-occur-grep-mode grep-mode "Ivy-Occur"
-  "Major mode for output from \\[ivy-occur].
-
-\\{ivy-occur-grep-mode-map}"
-  (setq-local view-read-only nil)
-  (when (fboundp 'wgrep-setup)
-    (wgrep-setup)))
-
-(defvar ivy--occurs-list nil
-  "A list of custom occur generators per command.")
-
-(defun ivy-set-occur (cmd occur)
-  "Assign CMD a custom OCCUR function."
-  (setq ivy--occurs-list
-        (plist-put ivy--occurs-list cmd occur)))
-
-(ivy-set-occur 'ivy-switch-buffer 'ivy-switch-buffer-occur)
-(ivy-set-occur 'ivy-switch-buffer-other-window 'ivy-switch-buffer-occur)
-
-(defun ivy--occur-insert-lines (cands)
-  (dolist (str cands)
-    (add-text-properties
-     0 (length str)
-     `(mouse-face
-       highlight
-       help-echo "mouse-1: call ivy-action")
-     str)
-    (insert str "\n"))
-  (goto-char (point-min))
-  (forward-line 4))
-
-(defun ivy-occur ()
-  "Stop completion and put the current matches into a new buffer.
-
-The new buffer remembers current action(s).
-
-While in the *ivy-occur* buffer, selecting a candidate with RET or
-a mouse click will call the appropriate action for that candidate.
-
-There is no limit on the number of *ivy-occur* buffers."
-  (interactive)
-  (if (not (window-minibuffer-p))
-      (user-error "No completion session is active")
-    (let* ((caller (ivy-state-caller ivy-last))
-           (occur-fn (plist-get ivy--occurs-list caller))
-           (buffer
-            (generate-new-buffer
-             (format "*ivy-occur%s \"%s\"*"
-                     (if caller
-                         (concat " " (prin1-to-string caller))
-                       "")
-                     ivy-text))))
-      (with-current-buffer buffer
-        (let ((inhibit-read-only t))
-          (erase-buffer)
-          (if occur-fn
-              (funcall occur-fn)
-            (ivy-occur-mode)
-            (insert (format "%d candidates:\n" (length ivy--old-cands)))
-            (read-only-mode)
-            (ivy--occur-insert-lines
-             (mapcar
-              (lambda (cand) (concat "    " cand))
-              ivy--old-cands))))
-        (setf (ivy-state-text ivy-last) ivy-text)
-        (setq ivy-occur-last ivy-last)
-        (setq-local ivy--directory ivy--directory))
-      (ivy-exit-with-action
-       `(lambda (_) (pop-to-buffer ,buffer))))))
-
-(defun ivy-occur-revert-buffer ()
-  "Refresh the buffer making it up-to date with the collection.
-
-Currently only works for `swiper'. In that specific case, the
-*ivy-occur* buffer becomes nearly useless as the orignal buffer
-is updated, since the line numbers no longer match.
-
-Calling this function is as if you called `ivy-occur' on the
-updated original buffer."
-  (interactive)
-  (let ((caller (ivy-state-caller ivy-occur-last))
-        (ivy-last ivy-occur-last))
-    (cond ((eq caller 'swiper)
-           (let ((buffer (ivy-state-buffer ivy-occur-last)))
-             (unless (buffer-live-p buffer)
-               (error "buffer was killed"))
-             (let ((inhibit-read-only t))
-               (erase-buffer)
-               (funcall (plist-get ivy--occurs-list caller) t)
-               (ivy-occur-grep-mode))))
-          ((memq caller '(counsel-git-grep counsel-grep counsel-ag counsel-rg))
-           (let ((inhibit-read-only t))
-             (erase-buffer)
-             (funcall (plist-get ivy--occurs-list caller)))))
-    (setq ivy-occur-last ivy-last)))
-
-(declare-function wgrep-change-to-wgrep-mode "ext:wgrep")
-
-(defun ivy-wgrep-change-to-wgrep-mode ()
-  "Forward to `wgrep-change-to-wgrep-mode'."
-  (interactive)
-  (if (require 'wgrep nil 'noerror)
-      (wgrep-change-to-wgrep-mode)
-    (error "Package wgrep isn't installed")))
-
-(defun ivy-occur-read-action ()
-  "Select one of the available actions as the current one."
-  (interactive)
-  (let ((ivy-last ivy-occur-last))
-    (ivy-read-action)))
-
-(defun ivy-occur-dispatch ()
-  "Call one of the available actions on the current item."
-  (interactive)
-  (let* ((state-action (ivy-state-action ivy-occur-last))
-         (actions (if (symbolp state-action)
-                      state-action
-                    (copy-sequence state-action))))
-    (unwind-protect
-         (progn
-           (ivy-occur-read-action)
-           (ivy-occur-press))
-      (setf (ivy-state-action ivy-occur-last) actions))))
-
-(defun ivy-occur-click (event)
-  "Execute action for the current candidate.
-EVENT gives the mouse position."
-  (interactive "e")
-  (let ((window (posn-window (event-end event)))
-        (pos (posn-point (event-end event))))
-    (with-current-buffer (window-buffer window)
-      (goto-char pos)
-      (ivy-occur-press))))
-
-(declare-function swiper--cleanup "swiper")
-(declare-function swiper--add-overlays "swiper")
-(defvar ivy-occur-timer nil)
-(defvar counsel-grep-last-line)
-
-(defun ivy-occur-press ()
-  "Execute action for the current candidate."
-  (interactive)
-  (when (save-excursion
-          (beginning-of-line)
-          (looking-at "\\(?:./\\|    \\)\\(.*\\)$"))
-    (when (memq (ivy-state-caller ivy-occur-last)
-                '(swiper counsel-git-grep counsel-grep counsel-ag counsel-rg
-                  counsel-describe-function counsel-describe-variable))
-      (let ((window (ivy-state-window ivy-occur-last)))
-        (when (or (null (window-live-p window))
-                  (equal window (selected-window)))
-          (save-selected-window
-            (setf (ivy-state-window ivy-occur-last)
-                  (display-buffer (ivy-state-buffer ivy-occur-last)
-                                  'display-buffer-pop-up-window))))))
-    (let* ((ivy-last ivy-occur-last)
-           (ivy-text (ivy-state-text ivy-last))
-           (str (buffer-substring
-                 (match-beginning 1)
-                 (match-end 1)))
-           (coll (ivy-state-collection ivy-last))
-           (action (ivy--get-action ivy-last))
-           (ivy-exit 'done))
-      (with-ivy-window
-        (setq counsel-grep-last-line nil)
-        (funcall action
-                 (if (and (consp coll)
-                          (consp (car coll)))
-                     (assoc str coll)
-                   str))
-        (if (memq (ivy-state-caller ivy-last)
-                  '(swiper counsel-git-grep counsel-grep))
-            (with-current-buffer (window-buffer (selected-window))
-              (swiper--cleanup)
-              (swiper--add-overlays
-               (ivy--regex ivy-text)
-               (line-beginning-position)
-               (line-end-position)
-               (selected-window))
-              (when (timerp ivy-occur-timer)
-                (cancel-timer ivy-occur-timer))
-              (setq ivy-occur-timer
-                    (run-at-time 1.0 nil 'swiper--cleanup))))))))
-
-(defun ivy-occur-press-and-switch ()
-  (interactive)
-  (ivy-occur-press)
-  (select-window (ivy--get-window ivy-occur-last)))
-
-(defconst ivy-help-file (let ((default-directory
-                               (if load-file-name
-                                   (file-name-directory load-file-name)
-                                 default-directory)))
-                          (if (file-exists-p "ivy-help.org")
-                              (expand-file-name "ivy-help.org")
-                            (if (file-exists-p "doc/ivy-help.org")
-                                (expand-file-name "doc/ivy-help.org"))))
-  "The file for `ivy-help'.")
-
-(defun ivy-help ()
-  "Help for `ivy'."
-  (interactive)
-  (let ((buf (get-buffer "*Ivy Help*")))
-    (unless buf
-      (setq buf (get-buffer-create "*Ivy Help*"))
-      (with-current-buffer buf
-        (insert-file-contents ivy-help-file)
-        (org-mode)
-        (view-mode)
-        (goto-char (point-min))))
-    (if (eq this-command 'ivy-help)
-        (switch-to-buffer buf)
-      (with-ivy-window
-        (pop-to-buffer buf)))
-    (view-mode)
-    (goto-char (point-min))))
-
-(provide 'ivy)
-
-;;; ivy.el ends here
diff --git a/packages/ivy/swiper.el b/packages/ivy/swiper.el
deleted file mode 100644
index 3974326..0000000
--- a/packages/ivy/swiper.el
+++ /dev/null
@@ -1,953 +0,0 @@
-;;; swiper.el --- Isearch with an overview. Oh, man! -*- lexical-binding: t -*-
-
-;; Copyright (C) 2015-2017  Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel <address@hidden>
-;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.9.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.9.0"))
-;; Keywords: matching
-
-;; This file is part of GNU Emacs.
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; This package gives an overview of the current regex search
-;; candidates.  The search regex can be split into groups with a
-;; space.  Each group is highlighted with a different face.
-;;
-;; It can double as a quick `regex-builder', although only single
-;; lines will be matched.
-
-;;; Code:
-(require 'ivy)
-
-(defgroup swiper nil
-  "`isearch' with an overview."
-  :group 'matching
-  :prefix "swiper-")
-
-(defface swiper-match-face-1
-  '((t (:inherit isearch-lazy-highlight-face)))
-  "The background face for `swiper' matches.")
-
-(defface swiper-match-face-2
-  '((t (:inherit isearch)))
-  "Face for `swiper' matches modulo 1.")
-
-(defface swiper-match-face-3
-  '((t (:inherit match)))
-  "Face for `swiper' matches modulo 2.")
-
-(defface swiper-match-face-4
-  '((t (:inherit isearch-fail)))
-  "Face for `swiper' matches modulo 3.")
-
-(defface swiper-line-face
-  '((t (:inherit highlight)))
-  "Face for current `swiper' line.")
-
-(defcustom swiper-faces '(swiper-match-face-1
-                          swiper-match-face-2
-                          swiper-match-face-3
-                          swiper-match-face-4)
-  "List of `swiper' faces for group matches."
-  :group 'ivy-faces
-  :type 'list)
-
-(defcustom swiper-min-highlight 2
-  "Only highlight matches for regexps at least this long."
-  :type 'integer)
-
-(defcustom swiper-include-line-number-in-search nil
-  "Include line number in text of search candidates."
-  :type 'boolean
-  :group 'swiper)
-
-(defcustom swiper-goto-start-of-match nil
-  "When non-nil, go to the start of the match, not its end."
-  :type 'boolean
-  :group 'swiper)
-
-(defvar swiper-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "M-q") 'swiper-query-replace)
-    (define-key map (kbd "C-l") 'swiper-recenter-top-bottom)
-    (define-key map (kbd "C-'") 'swiper-avy)
-    (define-key map (kbd "C-7") 'swiper-mc)
-    (define-key map (kbd "C-c C-f") 'swiper-toggle-face-matching)
-    map)
-  "Keymap for swiper.")
-
-(defun swiper-query-replace ()
-  "Start `query-replace' with string to replace from last search string."
-  (interactive)
-  (if (null (window-minibuffer-p))
-      (user-error "Should only be called in the minibuffer through 
`swiper-map'")
-    (let* ((enable-recursive-minibuffers t)
-           (from (ivy--regex ivy-text))
-           (to (minibuffer-with-setup-hook
-                   (lambda ()
-                     (setq minibuffer-default
-                           (if (string-match "\\`\\\\_<\\(.*\\)\\\\_>\\'" 
ivy-text)
-                               (match-string 1 ivy-text)
-                             ivy-text)))
-                 (read-from-minibuffer (format "Query replace %s with: " 
from)))))
-      (swiper--cleanup)
-      (ivy-exit-with-action
-       (lambda (_)
-         (with-ivy-window
-           (move-beginning-of-line 1)
-           (perform-replace from to
-                            t t nil)))))))
-
-(defun swiper-all-query-replace ()
-  "Start `query-replace' with string to replace from last search string."
-  (interactive)
-  (if (null (window-minibuffer-p))
-      (user-error
-       "Should only be called in the minibuffer through `swiper-all-map'")
-    (let* ((enable-recursive-minibuffers t)
-           (from (ivy--regex ivy-text))
-           (to (query-replace-read-to from "Query replace" t)))
-      (swiper--cleanup)
-      (ivy-exit-with-action
-       (lambda (_)
-         (let ((wnd-conf (current-window-configuration))
-               (inhibit-message t))
-           (unwind-protect
-                (dolist (cand ivy--old-cands)
-                  (let ((buffer (get-text-property 0 'buffer cand)))
-                    (switch-to-buffer buffer)
-                    (goto-char (point-min))
-                    (perform-replace from to t t nil)))
-             (set-window-configuration wnd-conf))))))))
-
-(defvar avy-background)
-(defvar avy-all-windows)
-(defvar avy-style)
-(defvar avy-keys)
-(declare-function avy--regex-candidates "ext:avy")
-(declare-function avy--process "ext:avy")
-(declare-function avy--overlay-post "ext:avy")
-(declare-function avy-action-goto "ext:avy")
-(declare-function avy-candidate-beg "ext:avy")
-(declare-function avy--done "ext:avy")
-(declare-function avy--make-backgrounds "ext:avy")
-(declare-function avy-window-list "ext:avy")
-(declare-function avy-read "ext:avy")
-(declare-function avy-read-de-bruijn "ext:avy")
-(declare-function avy-tree "ext:avy")
-(declare-function avy-push-mark "ext:avy")
-(declare-function avy--remove-leading-chars "ext:avy")
-
-;;;###autoload
-(defun swiper-avy ()
-  "Jump to one of the current swiper candidates."
-  (interactive)
-  (unless (require 'avy nil 'noerror)
-    (error "Package avy isn't installed"))
-  (unless (string= ivy-text "")
-    (let* ((avy-all-windows nil)
-           ;; We'll have overlapping overlays, so we sort all the
-           ;; overlays in the visible region by their start, and then
-           ;; throw out non-Swiper overlays or overlapping Swiper
-           ;; overlays.
-           (visible-overlays (cl-sort (with-ivy-window
-                                        (overlays-in (window-start)
-                                                     (window-end)))
-                                      #'< :key #'overlay-start))
-           (min-overlay-start 0)
-           (overlays-for-avy (cl-remove-if-not
-                              (lambda (ov)
-                                (when (and (>= (overlay-start ov)
-                                               min-overlay-start)
-                                           (memq (overlay-get ov 'face)
-                                                 swiper-faces))
-                                  (setq min-overlay-start (overlay-start ov))))
-                              visible-overlays))
-           (candidates (append
-                        (mapcar (lambda (ov)
-                                  (cons (overlay-start ov)
-                                        (overlay-get ov 'window)))
-                                overlays-for-avy)
-                        (save-excursion
-                          (save-restriction
-                            (narrow-to-region (window-start) (window-end))
-                            (goto-char (point-min))
-                            (forward-line)
-                            (let ((cands))
-                              (while (< (point) (point-max))
-                                (push (cons (1+ (point))
-                                            (selected-window))
-                                      cands)
-                                (forward-line))
-                              cands)))))
-           (candidate (unwind-protect
-                           (prog2
-                               (avy--make-backgrounds
-                                (append (avy-window-list)
-                                        (list (ivy-state-window ivy-last))))
-                               (if (eq avy-style 'de-bruijn)
-                                   (avy-read-de-bruijn
-                                    candidates avy-keys)
-                                 (avy-read (avy-tree candidates avy-keys)
-                                           #'avy--overlay-post
-                                           #'avy--remove-leading-chars))
-                             (avy-push-mark))
-                        (avy--done))))
-      (if (window-minibuffer-p (cdr candidate))
-          (progn
-            (ivy-set-index (- (line-number-at-pos (car candidate)) 2))
-            (ivy--exhibit)
-            (ivy-done)
-            (ivy-call))
-        (ivy-quit-and-run
-         (avy-action-goto (avy-candidate-beg candidate)))))))
-
-(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors-core")
-(declare-function multiple-cursors-mode "ext:multiple-cursors-core")
-
-(defun swiper-mc ()
-  "Create a fake cursor for each `swiper' candidate."
-  (interactive)
-  (unless (require 'multiple-cursors nil t)
-    (error "multiple-cursors isn't installed"))
-  (unless (window-minibuffer-p)
-    (error "Call me only from `swiper'"))
-  (let ((cands (nreverse ivy--old-cands)))
-    (unless (string= ivy-text "")
-      (ivy-exit-with-action
-       (lambda (_)
-         (let (cand)
-           (while (setq cand (pop cands))
-             (swiper--action cand)
-             (when cands
-               (mc/create-fake-cursor-at-point))))
-         (multiple-cursors-mode 1))))))
-
-(defun swiper-recenter-top-bottom (&optional arg)
-  "Call (`recenter-top-bottom' ARG)."
-  (interactive "P")
-  (with-ivy-window
-    (recenter-top-bottom arg)))
-
-(defvar swiper-font-lock-exclude
-  '(bookmark-bmenu-mode
-    package-menu-mode
-    gnus-summary-mode
-    gnus-article-mode
-    gnus-group-mode
-    emms-playlist-mode
-    emms-stream-mode
-    erc-mode
-    forth-mode
-    forth-block-mode
-    nix-mode
-    org-agenda-mode
-    dired-mode
-    jabber-chat-mode
-    elfeed-search-mode
-    elfeed-show-mode
-    fundamental-mode
-    Man-mode
-    woman-mode
-    mu4e-view-mode
-    mu4e-headers-mode
-    help-mode
-    debbugs-gnu-mode
-    occur-mode
-    occur-edit-mode
-    bongo-mode
-    bongo-library-mode
-    bongo-playlist-mode
-    eww-mode
-    twittering-mode
-    vc-dir-mode
-    rcirc-mode
-    circe-channel-mode
-    circe-server-mode
-    circe-query-mode
-    sauron-mode
-    w3m-mode)
-  "List of major-modes that are incompatible with font-lock-ensure.")
-
-(defun swiper-font-lock-ensure-p ()
-  "Return non-nil if we should font-lock-ensure."
-  (or (derived-mode-p 'magit-mode)
-              (bound-and-true-p magit-blame-mode)
-              (memq major-mode swiper-font-lock-exclude)))
-
-(defun swiper-font-lock-ensure ()
-  "Ensure the entired buffer is highlighted."
-  (unless (swiper-font-lock-ensure-p)
-    (unless (or (> (buffer-size) 100000) (null font-lock-mode))
-      (if (fboundp 'font-lock-ensure)
-          (font-lock-ensure)
-        (with-no-warnings (font-lock-fontify-buffer))))))
-
-(defvar swiper--format-spec ""
-  "Store the current candidates format spec.")
-
-(defvar swiper--width nil
-  "Store the number of digits needed for the longest line nubmer.")
-
-(defvar swiper-use-visual-line nil
-  "When non-nil, use `line-move' instead of `forward-line'.")
-
-(declare-function outline-show-all "outline")
-
-(defun swiper--candidates (&optional numbers-width)
-  "Return a list of this buffer lines.
-
-NUMBERS-WIDTH, when specified, is used for width spec of line
-numbers; replaces calculating the width from buffer line count."
-  (if (and visual-line-mode
-           ;; super-slow otherwise
-           (< (buffer-size) 20000))
-      (progn
-        (when (eq major-mode 'org-mode)
-          (require 'outline)
-          (if (fboundp 'outline-show-all)
-              (outline-show-all)
-            (with-no-warnings
-              (show-all))))
-        (setq swiper-use-visual-line t))
-    (setq swiper-use-visual-line nil))
-  (let ((n-lines (count-lines (point-min) (point-max))))
-    (unless (zerop n-lines)
-      (setq swiper--width (or numbers-width
-                              (1+ (floor (log n-lines 10)))))
-      (setq swiper--format-spec
-            (format "%%-%dd " swiper--width))
-      (let ((line-number 0)
-            (advancer (if swiper-use-visual-line
-                          (lambda (arg) (line-move arg t))
-                        #'forward-line))
-            candidates)
-        (save-excursion
-          (goto-char (point-min))
-          (swiper-font-lock-ensure)
-          (while (< (point) (point-max))
-            (let ((str (concat
-                        " "
-                        (replace-regexp-in-string
-                         "\t" "    "
-                         (if swiper-use-visual-line
-                             (buffer-substring
-                              (save-excursion
-                                (beginning-of-visual-line)
-                                (point))
-                              (save-excursion
-                                (end-of-visual-line)
-                                (point)))
-                           (buffer-substring
-                            (point)
-                            (line-end-position)))))))
-              (setq str (ivy-cleanup-string str))
-              (let ((line-number-str
-                     (format swiper--format-spec (cl-incf line-number))))
-                (if swiper-include-line-number-in-search
-                    (setq str (concat line-number-str str))
-                  (put-text-property
-                   0 1 'display line-number-str str))
-                (put-text-property
-                 0 1 'swiper-line-number line-number-str str))
-              (push str candidates))
-            (funcall advancer 1))
-          (nreverse candidates))))))
-
-(defvar swiper--opoint 1
-  "The point when `swiper' starts.")
-
-;;;###autoload
-(defun swiper (&optional initial-input)
-  "`isearch' with an overview.
-When non-nil, INITIAL-INPUT is the initial search pattern."
-  (interactive)
-  (swiper--ivy (swiper--candidates) initial-input))
-
-(declare-function string-trim-right "subr-x")
-(defvar swiper--current-window-start nil)
-
-(defun swiper-occur (&optional revert)
-  "Generate a custom occur buffer for `swiper'.
-When REVERT is non-nil, regenerate the current *ivy-occur* buffer."
-  (require 'subr-x)
-  (let* ((buffer (ivy-state-buffer ivy-last))
-         (fname (propertize
-                 (with-ivy-window
-                   (if (buffer-file-name buffer)
-                       (file-name-nondirectory
-                        (buffer-file-name buffer))
-                     (buffer-name buffer)))
-                 'face
-                 'compilation-info))
-         (cands (mapcar
-                 (lambda (s)
-                   (format "%s:%s:%s"
-                           fname
-                           (propertize
-                            (string-trim-right
-                             (get-text-property 0 'swiper-line-number s))
-                            'face 'compilation-line-number)
-                           (substring s 1)))
-                 (if (null revert)
-                     ivy--old-cands
-                   (setq ivy--old-re nil)
-                   (let ((ivy--regex-function 'swiper--re-builder))
-                     (ivy--filter
-                      (progn (string-match "\"\\(.*\\)\"" (buffer-name))
-                             (match-string 1 (buffer-name)))
-                      (with-current-buffer buffer
-                        (swiper--candidates))))))))
-    (unless (eq major-mode 'ivy-occur-grep-mode)
-      (ivy-occur-grep-mode)
-      (font-lock-mode -1))
-    (setq swiper--current-window-start nil)
-    (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                    default-directory))
-    (insert (format "%d candidates:\n" (length cands)))
-    (ivy--occur-insert-lines
-     (mapcar
-      (lambda (cand) (concat "./" cand))
-      cands))
-    (goto-char (point-min))
-    (forward-line 4)))
-
-(ivy-set-occur 'swiper 'swiper-occur)
-
-(declare-function evil-set-jump "ext:evil-jumps")
-
-(defvar swiper--current-line nil)
-(defvar swiper--current-match-start nil)
-(defvar swiper--point-min nil)
-(defvar swiper--point-max nil)
-
-(defun swiper--init ()
-  "Perform initialization common to both completion methods."
-  (setq swiper--current-line nil)
-  (setq swiper--current-match-start nil)
-  (setq swiper--current-window-start nil)
-  (setq swiper--opoint (point))
-  (setq swiper--point-min (point-min))
-  (setq swiper--point-max (point-max))
-  (when (bound-and-true-p evil-mode)
-    (evil-set-jump)))
-
-(declare-function char-fold-to-regexp "char-fold")
-
-(defun swiper--re-builder (str)
-  "Transform STR into a swiper regex.
-This is the regex used in the minibuffer where candidates have
-line numbers. For the buffer, use `ivy--regex' instead."
-  (let* ((re-builder
-          (or (cdr (assoc 'swiper ivy-re-builders-alist))
-              (cdr (assoc t ivy-re-builders-alist))))
-         (re (cond
-               ((equal str "")
-                "")
-               ((equal str "^")
-                (setq ivy--subexps 0)
-                ".")
-               ((string-match "^\\^" str)
-                (setq ivy--old-re "")
-                (let ((re (funcall re-builder (substring str 1))))
-                  (if (zerop ivy--subexps)
-                      (prog1 (format "^ ?\\(%s\\)" re)
-                        (setq ivy--subexps 1))
-                    (format "^ %s" re))))
-               ((eq (bound-and-true-p search-default-mode) 
'char-fold-to-regexp)
-                (mapconcat #'char-fold-to-regexp (ivy--split str) ".*"))
-               (t
-                (funcall re-builder str)))))
-    (cond ((stringp re)
-           (replace-regexp-in-string "\t" "    " re))
-          ((and (consp re)
-                (consp (car re)))
-           (setf (caar re)
-                 (replace-regexp-in-string "\t" "    " (caar re)))
-           re)
-          (t
-           (error "unexpected")))))
-
-(defvar swiper-history nil
-  "History for `swiper'.")
-
-(defvar swiper-invocation-face nil
-  "The face at the point of invocation of `swiper'.")
-
-(defun swiper--ivy (candidates &optional initial-input)
-  "Select one of CANDIDATES and move there.
-When non-nil, INITIAL-INPUT is the initial search pattern."
-  (swiper--init)
-  (setq swiper-invocation-face
-        (plist-get (text-properties-at (point)) 'face))
-  (let ((preselect
-         (if swiper-use-visual-line
-             (count-screen-lines
-              (point-min)
-              (save-excursion (beginning-of-visual-line) (point)))
-           (1- (line-number-at-pos))))
-        (minibuffer-allow-text-properties t)
-        res)
-    (unwind-protect
-         (and
-          (setq res
-                (ivy-read
-                 "Swiper: "
-                 candidates
-                 :initial-input initial-input
-                 :keymap swiper-map
-                 :preselect preselect
-                 :require-match t
-                 :update-fn #'swiper--update-input-ivy
-                 :unwind #'swiper--cleanup
-                 :action #'swiper--action
-                 :re-builder #'swiper--re-builder
-                 :history 'swiper-history
-                 :caller 'swiper))
-          (point))
-      (unless res
-        (goto-char swiper--opoint)))))
-
-(defun swiper-toggle-face-matching ()
-  "Toggle matching only the candidates with `swiper-invocation-face'."
-  (interactive)
-  (setf (ivy-state-matcher ivy-last)
-        (if (ivy-state-matcher ivy-last)
-            nil
-          #'swiper--face-matcher))
-  (setq ivy--old-re nil))
-
-(defun swiper--face-matcher (regexp candidates)
-  "Return REGEXP-matching CANDIDATES.
-Matched candidates should have `swiper-invocation-face'."
-  (cl-remove-if-not
-   (lambda (x)
-     (and
-      (string-match regexp x)
-      (let ((s (match-string 0 x))
-            (i 0))
-        (while (and (< i (length s))
-                    (text-property-any
-                     i (1+ i)
-                     'face swiper-invocation-face
-                     s))
-          (cl-incf i))
-        (eq i (length s)))))
-   candidates))
-
-(defun swiper--ensure-visible ()
-  "Remove overlays hiding point."
-  (let ((overlays (overlays-at (1- (point))))
-        ov expose)
-    (while (setq ov (pop overlays))
-      (if (and (invisible-p (overlay-get ov 'invisible))
-               (setq expose (overlay-get ov 'isearch-open-invisible)))
-          (funcall expose ov)))))
-
-(defvar swiper--overlays nil
-  "Store overlays.")
-
-(defun swiper--cleanup ()
-  "Clean up the overlays."
-  (while swiper--overlays
-    (delete-overlay (pop swiper--overlays)))
-  (save-excursion
-    (goto-char (point-min))
-    (isearch-clean-overlays)))
-
-(defun swiper--update-input-ivy ()
-  "Called when `ivy' input is updated."
-  (with-ivy-window
-    (swiper--cleanup)
-    (when (> (length (ivy-state-current ivy-last)) 0)
-      (let* ((re (funcall ivy--regex-function ivy-text))
-             (re (if (stringp re) re (caar re)))
-             (re (replace-regexp-in-string
-                  "    " "\t"
-                  re))
-             (str (get-text-property 0 'swiper-line-number (ivy-state-current 
ivy-last)))
-             (num (if (string-match "^[0-9]+" str)
-                      (string-to-number (match-string 0 str))
-                    0)))
-        (unless (eq this-command 'ivy-yank-word)
-          (when (cl-plusp num)
-            (unless (if swiper--current-line
-                        (eq swiper--current-line num)
-                      (eq (line-number-at-pos) num))
-              (goto-char swiper--point-min)
-              (if swiper-use-visual-line
-                  (line-move (1- num))
-                (forward-line (1- num))))
-            (if (and (equal ivy-text "")
-                     (>= swiper--opoint (line-beginning-position))
-                     (<= swiper--opoint (line-end-position)))
-                (goto-char swiper--opoint)
-              (if (eq swiper--current-line num)
-                  (when swiper--current-match-start
-                    (goto-char swiper--current-match-start))
-                (setq swiper--current-line num))
-              (when (re-search-forward re (line-end-position) t)
-                (setq swiper--current-match-start (match-beginning 0))))
-            (isearch-range-invisible (line-beginning-position)
-                                     (line-end-position))
-            (unless (and (>= (point) (window-start))
-                         (<= (point) (window-end (ivy-state-window ivy-last) 
t)))
-              (recenter))
-            (setq swiper--current-window-start (window-start))))
-        (swiper--add-overlays
-         re
-         (max (window-start) swiper--point-min)
-         (min (window-end (selected-window) t) swiper--point-max))))))
-
-(defun swiper--add-overlays (re &optional beg end wnd)
-  "Add overlays for RE regexp in visible part of the current buffer.
-BEG and END, when specified, are the point bounds.
-WND, when specified is the window."
-  (setq wnd (or wnd (ivy-state-window ivy-last)))
-  (let ((ov (if visual-line-mode
-                (make-overlay
-                 (save-excursion
-                   (beginning-of-visual-line)
-                   (point))
-                 (save-excursion
-                   (end-of-visual-line)
-                   (point)))
-              (make-overlay
-               (line-beginning-position)
-               (1+ (line-end-position))))))
-    (overlay-put ov 'face 'swiper-line-face)
-    (overlay-put ov 'window wnd)
-    (push ov swiper--overlays)
-    (let* ((wh (window-height))
-           (beg (or beg (save-excursion
-                          (forward-line (- wh))
-                          (point))))
-           (end (or end (save-excursion
-                          (forward-line wh)
-                          (point))))
-           (case-fold-search (and ivy-case-fold-search
-                                  (string= re (downcase re)))))
-      (when (>= (length re) swiper-min-highlight)
-        (save-excursion
-          (goto-char beg)
-          ;; RE can become an invalid regexp
-          (while (and (ignore-errors (re-search-forward re end t))
-                      (> (- (match-end 0) (match-beginning 0)) 0))
-            (swiper--add-overlay (match-beginning 0) (match-end 0)
-                                 (if (zerop ivy--subexps)
-                                     (cadr swiper-faces)
-                                   (car swiper-faces))
-                                 wnd 0)
-            (let ((i 1)
-                  (j 0))
-              (while (<= (cl-incf j) ivy--subexps)
-                (let ((bm (match-beginning j))
-                      (em (match-end j)))
-                  (while (and (< j ivy--subexps)
-                              (= em (match-beginning (+ j 1))))
-                    (setq em (match-end (cl-incf j))))
-                  (swiper--add-overlay
-                   bm em
-                   (nth (1+ (mod (+ i 2) (1- (length swiper-faces))))
-                        swiper-faces)
-                   wnd i)
-                  (cl-incf i))))))))))
-
-(defun swiper--add-overlay (beg end face wnd priority)
-  (let ((overlay (make-overlay beg end)))
-    (push overlay swiper--overlays)
-    (overlay-put overlay 'face face)
-    (overlay-put overlay 'window wnd)
-    (overlay-put overlay 'priority priority)))
-
-(defcustom swiper-action-recenter nil
-  "When non-nil, recenter after exiting `swiper'."
-  :type 'boolean)
-(defvar evil-search-module)
-(defvar evil-ex-search-pattern)
-(defvar evil-ex-search-persistent-highlight)
-(defvar evil-ex-search-direction)
-(declare-function evil-ex-search-activate-highlight "evil-ex")
-
-
-(defun swiper--action (x)
-  "Goto line X."
-  (let ((ln (1- (read (or (get-text-property 0 'swiper-line-number x)
-                          (and (string-match ":\\([0-9]+\\):.*\\'" x)
-                               (match-string-no-properties 1 x))))))
-        (re (ivy--regex ivy-text)))
-    (if (null x)
-        (user-error "No candidates")
-      (with-ivy-window
-        (unless (equal (current-buffer)
-                       (ivy-state-buffer ivy-last))
-          (switch-to-buffer (ivy-state-buffer ivy-last)))
-        (goto-char swiper--point-min)
-        (funcall (if swiper-use-visual-line
-                     #'line-move
-                   #'forward-line)
-                 ln)
-        (when (and (re-search-forward re (line-end-position) t) 
swiper-goto-start-of-match)
-          (goto-char (match-beginning 0)))
-        (swiper--ensure-visible)
-        (cond (swiper-action-recenter
-               (recenter))
-              (swiper--current-window-start
-               (set-window-start (selected-window) 
swiper--current-window-start)))
-        (when (/= (point) swiper--opoint)
-          (unless (and transient-mark-mode mark-active)
-            (when (eq ivy-exit 'done)
-              (push-mark swiper--opoint t)
-              (message "Mark saved where search started"))))
-        (add-to-history
-         'regexp-search-ring
-         re
-         regexp-search-ring-max)
-        (when (and (bound-and-true-p evil-mode)
-                   (eq evil-search-module 'evil-search))
-          (add-to-history 'evil-ex-search-history re)
-          (setq evil-ex-search-pattern (list re t t))
-          (setq evil-ex-search-direction 'forward)
-          (when evil-ex-search-persistent-highlight
-            (evil-ex-search-activate-highlight evil-ex-search-pattern)))))))
-
-(defun swiper-from-isearch ()
-  "Invoke `swiper' from isearch."
-  (interactive)
-  (let ((query (if isearch-regexp
-                   isearch-string
-                 (regexp-quote isearch-string))))
-    (isearch-exit)
-    (swiper query)))
-
-(defvar swiper-multi-buffers nil
-  "Store the current list of buffers.")
-
-(defvar swiper-multi-candidates nil
-  "Store the list of candidates for `swiper-multi'.")
-
-(defun swiper-multi-prompt ()
-  (format "Buffers (%s): "
-          (mapconcat #'identity swiper-multi-buffers ", ")))
-
-(defun swiper-multi ()
-  "Select one or more buffers.
-Run `swiper' for those buffers."
-  (interactive)
-  (setq swiper-multi-buffers nil)
-  (let ((ivy-use-virtual-buffers nil))
-    (ivy-read (swiper-multi-prompt)
-              'internal-complete-buffer
-              :action 'swiper-multi-action-1))
-  (ivy-read "Swiper: " swiper-multi-candidates
-            :action 'swiper-multi-action-2
-            :unwind #'swiper--cleanup
-            :caller 'swiper-multi))
-
-(defun swiper-multi-action-1 (x)
-  (if (member x swiper-multi-buffers)
-      (progn
-        (setq swiper-multi-buffers (delete x swiper-multi-buffers)))
-    (unless (equal x "")
-      (setq swiper-multi-buffers (append swiper-multi-buffers (list x)))))
-  (let ((prompt (swiper-multi-prompt)))
-    (setf (ivy-state-prompt ivy-last) prompt)
-    (setq ivy--prompt (concat "%-4d " prompt)))
-  (cond ((memq this-command '(ivy-done
-                              ivy-alt-done
-                              ivy-immediate-done))
-         (setq swiper-multi-candidates
-               (swiper--multi-candidates
-                (mapcar #'get-buffer swiper-multi-buffers))))
-        ((eq this-command 'ivy-call)
-         (with-selected-window (active-minibuffer-window)
-           (delete-minibuffer-contents)))))
-
-(defun swiper-multi-action-2 (x)
-  (when (> (length x) 0)
-    (let ((buffer-name (get-text-property 0 'buffer x)))
-      (when buffer-name
-        (with-ivy-window
-          (switch-to-buffer buffer-name)
-          (goto-char (point-min))
-          (forward-line (1- (read (get-text-property 0 'swiper-line-number 
x))))
-          (re-search-forward
-           (ivy--regex ivy-text)
-           (line-end-position) t)
-          (isearch-range-invisible (line-beginning-position)
-                                   (line-end-position))
-          (unless (eq ivy-exit 'done)
-            (swiper--cleanup)
-            (swiper--add-overlays (ivy--regex ivy-text))))))))
-
-(defun swiper-all-buffer-p (buffer)
-  "Return non-nil if BUFFER should be considered by `swiper-all'."
-  (let ((major-mode (with-current-buffer buffer major-mode)))
-    (cond
-     ;; Ignore TAGS buffers, they tend to add duplicate results.
-     ((eq major-mode #'tags-table-mode) nil)
-     ;; Always consider dired buffers, even though they're not backed
-     ;; by a file.
-     ((eq major-mode #'dired-mode) t)
-     ;; Always consider stash buffers too, as they may have
-     ;; interesting content not present in any buffers. We don't #'
-     ;; quote to satisfy the byte-compiler.
-     ((eq major-mode 'magit-stash-mode) t)
-     ;; Otherwise, only consider the file if it's backed by a file.
-     (t (buffer-file-name buffer)))))
-
-;;* `swiper-all'
-(defun swiper-all-function (str)
-  (if (and (< (length str) 3))
-      (list "" (format "%d chars more" (- 3 (length ivy-text))))
-    (let* ((buffers (cl-remove-if-not #'swiper-all-buffer-p (buffer-list)))
-           (re-full (funcall ivy--regex-function str))
-           re re-tail
-           cands match
-           (case-fold-search
-            (and ivy-case-fold-search
-                 (string= str (downcase str)))))
-      (if (stringp re-full)
-          (setq re re-full)
-        (setq re (caar re-full))
-        (setq re-tail (cdr re-full)))
-      (dolist (buffer buffers)
-        (with-current-buffer buffer
-          (save-excursion
-            (goto-char (point-min))
-            (while (re-search-forward re nil t)
-              (setq match (if (memq major-mode '(org-mode dired-mode))
-                              (buffer-substring-no-properties
-                               (line-beginning-position)
-                               (line-end-position))
-                            (buffer-substring
-                             (line-beginning-position)
-                             (line-end-position))))
-              (put-text-property
-               0 1 'buffer
-               (buffer-name)
-               match)
-              (put-text-property 0 1 'point (point) match)
-              (when (or (null re-tail) (ivy-re-match re-tail match))
-                (push match cands))))))
-      (setq ivy--old-re re-full)
-      (if (null cands)
-          (list "")
-        (setq ivy--old-cands (nreverse cands))))))
-
-(defvar swiper-window-width 80)
-
-(defun swiper--all-format-function (cands)
-  (let* ((ww swiper-window-width)
-         (col2 1)
-         (cands-with-buffer
-          (mapcar (lambda (s)
-                    (let ((buffer (get-text-property 0 'buffer s)))
-                      (setq col2 (max col2 (length buffer)))
-                      (cons s buffer))) cands))
-         (col1 (- ww 4 col2)))
-    (setq cands
-          (mapcar (lambda (x)
-                    (if (cdr x)
-                        (let ((s (ivy--truncate-string (car x) col1)))
-                          (concat
-                           s
-                           (make-string
-                            (max 0
-                                 (- ww (string-width s) (length (cdr x))))
-                            ?\ )
-                           (cdr x)))
-                      (car x)))
-                  cands-with-buffer))
-    (ivy--format-function-generic
-     (lambda (str)
-       (ivy--add-face str 'ivy-current-match))
-     (lambda (str)
-       str)
-     cands
-     "\n")))
-
-(defvar swiper-all-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "M-q") 'swiper-all-query-replace)
-    map)
-  "Keymap for `swiper-all'.")
-
-(defun swiper-all ()
-  "Run `swiper' for all opened buffers."
-  (interactive)
-  (let* ((swiper-window-width (- (frame-width) (if (display-graphic-p) 0 1)))
-         (ivy-format-function #'swiper--all-format-function))
-    (ivy-read "swiper-all: " 'swiper-all-function
-              :action 'swiper-all-action
-              :unwind #'swiper--cleanup
-              :update-fn (lambda ()
-                           (swiper-all-action (ivy-state-current ivy-last)))
-              :dynamic-collection t
-              :keymap swiper-all-map
-              :caller 'swiper-multi)))
-
-(defun swiper-all-action (x)
-  (when (> (length x) 0)
-    (let ((buffer-name (get-text-property 0 'buffer x)))
-      (when buffer-name
-        (with-ivy-window
-          (switch-to-buffer buffer-name)
-          (goto-char (get-text-property 0 'point x))
-          (isearch-range-invisible (line-beginning-position)
-                                   (line-end-position))
-          (unless (eq ivy-exit 'done)
-            (swiper--cleanup)
-            (swiper--add-overlays (ivy--regex ivy-text))))))))
-
-(defun swiper--multi-candidates (buffers)
-  (let* ((ww (window-width))
-         (res nil)
-         (column-2 (apply #'max
-                          (mapcar
-                           (lambda (b)
-                             (length (buffer-name b)))
-                           buffers)))
-         (column-1 (- ww 4 column-2 1)))
-    (dolist (buf buffers)
-      (with-current-buffer buf
-        (setq res
-              (append
-               (mapcar
-                (lambda (s)
-                  (setq s (concat (ivy--truncate-string s column-1) " "))
-                  (let ((len (length s)))
-                    (put-text-property
-                     (1- len) len 'display
-                     (concat
-                      (make-string
-                       (max 0
-                            (- ww (string-width s) (length (buffer-name)) 3))
-                       ?\ )
-                      (buffer-name))
-                     s)
-                    s))
-                (swiper--candidates 4))
-               res))
-        nil))
-    res))
-
-(provide 'swiper)
-
-;;; swiper.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]