Subject: bug#7147: 24.0.50; M-: minibuffer completion chokes at `:'

From: Stefan Monnier <[email-masked]>
Date: Sat, 09 Oct 2010 17:46:58 +0200

> Steps to reproduce:

> emacs -Q

> (defun too:bad () nil)

> M-: (too M-TAB
> => lists completions including `too:bad'

> M-: (too: M-TAB
> => [Nothing to complete]

Thanks.  A similar problem exists in Emacs-23, tho with slightly less
severe symptoms.  I've checked the fix below in emacs-23 which will
propagate to trunk soonish.
Please confirm when it is fixed,

        Stefan

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2010-10-09 10:51:42 +0000
+++ lisp/ChangeLog	2010-10-09 15:41:56 +0000
@@ -1,3 +1,8 @@
+2010-10-09  Stefan Monnier  <[email-masked]>
+
+	* emacs-lisp/lisp.el (lisp-completion-at-point):
+	Use emacs-lisp-mode-syntax-table for the whole function.
+
 2010-10-09  Richard Sharman  <[email-masked]>  (tiny change)
 
 	* progmodes/gdb-ui.el (gdb-mouse-toggle-breakpoint-margin)

=== modified file 'lisp/emacs-lisp/lisp.el'
--- lisp/emacs-lisp/lisp.el	2010-04-20 07:54:28 +0000
+++ lisp/emacs-lisp/lisp.el	2010-10-09 15:37:41 +0000
@@ -632,13 +632,13 @@
 (defun lisp-completion-at-point (&optional predicate)
   "Function used for `completion-at-point-functions' in `emacs-lisp-mode'."
   ;; FIXME: the `end' could be after point?
+  (with-syntax-table emacs-lisp-mode-syntax-table
   (let* ((end (point))
-         (beg (with-syntax-table emacs-lisp-mode-syntax-table
-                (save-excursion
+           (beg (save-excursion
                   (backward-sexp 1)
                   (while (= (char-syntax (following-char)) ?\')
                     (forward-char 1))
-                  (point))))
+                  (point)))
          (predicate
           (or predicate
               (save-excursion
@@ -653,7 +653,7 @@
                                  (eq (char-after) ?\())
                         (error nil))
                       ;; If the first element of the parent list is an open
-                      ;; parenthesis we are probably not in a funcall position.
+                        ;; paren we are probably not in a funcall position.
                       ;; Maybe a `let' varlist or something.
                       nil
                     ;; Else, we assume that a function name is expected.
@@ -662,7 +662,7 @@
           :predicate predicate
           :annotate-function
             (unless (eq predicate 'fboundp)
-              (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))
+              (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))))
 
 ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
 ;;; lisp.el ends here