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

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

[elpa] master 7dea040 066/184: ivy.el (ivy-pre-prompt-function): Add


From: Oleh Krehel
Subject: [elpa] master 7dea040 066/184: ivy.el (ivy-pre-prompt-function): Add
Date: Wed, 16 Oct 2019 13:14:50 -0400 (EDT)

branch: master
commit 7dea040b5280a4cfeb303448e79f0f51cd713fa5
Author: Takaaki ISHIKAWA <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-pre-prompt-function): Add
    
    Fixes #2185
---
 ivy.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ivy.el b/ivy.el
index 1094946..a0d1c63 100644
--- a/ivy.el
+++ b/ivy.el
@@ -180,6 +180,12 @@ Set this to \"(%d/%d) \" to display both the index and the 
count."
           (const :tag "Count matches and show current match" "(%d/%d) ")
           string))
 
+(defcustom ivy-pre-prompt-function nil
+  "When non-nil, add strings before the `ivy-read' prompt."
+  :type '(choice
+          (const :tag "Do nothing" nil)
+          (function :tag "Custom function")))
+
 (defcustom ivy-add-newline-after-prompt nil
   "When non-nil, add a newline after the `ivy-read' prompt."
   :type 'boolean)
@@ -2904,6 +2910,8 @@ parts beyond their respective faces `ivy-confirm-face' and
                          (concat n-str d-str "\n"))
                         (t
                          (concat n-str d-str)))))
+          (when ivy-pre-prompt-function
+            (setq n-str (concat (funcall ivy-pre-prompt-function) n-str)))
           (when ivy-add-newline-after-prompt
             (setq n-str (concat n-str "\n")))
           (let ((regex (format "\\([^\n]\\{%d\\}\\)[^\n]" (window-width))))



reply via email to

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