emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99953: (lisp-completion-at-point): C


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99953: (lisp-completion-at-point): Complete around point.
Date: Tue, 20 Apr 2010 12:37:31 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99953
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2010-04-20 12:37:31 -0400
message:
  (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.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/lisp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-20 14:45:14 +0000
+++ b/lisp/ChangeLog    2010-04-20 16:37:31 +0000
@@ -1,5 +1,9 @@
 2010-04-20  Stefan Monnier  <address@hidden>
 
+       * 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.
 

=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el   2010-01-13 08:35:10 +0000
+++ b/lisp/emacs-lisp/lisp.el   2010-04-20 16:37:31 +0000
@@ -631,12 +631,11 @@
 
 (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 @@
                       ;; 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


reply via email to

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