summaryrefslogtreecommitdiff
path: root/helm-dabbrev.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-20 07:38:51 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-20 07:38:51 +0200
commitc0cb8d58b0bf293316605611d708a249d559ba50 (patch)
treecb7cfae8a89823a3a632f997641ebabdb4e08b11 /helm-dabbrev.el
parent67df553ae0ccc4c50cc970b866cdf13afe1cfde6 (diff)
Check parts of dabbrev in hash
* helm-dabbrev.el (helm-dabbrev--cache-data): Do it.
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r--helm-dabbrev.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el
index 7c9c84a5..ce9643b3 100644
--- a/helm-dabbrev.el
+++ b/helm-dabbrev.el
@@ -229,9 +229,13 @@ but the initial search for all candidates in buffer(s)."
(defvar helm-dabbrev--hash (make-hash-table :test 'equal))
(defun helm-dabbrev--cache-data (dabbrev)
- (or (gethash dabbrev helm-dabbrev--hash)
- (puthash dabbrev (helm-dabbrev--get-candidates dabbrev)
- helm-dabbrev--hash)))
+ (unless (or (null dabbrev) (string= dabbrev ""))
+ (or (cl-loop for count downfrom (length dabbrev) to 1
+ when (gethash (substring-no-properties dabbrev 0 count)
+ helm-dabbrev--hash)
+ return it)
+ (puthash dabbrev (helm-dabbrev--get-candidates dabbrev)
+ helm-dabbrev--hash))))
;;;###autoload
(defun helm-dabbrev ()