diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-12-07 20:06:26 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-12-07 20:06:26 +0000 |
commit | 51ef56c47fc0b02b20f44b673f8b60350c03b4e1 (patch) | |
tree | f3c898b5885cfc9cdca8681966bd223d3ee19ff7 /lisp/emacs-lisp | |
parent | 5e7a90229a1c32ded160a6d27f4ad9f3c66f60c3 (diff) | |
download | emacs-51ef56c47fc0b02b20f44b673f8b60350c03b4e1.tar.gz emacs-51ef56c47fc0b02b20f44b673f8b60350c03b4e1.tar.bz2 emacs-51ef56c47fc0b02b20f44b673f8b60350c03b4e1.zip |
* minibuffer.el (completion-at-point-functions): New var.
(completion-at-point): New command.
* indent.el (indent-for-tab-command): Handle the new `complete' behavior.
* progmodes/python.el (python-mode-map): Use completion-at-point.
(python-completion-at-point): Rename from python-partial-symbol and
adjust for use in completion-at-point-functions.
(python-mode): Setup completion-at-point for Python completion.
* emacs-lisp/lisp.el (lisp-completion-at-point): New function
extracted from lisp-complete-symbol.
(lisp-complete-symbol): Use it.
* emacs-lisp/lisp-mode.el (emacs-lisp-mode): Use define-derived-mode,
setup completion-at-point for Elisp completion.
(emacs-lisp-mode-map, lisp-interaction-mode-map): Use completion-at-point.
* ielm.el (ielm-map): Use completion-at-point.
(inferior-emacs-lisp-mode): Setup completion-at-point for Elisp completion.
* progmodes/sym-comp.el: Move to...
* obsolete/sym-comp.el: Move from progmodes.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 21 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 18 |
2 files changed, 22 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a42ef5da930..7e5d89c66dc 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -280,7 +280,7 @@ font-lock keywords will not be case sensitive." (prof-map (make-sparse-keymap)) (tracing-map (make-sparse-keymap))) (set-keymap-parent map lisp-mode-shared-map) - (define-key map "\e\t" 'lisp-complete-symbol) + (define-key map "\e\t" 'completion-at-point) (define-key map "\e\C-x" 'eval-defun) (define-key map "\e\C-q" 'indent-pp-sexp) (define-key map [menu-bar emacs-lisp] (cons (purecopy "Emacs-Lisp") menu-map)) @@ -431,7 +431,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") :type 'hook :group 'lisp) -(defun emacs-lisp-mode () +(define-derived-mode emacs-lisp-mode nil "Emacs-Lisp" "Major mode for editing Lisp code to run in Emacs. Commands: Delete converts tabs to spaces as it moves back. @@ -440,16 +440,11 @@ Blank lines separate paragraphs. Semicolons start comments. \\{emacs-lisp-mode-map} Entry to this mode calls the value of `emacs-lisp-mode-hook' if that value is non-nil." - (interactive) - (kill-all-local-variables) - (use-local-map emacs-lisp-mode-map) - (set-syntax-table emacs-lisp-mode-syntax-table) - (setq major-mode 'emacs-lisp-mode) - (setq mode-name "Emacs-Lisp") + :group 'lisp (lisp-mode-variables) (setq imenu-case-fold-search nil) - (run-mode-hooks 'emacs-lisp-mode-hook)) -(put 'emacs-lisp-mode 'custom-mode-group 'lisp) + (add-hook 'completion-at-point-functions + 'lisp-completion-at-point nil 'local)) (defvar lisp-mode-map (let ((map (make-sparse-keymap)) @@ -519,7 +514,7 @@ if that value is non-nil." (set-keymap-parent map lisp-mode-shared-map) (define-key map "\e\C-x" 'eval-defun) (define-key map "\e\C-q" 'indent-pp-sexp) - (define-key map "\e\t" 'lisp-complete-symbol) + (define-key map "\e\t" 'completion-at-point) (define-key map "\n" 'eval-print-last-sexp) (define-key map [menu-bar lisp-interaction] (cons (purecopy "Lisp-Interaction") menu-map)) (define-key menu-map [eval-defun] @@ -535,8 +530,8 @@ if that value is non-nil." (define-key menu-map [indent-pp-sexp] `(menu-item ,(purecopy "Indent or Pretty-Print") indent-pp-sexp :help ,(purecopy "Indent each line of the list starting just after point, or prettyprint it"))) - (define-key menu-map [lisp-complete-symbol] - `(menu-item ,(purecopy "Complete Lisp Symbol") lisp-complete-symbol + (define-key menu-map [complete-symbol] + `(menu-item ,(purecopy "Complete Lisp Symbol") completion-at-point :help ,(purecopy "Perform completion on Lisp symbol preceding point"))) map) "Keymap for Lisp Interaction mode. diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 0edd6556dbf..d364f2cb602 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -622,6 +622,15 @@ symbols with function definitions are considered. Otherwise, all symbols with function definitions, values or properties are considered." (interactive) + (let* ((data (lisp-completion-at-point predicate)) + (plist (nthcdr 3 data))) + (let ((completion-annotate-function (plist-get plist :annotate-function))) + (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data) + (plist-get plist :predicate))))) + + +(defun lisp-completion-at-point (&optional predicate) + ;; FIXME: the `end' could be after point? (let* ((end (point)) (beg (with-syntax-table emacs-lisp-mode-syntax-table (save-excursion @@ -648,10 +657,11 @@ considered." nil ;; Else, we assume that a function name is expected. 'fboundp)))))) - (let ((completion-annotate-function - (unless (eq predicate 'fboundp) - (lambda (str) (if (fboundp (intern-soft str)) " <f>"))))) - (completion-in-region beg end obarray predicate)))) + (list beg end obarray + :predicate predicate + :annotate-function + (unless (eq predicate 'fboundp) + (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))) ;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e ;;; lisp.el ends here |