[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tweak company completions order
From: |
Lele Gaifax |
Subject: |
Re: Tweak company completions order |
Date: |
Fri, 04 Dec 2015 13:43:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Thank you Dmitry!
For the record, this is what I've come up:
(defun esk/company-sort-preferring-exact-or-same-case (candidates)
(let ((exact nil)
(sameprefix nil)
(others nil)
(plen (length company-prefix)))
(mapc (lambda (candidate)
(if (equal company-prefix candidate)
(push candidate exact)
(if (equal company-prefix (substring candidate 0 plen))
(push candidate sameprefix)
(push candidate others))))
candidates)
(append exact sameprefix others)))
(add-to-list 'company-transformers
#'esk/company-sort-preferring-exact-or-same-case)
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it | -- Fortunato Depero, 1929.