[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-tran
From: |
Oleh Krehel |
Subject: |
[elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn |
Date: |
Wed, 16 Oct 2019 13:15:12 -0400 (EDT) |
branch: master
commit 8b07572789fc6f35c92ec5b7707c817e40bbe0dd
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-configure): Add :display-transformer-fn
---
counsel.el | 44 +++++++++++++++++++++-----------------------
ivy.el | 24 +++++++++++-------------
2 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/counsel.el b/counsel.el
index 713166b..3c09384 100644
--- a/counsel.el
+++ b/counsel.el
@@ -544,9 +544,6 @@ Used by commands `counsel-describe-variable' and
(ivy-append-face var 'ivy-highlight-face)
var))
-(ivy-set-display-transformer
- 'counsel-describe-variable 'counsel-describe-variable-transformer)
-
;;;###autoload
(defun counsel-describe-variable ()
"Forward to `describe-variable'.
@@ -567,7 +564,8 @@ Variables declared using `defcustom' are highlighted
according to
:caller 'counsel-describe-variable)))
(ivy-configure 'counsel-describe-variable
- :initial-input "^")
+ :initial-input "^"
+ :display-transformer-fn #'counsel-describe-variable-transformer)
;;** `counsel-describe-function'
(ivy-set-actions
@@ -585,9 +583,6 @@ Variables declared using `defcustom' are highlighted
according to
(ivy-append-face function-name 'ivy-highlight-face)
function-name))
-(ivy-set-display-transformer
- 'counsel-describe-function 'counsel-describe-function-transformer)
-
(defun ivy-function-called-at-point ()
(let ((f (function-called-at-point)))
(and f (symbol-name f))))
@@ -620,7 +615,8 @@ to `ivy-highlight-face'."
:caller 'counsel-describe-function)))
(ivy-configure 'counsel-describe-function
- :initial-input "^")
+ :initial-input "^"
+ :display-transformer-fn #'counsel-describe-function-transformer)
;;** `counsel-set-variable'
(defvar counsel-set-variable-history nil
@@ -928,17 +924,14 @@ when available, in that order of precedence."
:caller 'counsel-M-x)))
(ivy-configure 'counsel-M-x
- :initial-input "^")
+ :initial-input "^"
+ :display-transformer-fn #'counsel-M-x-transformer)
(ivy-set-actions
'counsel-M-x
`(("d" counsel--find-symbol "definition")
("h" ,(lambda (x) (funcall counsel-describe-function-function (intern x)))
"help")))
-(ivy-set-display-transformer
- 'counsel-M-x
- 'counsel-M-x-transformer)
-
;;** `counsel-command-history'
(defun counsel-command-history-action-eval (cmd)
"Eval the command CMD."
@@ -1335,7 +1328,6 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
map))
(counsel-set-async-exit-code 'counsel-git-grep 1 "No matches found")
-(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 -I -e \"%s\""
"Initial command for `counsel-git-grep'.")
@@ -1521,7 +1513,8 @@ When CMD is non-nil, prompt for a specific \"git grep\"
command."
(ivy-configure 'counsel-git-grep
:occur #'counsel-git-grep-occur
:unwind-fn #'counsel--grep-unwind
- :index-fn #'ivy-recompute-index-swiper-async)
+ :index-fn #'ivy-recompute-index-swiper-async
+ :display-transformer-fn #'counsel-git-grep-transformer)
(cl-pushnew 'counsel-git-grep ivy-highlight-grep-commands)
@@ -1985,7 +1978,8 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
'counsel-find-file))
(ivy-configure 'counsel-find-file
- :occur #'counsel-find-file-occur)
+ :occur #'counsel-find-file-occur
+ :display-transformer-fn #'ivy-read-file-transformer)
(defvar counsel-find-file-occur-cmd "ls -a | %s | xargs -d '\\n' ls -d
--group-directories-first"
"Format string for `counsel-find-file-occur'.")
@@ -2210,6 +2204,9 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
(lambda (d) (dired (expand-file-name d)))
'counsel-dired))
+(ivy-configure 'counsel-dired
+ :display-transformer-fn #'ivy-read-file-transformer)
+
;;** `counsel-recentf'
(defvar recentf-list)
(declare-function recentf-mode "recentf")
@@ -2260,6 +2257,9 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
:require-match t
:caller 'counsel-buffer-or-recentf))
+(ivy-configure 'counsel-buffer-or-recentf
+ :display-transformer-fn #'counsel-buffer-or-recentf-transformer)
+
(ivy-set-actions
'counsel-buffer-or-recentf
'(("j" find-file-other-window "other window")
@@ -2272,9 +2272,6 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
(ivy-append-face var 'ivy-highlight-face)
var))
-(ivy-set-display-transformer
- 'counsel-buffer-or-recentf 'counsel-buffer-or-recentf-transformer)
-
;;** `counsel-bookmark'
(defcustom counsel-bookmark-avoid-dired nil
"If non-nil, open directory bookmarks with `counsel-find-file'.
@@ -2756,7 +2753,6 @@ regex string."
(defvar counsel--regex-look-around nil)
(counsel-set-async-exit-code 'counsel-ag 1 "No matches found")
-(ivy-set-display-transformer 'counsel-ag 'counsel-git-grep-transformer)
(defconst counsel--command-args-separator "-- ")
@@ -2852,7 +2848,8 @@ CALLER is passed to `ivy-read'."
(ivy-configure 'counsel-ag
:occur #'counsel-ag-occur
- :unwind-fn #'counsel--grep-unwind)
+ :unwind-fn #'counsel--grep-unwind
+ :display-transformer-fn #'counsel-git-grep-transformer)
(defun counsel-cd ()
"Change the directory for the currently running Ivy grep-like command.
@@ -2945,7 +2942,6 @@ Note: don't use single quotes for the regex."
:type 'string)
(counsel-set-async-exit-code 'counsel-rg 1 "No matches found")
-(ivy-set-display-transformer 'counsel-rg 'counsel-git-grep-transformer)
(defun counsel--rg-targets ()
"Return a list of files to operate on, based on `dired-mode' marks."
@@ -2987,7 +2983,9 @@ Example input with inclusion and exclusion file patterns:
(ivy-configure 'counsel-rg
:occur #'counsel-ag-occur
- :unwind-fn #'counsel--grep-unwind)
+ :unwind-fn #'counsel--grep-unwind
+ :display-transformer-fn #'counsel-git-grep-transformer)
+
(cl-pushnew 'counsel-rg ivy-highlight-grep-commands)
;;** `counsel-grep'
diff --git a/ivy.el b/ivy.el
index 07eaf0d..247e5b2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1918,6 +1918,7 @@ May supersede `ivy-initial-inputs-alist'."
update-fn
unwind-fn
index-fn
+ display-transformer-fn
more-chars)
"Configure `ivy-read' params for CALLER."
(declare (indent 1))
@@ -1931,6 +1932,8 @@ May supersede `ivy-initial-inputs-alist'."
(ivy--alist-set 'ivy-unwind-fns-alist caller unwind-fn))
(when index-fn
(ivy--alist-set 'ivy-index-functions-alist caller index-fn))
+ (when display-transformer-fn
+ (ivy-set-display-transformer caller display-transformer-fn))
(when more-chars
(ivy--alist-set 'ivy-more-chars-alist caller more-chars)))
@@ -3875,13 +3878,6 @@ Note: The usual last two arguments are flipped for
convenience.")
olen (length str) 'ivy-completions-annotations str))
str))
-(ivy-set-display-transformer
- 'counsel-find-file 'ivy-read-file-transformer)
-(ivy-set-display-transformer
- 'counsel-dired 'ivy-read-file-transformer)
-(ivy-set-display-transformer
- 'read-file-name-internal 'ivy-read-file-transformer)
-
(defun ivy-read-file-transformer (str)
"Transform candidate STR when reading files."
(if (ivy--dirname-p str)
@@ -4318,11 +4314,6 @@ Skip buffers that match `ivy-ignore-buffers'."
(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-append-face (str face)
"Append to STR the property FACE."
(setq str (copy-sequence str))
@@ -4364,7 +4355,8 @@ Skip buffers that match `ivy-ignore-buffers'."
:caller 'ivy-switch-buffer))
(ivy-configure 'ivy-switch-buffer
- :occur #'ivy-switch-buffer-occur)
+ :occur #'ivy-switch-buffer-occur
+ :display-transformer-fn #'ivy-switch-buffer-transformer)
;;;###autoload
(defun ivy-switch-view ()
@@ -5057,6 +5049,12 @@ make decisions based on the whole marked list."
(require 'ffap)
(funcall ffap-url-fetcher url))
+(ivy-configure 'read-file-name-internal
+ :display-transformer-fn #'ivy-read-file-transformer)
+
+(ivy-configure 'internal-complete-buffer
+ :display-transformer-fn #'ivy-switch-buffer-transformer)
+
(provide 'ivy)
;;; ivy.el ends here
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn, (continued)
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn, Oleh Krehel, 2019/10/16
- [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 <=
- [elpa] master 9da8003 158/184: counsel.el (counsel-M-x): Don't sort by default, Oleh Krehel, 2019/10/16
- [elpa] master 8f08f38 155/184: counsel.el (counsel--grep-last-pos): Refactor from counsel-grep-last-line, Oleh Krehel, 2019/10/16
- [elpa] master 6b40d40 156/184: ivy.el (ivy--occur-press-update-window): Re-use ivy-highlight-grep-commands, Oleh Krehel, 2019/10/16
- [elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes, Oleh Krehel, 2019/10/16
- [elpa] master 2ce5450 177/184: counsel.el (counsel-find-file): Bind "M-o R" to find-file-read-only, Oleh Krehel, 2019/10/16
- [elpa] master c82b852 174/184: ivy.el (ivy-occur-revert-buffer): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 8bc23e6 104/184: counsel.el (counsel-compile): delete duplicates, Oleh Krehel, 2019/10/16
- [elpa] master 966525c 118/184: counsel.el (counsel-cd): Fix for counsel-ag, Oleh Krehel, 2019/10/16
- [elpa] master f628569 127/184: Make ivy--magic-file-slash less aggressive, Oleh Krehel, 2019/10/16
- [elpa] master efdee7a 172/184: swiper.el (swiper--occur-insert-lines): Extract, Oleh Krehel, 2019/10/16