diff options
| author | Stefan Monnier | 2010-04-20 12:37:31 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-04-20 12:37:31 -0400 |
| commit | 6e610c726148a9c931a9efcab89368a1b7beecac (patch) | |
| tree | d091b7ac888a90ff265f8f62880f0aae13658fc5 | |
| parent | 4a787cd27609777ba656f7bc548e27923b2da624 (diff) | |
| download | emacs-6e610c726148a9c931a9efcab89368a1b7beecac.tar.gz emacs-6e610c726148a9c931a9efcab89368a1b7beecac.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 24 |
2 files changed, 20 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 869907f2ae7..030d2f4fed9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2010-04-20 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2010-04-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/lisp.el (lisp-completion-at-point): Complete around point. | ||
| 4 | I.e. include text after point in the completion region. | ||
| 5 | Also, return nil when we're not after/in a symbol. | ||
| 6 | |||
| 3 | * international/mule-cmds.el (view-hello-file): Don't fiddle with the | 7 | * international/mule-cmds.el (view-hello-file): Don't fiddle with the |
| 4 | default enable-multibyte-characters. | 8 | default enable-multibyte-characters. |
| 5 | 9 | ||
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index da482e715b1..e6b9af95a73 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -631,12 +631,11 @@ considered." | |||
| 631 | 631 | ||
| 632 | (defun lisp-completion-at-point (&optional predicate) | 632 | (defun lisp-completion-at-point (&optional predicate) |
| 633 | ;; FIXME: the `end' could be after point? | 633 | ;; FIXME: the `end' could be after point? |
| 634 | (let* ((end (point)) | 634 | (let* ((pos (point)) |
| 635 | (beg (with-syntax-table emacs-lisp-mode-syntax-table | 635 | (beg (with-syntax-table emacs-lisp-mode-syntax-table |
| 636 | (save-excursion | 636 | (save-excursion |
| 637 | (backward-sexp 1) | 637 | (backward-sexp 1) |
| 638 | (while (= (char-syntax (following-char)) ?\') | 638 | (skip-syntax-forward "'") |
| 639 | (forward-char 1)) | ||
| 640 | (point)))) | 639 | (point)))) |
| 641 | (predicate | 640 | (predicate |
| 642 | (or predicate | 641 | (or predicate |
| @@ -656,12 +655,21 @@ considered." | |||
| 656 | ;; Maybe a `let' varlist or something. | 655 | ;; Maybe a `let' varlist or something. |
| 657 | nil | 656 | nil |
| 658 | ;; Else, we assume that a function name is expected. | 657 | ;; Else, we assume that a function name is expected. |
| 659 | 'fboundp)))))) | 658 | 'fboundp))))) |
| 660 | (list beg end obarray | 659 | (end |
| 661 | :predicate predicate | 660 | (unless (or (eq beg (point-max)) |
| 662 | :annotate-function | 661 | (member (char-syntax (char-after beg)) '(?\( ?\)))) |
| 662 | (save-excursion | ||
| 663 | (goto-char beg) | ||
| 664 | (forward-sexp 1) | ||
| 665 | (when (>= (point) pos) | ||
| 666 | (point)))))) | ||
| 667 | (when end | ||
| 668 | (list beg end obarray | ||
| 669 | :predicate predicate | ||
| 670 | :annotate-function | ||
| 663 | (unless (eq predicate 'fboundp) | 671 | (unless (eq predicate 'fboundp) |
| 664 | (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))) | 672 | (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))) |
| 665 | 673 | ||
| 666 | ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e | 674 | ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e |
| 667 | ;;; lisp.el ends here | 675 | ;;; lisp.el ends here |