aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/lisp.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2010-04-20 12:37:31 -0400
committerStefan Monnier <[email protected]>2010-04-20 12:37:31 -0400
commit6e610c726148a9c931a9efcab89368a1b7beecac (patch)
treed091b7ac888a90ff265f8f62880f0aae13658fc5 /lisp/emacs-lisp/lisp.el
parent4a787cd27609777ba656f7bc548e27923b2da624 (diff)
(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.
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
-rw-r--r--lisp/emacs-lisp/lisp.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index da482e715b..e6b9af95a7 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -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