[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn
From: |
Oleh Krehel |
Subject: |
[elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn |
Date: |
Wed, 16 Oct 2019 13:15:14 -0400 (EDT) |
branch: master
commit a5701a97217f269c7f6c05e8f3cfa7fe976bdad2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-configure): Add :format-fn
---
counsel.el | 30 +++++++++++++++++-------------
ivy.el | 3 +++
swiper.el | 14 ++++++--------
3 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/counsel.el b/counsel.el
index f413d97..0a4b7b9 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1195,8 +1195,7 @@ back to the face of the character after point, and
finally the
(defvar counsel--faces-format "%-40s %s")
(defun counsel--faces-format-function (names)
- "Customize `ivy-format-functions-alist' for `counsel-faces'.
-Each candidate is formatted based on the given FORMAT string."
+ "Format NAMES according to `counsel--faces-format'."
(let ((formatter
(lambda (name)
(format counsel--faces-format name
@@ -1225,9 +1224,8 @@ selected face."
:caller 'counsel-faces)))
(ivy-configure 'counsel-faces
- :sort-fn #'ivy-string<)
-
-(add-to-list 'ivy-format-functions-alist '(counsel-faces .
counsel--faces-format-function))
+ :sort-fn #'ivy-string<
+ :format-fn #'counsel--faces-format-function)
(ivy-set-actions
'counsel-faces
@@ -1756,9 +1754,9 @@ currently checked out."
:caller 'counsel-git-log))
(ivy-configure 'counsel-git-log
- :unwind-fn #'counsel-delete-process)
+ :unwind-fn #'counsel-delete-process
+ :format-fn #'counsel--git-log-format-function)
-(add-to-list 'ivy-format-functions-alist '(counsel-git-log .
counsel--git-log-format-function))
(add-to-list 'ivy-height-alist '(counsel-git-log . 4))
(add-to-list 'counsel-async-split-string-re-alist '(counsel-git-log . "^commit
"))
(add-to-list 'counsel-async-ignore-re-alist '(counsel-git-log . "^[ \n]*$"))
@@ -4179,7 +4177,9 @@ Note: Duplicate elements of `kill-ring' are always
deleted."
:preselect preselect
:action #'counsel-yank-pop-action
:caller 'counsel-yank-pop)))
-(add-to-list 'ivy-format-functions-alist '(counsel-yank-pop .
counsel--yank-pop-format-function))
+
+(ivy-configure 'counsel-yank-pop
+ :format-fn #'counsel--yank-pop-format-function)
(add-to-list 'ivy-height-alist '(counsel-yank-pop . 5))
(ivy-set-actions
@@ -4254,7 +4254,8 @@ matching the register's value description against a
regexp in
:action #'counsel-evil-registers-action
:caller 'counsel-evil-registers)
(user-error "Required feature `evil' not installed.")))
-(add-to-list 'ivy-format-functions-alist '(counsel-evil-registers .
counsel--yank-pop-format-function))
+(ivy-configure 'counsel-evil-registers
+ :format-fn #'counsel--yank-pop-format-function)
(add-to-list 'ivy-height-alist '(counsel-evil-registers . 5))
(defun counsel-evil-registers-action (s)
@@ -4997,7 +4998,8 @@ selected color."
:history 'counsel-colors-emacs-history
:action #'insert
:caller 'counsel-colors-emacs)))
-(add-to-list 'ivy-format-functions-alist '(counsel-colors-emacs .
counsel--colors-emacs-format-function))
+(ivy-configure 'counsel-colors-emacs
+ :format-fn #'counsel--colors-emacs-format-function)
(ivy-set-actions
'counsel-colors-emacs
@@ -5045,9 +5047,9 @@ selected color."
:caller 'counsel-colors-web)))
(ivy-configure 'counsel-colors-web
- :sort-fn #'ivy-string<)
+ :sort-fn #'ivy-string<
+ :format-fn #'counsel--colors-web-format-function)
-(add-to-list 'ivy-format-functions-alist '(counsel-colors-web .
counsel--colors-web-format-function))
(ivy-set-actions
'counsel-colors-web
'(("h" counsel-colors-action-insert-hex "insert hexadecimal value")
@@ -5893,7 +5895,9 @@ specified by the `blddir' property."
cand))
:history 'counsel-compile-env-history
:caller 'counsel-compile-env))
-(add-to-list 'ivy-format-functions-alist '(counsel-compile-env .
counsel-compile-env--format-hint))
+
+(ivy-configure 'counsel-compile-env
+ :format-fn #'counsel-compile-env--format-hint)
;;** `counsel-minor'
(defvar counsel-minor-history nil
diff --git a/ivy.el b/ivy.el
index 1527e85..cb5569d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1913,6 +1913,7 @@ May supersede `ivy-initial-inputs-alist'."
unwind-fn
index-fn
sort-fn
+ format-fn
display-transformer-fn
more-chars
grep-p)
@@ -1930,6 +1931,8 @@ May supersede `ivy-initial-inputs-alist'."
(ivy--alist-set 'ivy-index-functions-alist caller index-fn))
(when sort-fn
(ivy--alist-set 'ivy-sort-functions-alist caller sort-fn))
+ (when format-fn
+ (ivy--alist-set 'ivy-format-functions-alist caller format-fn))
(when display-transformer-fn
(ivy-set-display-transformer caller display-transformer-fn))
(when more-chars
diff --git a/swiper.el b/swiper.el
index e41b96d..2777123 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1137,7 +1137,8 @@ Run `swiper' for those buffers."
(ivy-configure 'swiper-multi
:unwind-fn #'swiper--cleanup
- :index-fn #'ivy-recompute-index-swiper)
+ :index-fn #'ivy-recompute-index-swiper
+ :format-fn #'swiper--all-format-function)
(defun swiper-multi-action-1 (x)
"Add X to list of selected buffers `swiper-multi-buffers'.
@@ -1287,10 +1288,8 @@ See `ivy-format-functions-alist' for further
information."
(ivy-configure 'swiper-all
:update-fn 'auto
- :unwind-fn #'swiper--cleanup)
-
-(add-to-list 'ivy-format-functions-alist '(swiper-multi .
swiper--all-format-function))
-(add-to-list 'ivy-format-functions-alist '(swiper-all .
swiper--all-format-function))
+ :unwind-fn #'swiper--cleanup
+ :format-fn #'swiper--all-format-function)
(defun swiper-all-action (x)
"Move to candidate X from `swiper-all'."
@@ -1625,7 +1624,8 @@ When not running `swiper-isearch' already, start it."
(ivy-configure 'swiper-isearch
:occur #'swiper-occur
:update-fn 'auto
- :unwind-fn #'swiper--cleanup)
+ :unwind-fn #'swiper--cleanup
+ :format-fn #'swiper-isearch-format-function)
;;;###autoload
(defun swiper-isearch-backward (&optional initial-input)
@@ -1634,8 +1634,6 @@ When not running `swiper-isearch' already, start it."
(let ((swiper--isearch-backward t))
(swiper-isearch initial-input)))
-(add-to-list 'ivy-format-functions-alist '(swiper-isearch .
swiper-isearch-format-function))
-
(defun swiper-isearch-toggle ()
"Two-way toggle between `swiper-isearch' and isearch.
Intended to be bound in `isearch-mode-map' and `swiper-map'."
- [elpa] master f0451db 173/184: ivy.el (ivy-occur-revert-buffer): Don't error if the swiper buffer was killed, (continued)
- [elpa] master f0451db 173/184: ivy.el (ivy-occur-revert-buffer): Don't error if the swiper buffer was killed, Oleh Krehel, 2019/10/16
- [elpa] master 3bd1d87 182/184: counsel.el (counsel-locate-cmd-es): Encode command to local codepage, Oleh Krehel, 2019/10/16
- [elpa] master 8b4693c 169/184: counsel.el (counsel-imenu-action and -get-canditates-from): Revert., Oleh Krehel, 2019/10/16
- [elpa] master 882d6c4 161/184: counsel.el (counsel-imenu): Work with :update-fn 'auto, Oleh Krehel, 2019/10/16
- [elpa] master 1a9002b 168/184: ivy.el: Clean up obsolete aliases, Oleh Krehel, 2019/10/16
- [elpa] master c2d3a4c 184/184: Merge commit 'cd634c6f51458f81898ecf2821ac3169cb65a1eb' from ivy, Oleh Krehel, 2019/10/16
- [elpa] master 12f4771 124/184: ivy.el (ivy-completion-in-region): Add workaround for package-menu-filter, Oleh Krehel, 2019/10/16
- [elpa] master 2b974b4 139/184: ivy.el (ivy-update-fns-alist): New defcustom, Oleh Krehel, 2019/10/16
- [elpa] master 57e0b94 146/184: swiper.el (swiper--action): Set case-fold-search, Oleh Krehel, 2019/10/16
- [elpa] master cdca2fc 141/184: counsel.el (counsel-switch-buffer): Re-use ivy-switch-buffer, Oleh Krehel, 2019/10/16
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn,
Oleh Krehel <=
- [elpa] master 4d533b2 178/184: counsel.el (counsel-dired): Filter to directories only, Oleh Krehel, 2019/10/16
- [elpa] master ec1ed07 171/184: counsel.el (counsel--find-file-1): Use dired-current-directory for dired, Oleh Krehel, 2019/10/16
- [elpa] master 1d8803e 181/184: Ensure that ripgrep on windows uses '/' as the path-separator, Oleh Krehel, 2019/10/16
- [elpa] master 7854d03 129/184: counsel.el (counsel-google): Add, Oleh Krehel, 2019/10/16
- [elpa] master cd634c6 183/184: doc/Changelog.org: Release 0.13.0, Oleh Krehel, 2019/10/16
- [elpa] master 0dfd70d 135/184: counsel.el (counsel-google-function): Require json, Oleh Krehel, 2019/10/16
- [elpa] master eed1f06 138/184: counsel.el (counsel--py-action): Don't auto-insert parens, Oleh Krehel, 2019/10/16
- [elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching for "$^", Oleh Krehel, 2019/10/16
- [elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get, Oleh Krehel, 2019/10/16
- [elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn, Oleh Krehel, 2019/10/16