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

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

[elpa] externals/ivy-hydra aef1d4d 302/395: ivy.el (ivy-configure): Add


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra aef1d4d 302/395: ivy.el (ivy-configure): Add :parent keyword
Date: Thu, 25 Feb 2021 08:32:25 -0500 (EST)

branch: externals/ivy-hydra
commit aef1d4d1631b7e9391296743807ee1cfa6170429
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy-configure): Add :parent keyword
    
    * ivy.el (ivy--parents-alist): New defvar.
---
 counsel.el | 29 +++++++++++++----------------
 ivy.el     | 23 +++++++++++++++++------
 2 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/counsel.el b/counsel.el
index 159c802..b304e14 100644
--- a/counsel.el
+++ b/counsel.el
@@ -518,9 +518,8 @@ Variables declared using `defcustom' are highlighted 
according to
               :caller 'counsel-describe-variable)))
 
 (ivy-configure 'counsel-describe-variable
-  :initial-input "^"
-  :display-transformer-fn #'counsel-describe-variable-transformer
-  :sort-fn #'ivy-string<)
+  :parent 'counsel-describe-symbol
+  :display-transformer-fn #'counsel-describe-variable-transformer)
 
 ;;** `counsel-describe-function'
 (ivy-set-actions
@@ -569,9 +568,8 @@ to `ivy-highlight-face'."
               :caller 'counsel-describe-function)))
 
 (ivy-configure 'counsel-describe-function
-  :initial-input "^"
-  :display-transformer-fn #'counsel-describe-function-transformer
-  :sort-fn #'ivy-string<)
+  :parent 'counsel-describe-symbol
+  :display-transformer-fn #'counsel-describe-function-transformer)
 
 ;;** `counsel-describe-symbol'
 (defcustom counsel-describe-symbol-function #'describe-symbol
@@ -599,12 +597,12 @@ to `ivy-highlight-face'."
                         (funcall counsel-describe-symbol-function (intern x)))
               :caller 'counsel-describe-symbol)))
 
-(ivy-configure #'counsel-describe-symbol
+(ivy-configure 'counsel-describe-symbol
   :initial-input "^"
   :sort-fn #'ivy-string<)
 
 (ivy-set-actions
- #'counsel-describe-symbol
+ 'counsel-describe-symbol
  `(("I" ,#'counsel-info-lookup-symbol "info")
    ("d" ,#'counsel--find-symbol "definition")))
 
@@ -1226,7 +1224,7 @@ selected face."
               :caller 'counsel-faces)))
 
 (ivy-configure 'counsel-faces
-  :sort-fn #'ivy-string<
+  :parent 'counsel-describe-face
   :format-fn #'counsel--faces-format-function)
 
 (ivy-set-actions
@@ -2014,9 +2012,8 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer 
during completion."
    'counsel-find-file))
 
 (ivy-configure 'counsel-find-file
-  :alt-done-fn #'ivy--directory-done
-  :occur #'counsel-find-file-occur
-  :display-transformer-fn #'ivy-read-file-transformer)
+  :parent 'read-file-name-internal
+  :occur #'counsel-find-file-occur)
 
 (defvar counsel-find-file-occur-cmd "ls -a | %s | xargs -d '\\n' ls -d 
--group-directories-first"
   "Format string for `counsel-find-file-occur'.")
@@ -2252,8 +2249,7 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer 
during completion."
      'counsel-dired)))
 
 (ivy-configure 'counsel-dired
-  :alt-done-fn #'ivy--directory-done
-  :display-transformer-fn #'ivy-read-file-transformer)
+  :parent 'read-file-name-internal)
 
 ;;** `counsel-recentf'
 (defvar recentf-list)
@@ -2681,7 +2677,8 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
             :caller 'counsel-tracker))
 
 (ivy-configure 'counsel-tracker
-  :display-transformer-fn #'counsel-tracker-transformer)
+  :display-transformer-fn #'counsel-tracker-transformer
+  :unwind-fn #'counsel-delete-process)
 
 ;;** `counsel-fzf'
 (defvar counsel-fzf-cmd "fzf -f \"%s\""
@@ -3021,7 +3018,7 @@ CALLER is passed to `ivy-read'."
               :caller 'counsel-read-directory-name)))
 
 (ivy-configure 'counsel-read-directory-name
-  :display-transformer-fn #'ivy-read-file-transformer)
+  :parent 'read-file-name-internal)
 
 (defun counsel-cd ()
   "Change the directory for the currently running Ivy grep-like command.
diff --git a/ivy.el b/ivy.el
index 829c978..81c27ac 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1848,8 +1848,13 @@ An :init is a function with no arguments.
 
 (declare-function counsel-set-async-exit-code "counsel")
 
+(defvar ivy--parents-alist nil
+  "Configure parent caller for child caller.
+The child caller inherits and can override the settings of the parent.")
+
 (cl-defun ivy-configure (caller
                          &key
+                         parent
                          initial-input
                          height
                          occur
@@ -1867,6 +1872,8 @@ An :init is a function with no arguments.
                          exit-codes)
   "Configure `ivy-read' params for CALLER."
   (declare (indent 1))
+  (when parent
+    (ivy--alist-set 'ivy--parents-alist caller parent))
   (when initial-input
     (ivy--alist-set 'ivy-initial-inputs-alist caller initial-input))
   (when height
@@ -1942,9 +1949,13 @@ Directories come first."
   "Return the value associated with KEY in ALIST, using `assq'.
 KEY defaults to the last caller of `ivy-read'; if no entry is
 found, it falls back to the key t."
-  (cdr (or (let ((caller (or key (ivy-state-caller ivy-last))))
-             (and caller (assq caller alist)))
-           (assq t alist))))
+  (let ((caller (or key (ivy-state-caller ivy-last))))
+    (or
+     (and caller (cdr (assq caller alist)))
+     (let ((parent (cdr (assq caller ivy--parents-alist))))
+       (when parent
+         (ivy-alist-setting alist parent)))
+     (cdr (assq t alist)))))
 
 (defun ivy--height (caller)
   (let ((v (or (ivy-alist-setting ivy-height-alist caller)
@@ -4508,8 +4519,8 @@ CANDS are the candidates to be displayed."
             :caller 'ivy-switch-buffer))
 
 (ivy-configure 'ivy-switch-buffer
-  :occur #'ivy-switch-buffer-occur
-  :display-transformer-fn #'ivy-switch-buffer-transformer)
+  :parent 'internal-complete-buffer
+  :occur #'ivy-switch-buffer-occur)
 
 ;;;###autoload
 (defun ivy-switch-view ()
@@ -4531,7 +4542,7 @@ CANDS are the candidates to be displayed."
             :caller 'ivy-switch-buffer-other-window))
 
 (ivy-configure 'ivy-switch-buffer-other-window
-  :occur #'ivy-switch-buffer-occur)
+  :parent 'ivy-switch-buffer)
 
 (defun ivy--yank-handle-case-fold (text)
   (if (and (> (length ivy-text) 0)



reply via email to

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