summaryrefslogtreecommitdiff
path: root/helm-dabbrev.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-28 07:46:38 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-28 07:46:38 +0200
commit3d7643ca00461c21e2c735b5ad0564039a2a71bd (patch)
treec9ec13afcaca0fd7286443a94d51d0a9dab5ba9c /helm-dabbrev.el
parent3faa5bada47f90963791a349da18d0c45ea87e02 (diff)
Fix pos-before and pos-after in helm-dabbrev
when previous fn reach limit. * helm-dabbrev.el (helm-dabbrev--collect): Do it.
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r--helm-dabbrev.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el
index c296818d..95232aea 100644
--- a/helm-dabbrev.el
+++ b/helm-dabbrev.el
@@ -183,12 +183,18 @@ but the initial search for all candidates in buffer(s)."
(funcall search-and-store str 2)) ; store pos [2]
(save-excursion
;; Search all before point.
- (goto-char pos-before) ; start from [1]
- (funcall search-and-store str -1))
+ ;; If limit is reached in previous call of
+ ;; search-and-store pos-before is never set and
+ ;; goto-char will fail, so check it.
+ (when pos-before
+ (goto-char pos-before) ; start from [1]
+ (funcall search-and-store str -1)))
(save-excursion
;; Search all after point.
- (goto-char pos-after) ; start from [2]
- (funcall search-and-store str 1))))
+ ;; Same comment as above for pos-after.
+ (when pos-after
+ (goto-char pos-after) ; start from [2]
+ (funcall search-and-store str 1)))))
when (>= (length result) limit) return (nreverse result)
finally return (nreverse result))))