emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: partial-completion-mode error


From: Stefan Monnier
Subject: Re: Fwd: partial-completion-mode error
Date: Mon, 07 Aug 2006 14:06:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Would someone please DTRT and ack?

> Doing:

> emacs -q
> M-x partial-completion-mode RET

> C-x C-f /usr/share/X11/xkb/symbols/pc TAB TAB

> I get an error: Wrong type argument: sequencep, t

> The error seems to be thrown by the `aref' in the following code in
> PC-do-completion because `prefix' is nil:

I believe the patch below fixes it.


        Stefan


--- complete.el 02 aoû 2006 10:06:29 -0400      1.56
+++ complete.el 07 aoû 2006 14:01:36 -0400      
@@ -553,28 +553,6 @@
                   (setq poss (cons (car p) poss))))
            (setq p (cdr p)))))
 
-      ;; Now we have a list of possible completions
-      (cond
-
-       ;; No valid completions found
-       ((null poss)
-       (if (and (eq mode 'word)
-                (not PC-word-failed-flag))
-           (let ((PC-word-failed-flag t))
-             (delete-backward-char 1)
-             (PC-do-completion 'word))
-         (beep)
-         (PC-temp-minibuffer-message (if ambig
-                                         " [Ambiguous dir name]"
-                                       (if (eq mode 'help)
-                                           " [No completions]"
-                                         " [No match]")))
-         nil))
-
-       ;; More than one valid completion found
-       ((or (cdr (setq helpposs poss))
-           (memq mode '(help word)))
-
        ;; Handle completion-ignored-extensions
        (and filename
             (not (eq mode 'help))
@@ -603,6 +581,28 @@
               ;; If there are "good" names, use them
               (and p (setq poss p))))
 
+      ;; Now we have a list of possible completions
+      (cond
+
+       ;; No valid completions found
+       ((null poss)
+       (if (and (eq mode 'word)
+                (not PC-word-failed-flag))
+           (let ((PC-word-failed-flag t))
+             (delete-backward-char 1)
+             (PC-do-completion 'word))
+         (beep)
+         (PC-temp-minibuffer-message (if ambig
+                                         " [Ambiguous dir name]"
+                                       (if (eq mode 'help)
+                                           " [No completions]"
+                                         " [No match]")))
+         nil))
+
+       ;; More than one valid completion found
+       ((or (cdr (setq helpposs poss))
+           (memq mode '(help word)))
+
        ;; Is the actual string one of the possible completions?
        (setq p (and (not (eq mode 'help)) poss))
        (while (and p
@@ -623,7 +623,8 @@
 
            ;; Check if next few letters are the same in all cases
            (if (and (not (eq mode 'help))
-                    (setq prefix (try-completion (PC-chunk-after basestr skip) 
(mapcar 'list poss))))
+                    (setq prefix (try-completion (PC-chunk-after basestr skip)
+                                                  poss)))
                (let ((first t) i)
                  ;; Retain capitalization of user input even if
                  ;; completion-ignore-case is set.
@@ -669,13 +670,9 @@
                                              (+ beg (length dirname)) end)
                                             skip)
                                            (mapcar
-                                            (function
                                              (lambda (x)
-                                               (list
-                                                (and (string-match skip x)
-                                                     (substring
-                                                      x
-                                                      (match-end 0))))))
+                                               (when (string-match skip x)
+                                                 (substring x (match-end 0))))
                                             poss)))
                              (or (> i 0) (> (length prefix) 0))
                              (or (not (eq mode 'word))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]