summaryrefslogtreecommitdiff
path: root/lisp/icomplete.el
diff options
context:
space:
mode:
authorJambunathan K <kjambunathan@gmail.com>2013-02-08 09:53:55 +0200
committerJuri Linkov <juri@jurta.org>2013-02-08 09:53:55 +0200
commit6130b96ae7ed9632e7623fb86eac695edc401098 (patch)
treed20726ea9b6c0b78361bc6813459d6869e077bd5 /lisp/icomplete.el
parent25721f5bb5681c22f666a0b4e61d94687d92a671 (diff)
downloademacs-6130b96ae7ed9632e7623fb86eac695edc401098.tar.gz
* lisp/icomplete.el (icomplete-forward-completions)
(icomplete-backward-completions): Handle corner case. Fixes: debbugs:13602
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r--lisp/icomplete.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 9407de4f6d9..8e4dd69e199 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -167,8 +167,9 @@ Second entry becomes the first and can be selected with
(interactive)
(let* ((comps (completion-all-sorted-completions))
(last (last comps)))
- (setcdr last (cons (car comps) (cdr last)))
- (completion--cache-all-sorted-completions (cdr comps))))
+ (when comps
+ (setcdr last (cons (car comps) (cdr last)))
+ (completion--cache-all-sorted-completions (cdr comps)))))
(defun icomplete-backward-completions ()
"Step backward completions by one entry.
@@ -178,7 +179,7 @@ Last entry becomes the first and can be selected with
(let* ((comps (completion-all-sorted-completions))
(last-but-one (last comps 2))
(last (cdr last-but-one)))
- (when last
+ (when (consp last) ; At least two elements in comps
(setcdr last-but-one (cdr last))
(push (car last) comps)
(completion--cache-all-sorted-completions comps))))