]> git.eshelyaron.com Git - emacs.git/commitdiff
(lisp-completion-at-point): Complete around point.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 20 Apr 2010 16:37:31 +0000 (12:37 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 20 Apr 2010 16:37:31 +0000 (12:37 -0400)
I.e. include text after point in the completion region.
Also, return nil when we're not after/in a symbol.

lisp/ChangeLog
lisp/emacs-lisp/lisp.el

index 869907f2ae719a620234fb9a801879e0f5a0b044..030d2f4fed9f79e56581bbf929be25ad49513ac0 100644 (file)
@@ -1,5 +1,9 @@
 2010-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * emacs-lisp/lisp.el (lisp-completion-at-point): Complete around point.
+       I.e. include text after point in the completion region.
+       Also, return nil when we're not after/in a symbol.
+
        * international/mule-cmds.el (view-hello-file): Don't fiddle with the
        default enable-multibyte-characters.
 
index da482e715b14ce450710159cc56a6bcebaabc482..e6b9af95a7382d8deb31534f3bdd84ca5a8e08e2 100644 (file)
@@ -631,12 +631,11 @@ considered."
 
 (defun lisp-completion-at-point (&optional predicate)
   ;; FIXME: the `end' could be after point?
-  (let* ((end (point))
+  (let* ((pos (point))
          (beg (with-syntax-table emacs-lisp-mode-syntax-table
                 (save-excursion
                   (backward-sexp 1)
-                  (while (= (char-syntax (following-char)) ?\')
-                    (forward-char 1))
+                  (skip-syntax-forward "'")
                   (point))))
          (predicate
           (or predicate
@@ -656,12 +655,21 @@ considered."
                       ;; Maybe a `let' varlist or something.
                       nil
                     ;; Else, we assume that a function name is expected.
-                    'fboundp))))))
-    (list beg end obarray
-          :predicate predicate
-          :annotate-function
+                    'fboundp)))))
+         (end
+          (unless (or (eq beg (point-max))
+                      (member (char-syntax (char-after beg)) '(?\( ?\))))
+            (save-excursion
+              (goto-char beg)
+              (forward-sexp 1)
+              (when (>= (point) pos)
+                (point))))))
+    (when end
+      (list beg end obarray
+            :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