]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lisp.el
Merge changes from emacs-23 branch.
[gnu-emacs] / lisp / emacs-lisp / lisp.el
index cfb56eb32328d13ae4794fb74eb2fd709a35b676..d0d1520a6770ff84a06a6fe768bd17bd7a3c892e 100644 (file)
@@ -646,49 +646,49 @@ considered."
 (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?
-  (let* ((pos (point))
-         (beg (with-syntax-table emacs-lisp-mode-syntax-table
-                (condition-case nil
-                    (save-excursion
-                      (backward-sexp 1)
-                      (skip-syntax-forward "'")
-                      (point))
-                  (scan-error pos))))
-         (predicate
-          (or predicate
-              (save-excursion
-                (goto-char beg)
-                (if (not (eq (char-before) ?\())
-                    (lambda (sym)      ;why not just nil ?   -sm
-                      (or (boundp sym) (fboundp sym)
-                          (symbol-plist sym)))
-                  ;; Looks like a funcall position.  Let's double check.
-                  (if (condition-case nil
-                          (progn (up-list -2) (forward-char 1)
-                                 (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.
-                      ;; Maybe a `let' varlist or something.
-                      nil
-                    ;; Else, we assume that a function name is expected.
-                    'fboundp)))))
-         (end
-          (unless (or (eq beg (point-max))
-                      (member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
-            (condition-case nil
-                (save-excursion
-                  (goto-char beg)
-                  (forward-sexp 1)
-                  (when (>= (point) pos)
-                    (point)))
-                  (scan-error pos)))))
-    (when end
-      (list beg end obarray
-            :predicate predicate
-            :annotate-function
-            (unless (eq predicate 'fboundp)
-              (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))))
+  (with-syntax-table emacs-lisp-mode-syntax-table
+    (let* ((pos (point))
+          (beg (condition-case nil
+                   (save-excursion
+                     (backward-sexp 1)
+                     (skip-syntax-forward "'")
+                     (point))
+                 (scan-error pos)))
+          (predicate
+           (or predicate
+               (save-excursion
+                 (goto-char beg)
+                 (if (not (eq (char-before) ?\())
+                     (lambda (sym)          ;why not just nil ?   -sm
+                       (or (boundp sym) (fboundp sym)
+                           (symbol-plist sym)))
+                   ;; Looks like a funcall position.  Let's double check.
+                   (if (condition-case nil
+                           (progn (up-list -2) (forward-char 1)
+                                  (eq (char-after) ?\())
+                         (error nil))
+                       ;; If the first element of the parent list is an open
+                       ;; 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.
+                     'fboundp)))))
+          (end
+           (unless (or (eq beg (point-max))
+                       (member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
+             (condition-case nil
+                 (save-excursion
+                   (goto-char beg)
+                   (forward-sexp 1)
+                   (when (>= (point) pos)
+                     (point)))
+               (scan-error pos)))))
+      (when end
+       (list beg end obarray
+             :predicate predicate
+             :annotate-function
+             (unless (eq predicate 'fboundp)
+               (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))))
 
 ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
 ;;; lisp.el ends here