Subject: bug#1797: 23.0.60; completing-read breaks backwards compatibility

From: Ulrich Mueller <[email-masked]>
Date: Tue, 6 Jan 2009 10:34:52 +0100

>>>>> On Mon, 05 Jan 2009, Stefan Monnier wrote:

> Thanks.  I installed a change which I believe should fix this bug.

I confirm that today's CVS trunk is working as expected.

> Note that your completion function is a prime example of a completion
> table that needs completion-boundaries in order to work right.

>                     ((eq (car-safe mode) 'boundaries)
>                      (lexical-let* ((suffix (cdr mode))
>                                     (start (or (match-end 1) 0))
>                                     (end (string-match "\\s-" suffix)))
>                        (lambda (s table pred)
>                          `(boundaries ,start . ,end))))

Hey, I had already come to a very similar solution: ;-)

 (defun my-complete (s pred mode)
   (string-match "^\\(.*\\s-\\)?\\(.*\\)$" s)
+  (if (eq (car-safe mode) 'boundaries) ; GNU Emacs 23
+      (cons 'boundaries
+            (cons (match-beginning 2)
+                  (string-match "\\s-" (cdr mode))))
   (let* ((s1 (match-string 1 s))
          (s2 (match-string 2 s))

It cost me quite some time to get this right, because of the missing
documentation.

Ulrich