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

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

[elpa] master e016d48 31/90: Allow "TAB" to complete when input starts w


From: Oleh Krehel
Subject: [elpa] master e016d48 31/90: Allow "TAB" to complete when input starts with "^"
Date: Tue, 30 Jun 2015 07:28:16 +0000

branch: master
commit e016d48e9575c4207f403a87ca2360a79dba5229
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Allow "TAB" to complete when input starts with "^"
    
    * ivy.el (ivy-partial): Strip "^" when forwarding to `try-completion'.
    Afterwards, put it back.
    
    Fixes #138
---
 ivy.el |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index e2e6243..9faf6af 100644
--- a/ivy.el
+++ b/ivy.el
@@ -337,14 +337,20 @@ If the text hasn't changed as a result, forward to 
`ivy-alt-done'."
   (let* ((parts (or (split-string ivy-text " " t) (list "")))
          (postfix (car (last parts)))
          (completion-ignore-case t)
-         (new (try-completion postfix
+         (startp (string-match "^\\^" postfix))
+         (new (try-completion (if startp
+                                  (substring postfix 1)
+                                postfix)
                               (mapcar (lambda (str) (substring str 
(string-match postfix str)))
                                       ivy--old-cands))))
     (cond ((eq new t) nil)
           ((string= new ivy-text) nil)
           (new
            (delete-region (minibuffer-prompt-end) (point-max))
-           (setcar (last parts) new)
+           (setcar (last parts)
+                   (if startp
+                       (concat "^" new)
+                     new))
            (insert (mapconcat #'identity parts " ")
                    (if ivy-tab-space " " ""))
            t))))



reply via email to

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