Mercurial > emacs
comparison lisp/emacs-lisp/lisp.el @ 110927:81696c97193b
* lisp/emacs-lisp/lisp.el (lisp-completion-at-point):
Use emacs-lisp-mode-syntax-table for the whole function.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 09 Oct 2010 17:43:43 +0200 |
parents | 497767b878dc |
children | 2316b868d5be 376148b31b5e |
comparison
equal
deleted
inserted
replaced
110926:a98040347deb | 110927:81696c97193b |
---|---|
630 | 630 |
631 | 631 |
632 (defun lisp-completion-at-point (&optional predicate) | 632 (defun lisp-completion-at-point (&optional predicate) |
633 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." | 633 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." |
634 ;; FIXME: the `end' could be after point? | 634 ;; FIXME: the `end' could be after point? |
635 (let* ((end (point)) | 635 (with-syntax-table emacs-lisp-mode-syntax-table |
636 (beg (with-syntax-table emacs-lisp-mode-syntax-table | 636 (let* ((end (point)) |
637 (save-excursion | 637 (beg (save-excursion |
638 (backward-sexp 1) | 638 (backward-sexp 1) |
639 (while (= (char-syntax (following-char)) ?\') | 639 (while (= (char-syntax (following-char)) ?\') |
640 (forward-char 1)) | 640 (forward-char 1)) |
641 (point)))) | 641 (point))) |
642 (predicate | 642 (predicate |
643 (or predicate | 643 (or predicate |
644 (save-excursion | 644 (save-excursion |
645 (goto-char beg) | 645 (goto-char beg) |
646 (if (not (eq (char-before) ?\()) | 646 (if (not (eq (char-before) ?\()) |
647 (lambda (sym) ;why not just nil ? -sm | 647 (lambda (sym) ;why not just nil ? -sm |
648 (or (boundp sym) (fboundp sym) | 648 (or (boundp sym) (fboundp sym) |
649 (symbol-plist sym))) | 649 (symbol-plist sym))) |
650 ;; Looks like a funcall position. Let's double check. | 650 ;; Looks like a funcall position. Let's double check. |
651 (if (condition-case nil | 651 (if (condition-case nil |
652 (progn (up-list -2) (forward-char 1) | 652 (progn (up-list -2) (forward-char 1) |
653 (eq (char-after) ?\()) | 653 (eq (char-after) ?\()) |
654 (error nil)) | 654 (error nil)) |
655 ;; If the first element of the parent list is an open | 655 ;; If the first element of the parent list is an open |
656 ;; parenthesis we are probably not in a funcall position. | 656 ;; paren we are probably not in a funcall position. |
657 ;; Maybe a `let' varlist or something. | 657 ;; Maybe a `let' varlist or something. |
658 nil | 658 nil |
659 ;; Else, we assume that a function name is expected. | 659 ;; Else, we assume that a function name is expected. |
660 'fboundp)))))) | 660 'fboundp)))))) |
661 (list beg end obarray | 661 (list beg end obarray |
662 :predicate predicate | 662 :predicate predicate |
663 :annotate-function | 663 :annotate-function |
664 (unless (eq predicate 'fboundp) | 664 (unless (eq predicate 'fboundp) |
665 (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))) | 665 (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))) |
666 | 666 |
667 ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e | 667 ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e |
668 ;;; lisp.el ends here | 668 ;;; lisp.el ends here |