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

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

[elpa] externals/ivy-hydra 044f82c 106/395: ivy.el (ivy-set-text): Add


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 044f82c 106/395: ivy.el (ivy-set-text): Add
Date: Thu, 25 Feb 2021 08:31:41 -0500 (EST)

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

    ivy.el (ivy-set-text): Add
---
 counsel.el |  8 ++++----
 ivy.el     | 24 ++++++++++++++----------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/counsel.el b/counsel.el
index 1dd867c..fd0dd9f 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2104,7 +2104,7 @@ See variable `counsel-up-directory-level'."
           (ivy-set-index 0)
           (setq ivy--directory "")
           (setq ivy--all-candidates nil)
-          (setq ivy-text "")
+          (ivy-set-text "")
           (delete-minibuffer-contents)
           (insert up-dir))
       (if (and counsel-up-directory-level (not (string= ivy-text "")))
@@ -2937,9 +2937,9 @@ Works for `counsel-git-grep', `counsel-ag', etc."
   (unless (eq major-mode 'ivy-occur-grep-mode)
     (ivy-occur-grep-mode)
     (setq default-directory (ivy-state-directory ivy-last)))
-  (setq ivy-text
-        (and (string-match "\"\\(.*\\)\"" (buffer-name))
-             (match-string 1 (buffer-name))))
+  (ivy-set-text
+   (and (string-match "\"\\(.*\\)\"" (buffer-name))
+        (match-string 1 (buffer-name))))
   (let* ((cmd
           (if (functionp cmd-template)
               (funcall cmd-template ivy-text)
diff --git a/ivy.el b/ivy.el
index 9008c1c..d1ce135 100644
--- a/ivy.el
+++ b/ivy.el
@@ -563,6 +563,10 @@ of `history-length'.")
 (defvar ivy-text ""
   "Store the user's string as it is typed in.")
 
+(defun ivy-set-text (str)
+  "Set `ivy-text' to STR."
+  (setq ivy-text str))
+
 (defvar ivy--index 0
   "Store the index of the current candidate.")
 
@@ -1070,11 +1074,11 @@ contains a single candidate.")
            (cond ((string-match
                    "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
                    ivy-text)
-                  (setq ivy-text (ivy-state-current ivy-last)))
+                  (ivy-set-text (ivy-state-current ivy-last)))
                  ((string-match
                    "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
                    (ivy-state-current ivy-last))
-                  (setq ivy-text (ivy-state-current ivy-last)))))
+                  (ivy-set-text (ivy-state-current ivy-last)))))
       (string-match
        "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
        ivy-text)))
@@ -1111,7 +1115,7 @@ If the text hasn't changed as a result, forward to 
`ivy-alt-done'."
      (let ((default-directory ivy--directory)
            dir)
        (minibuffer-complete)
-       (setq ivy-text (ivy--input))
+       (ivy-set-text (ivy--input))
        (when (setq dir (ivy-expand-file-if-directory ivy-text))
          (ivy--cd dir))))
     (t
@@ -1161,10 +1165,10 @@ If the text hasn't changed as a result, forward to 
`ivy-alt-done'."
                        (concat "^" new)
                      new))
            (insert
-            (setq ivy-text
-                  (concat
-                   (mapconcat #'identity parts " ")
-                   (and ivy-tab-space (not (= (length ivy--old-cands) 1)) " 
"))))
+            (ivy-set-text
+             (concat
+              (mapconcat #'identity parts " ")
+              (and ivy-tab-space (not (= (length ivy--old-cands) 1)) " "))))
            (ivy--partial-cd-for-single-directory)
            t))))
 
@@ -1603,7 +1607,7 @@ If so, move to that directory, while keeping only the 
file name."
                (lambda (s) (substring s 1))
                (tramp-get-completion-methods ""))
               #'string<))))
-    (setq ivy-text "")
+    (ivy-set-text "")
     (setf (ivy-state-directory ivy-last) dir)
     (delete-minibuffer-contents)))
 
@@ -2236,7 +2240,7 @@ This is useful for recursive `ivy-read'."
     (setq ivy--regexp-quote #'regexp-quote)
     (setq ivy--old-text "")
     (setq ivy--full-length nil)
-    (setq ivy-text "")
+    (ivy-set-text "")
     (setq ivy--index 0)
     (setq ivy-calling nil)
     (setq ivy-use-ignore ivy-use-ignore-default)
@@ -3258,7 +3262,7 @@ Should be run via minibuffer `post-command-hook'."
   (when (memq 'ivy--queue-exhibit post-command-hook)
     (let ((inhibit-field-text-motion nil))
       (constrain-to-field nil (point-max)))
-    (setq ivy-text (ivy--input))
+    (ivy-set-text (ivy--input))
     (if (ivy-state-dynamic-collection ivy-last)
         ;; while-no-input would cause annoying
         ;; "Waiting for process to die...done" message interruptions



reply via email to

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