diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-21 18:54:37 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-21 18:54:37 +0200 |
commit | 5e051bbbce36ba709440b2eb48086125073ff298 (patch) | |
tree | 907dd4b7d4a639eee228b4924c5386605ef9ade0 /helm-dabbrev.el | |
parent | fa40b6a1e253037e7852ee7682feedae07747402 (diff) |
Revert some changes in helm-dabbrev
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r-- | helm-dabbrev.el | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el index 29e88150..d1fdd52a 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -106,9 +106,6 @@ but the initial search for all candidates in buffer(s)." (defvaralias 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp) (make-obsolete-variable 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp "2.8.3") -(defvar helm-dabbrev-cache-candidates nil - "When non-nil cache candidates. -This is experimental and not fully working, you should not use this.") (defvar helm-dabbrev-map (let ((map (make-sparse-keymap))) @@ -121,7 +118,6 @@ This is experimental and not fully working, you should not use this.") (defvar helm-dabbrev--exclude-current-buffer-flag nil) (defvar helm-dabbrev--cache nil) (defvar helm-dabbrev--data nil) -(defvar helm-dabbrev--hash (make-hash-table :test 'equal)) (cl-defstruct helm-dabbrev-info dabbrev limits iterator) @@ -238,33 +234,6 @@ This is experimental and not fully working, you should not use this.") 'helm-insert-completion-at-point beg end candidate)))) -(defun helm-dabbrev--cache-data (dabbrev) - (if helm-dabbrev-cache-candidates - ;; FIXME: When using caching, if user add new data to some - ;; buffer it will not be present in cache so I have to set tick - ;; for each buffer and refresh cache if one buffer have been - ;; modified, ideally only the data for modified buffers should - ;; be updated. - (progn - (cl-assert dabbrev nil "[No Match]") - (unless (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)))) - (helm-dabbrev--get-candidates dabbrev))) - -(defun helm-dabbrev--get-candidates-info (dabbrev) - (if helm-dabbrev-cache-candidates - ;; Find only the first `helm-dabbrev-cycle-threshold' candidates. - ;; FIXME: try to find one half of candidates before and the other - ;; half after when there is a lot of data before and after. - (let ((helm-dabbrev-candidates-number-limit helm-dabbrev-cycle-threshold)) - (helm-dabbrev--get-candidates dabbrev)) - helm-dabbrev--cache)) - ;;;###autoload (defun helm-dabbrev () "Preconfigured helm for dynamic abbreviations." @@ -288,17 +257,17 @@ This is experimental and not fully working, you should not use this.") (not (eq last-command 'helm-dabbrev))) (setq helm-dabbrev--data nil)) (when cycling-disabled-p - (setq helm-dabbrev--cache (helm-dabbrev--cache-data dabbrev))) + (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev))) (unless (or cycling-disabled-p (helm-dabbrev-info-p helm-dabbrev--data)) - (setq helm-dabbrev--cache (helm-dabbrev--cache-data dabbrev)) + (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev)) (setq helm-dabbrev--data (make-helm-dabbrev-info :dabbrev dabbrev :limits limits :iterator (helm-iter-list - (cl-loop for i in (helm-dabbrev--get-candidates-info dabbrev) + (cl-loop for i in helm-dabbrev--cache when (and i (string-match (concat "^" (regexp-quote dabbrev)) i)) collect i into selection |