Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 106482:806e9f7990d8
* 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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 07 Dec 2009 20:06:26 +0000 |
parents | d1bb0f3aad35 |
children | eb87371a1cc7 |
comparison
equal
deleted
inserted
replaced
106481:665bd5e777e1 | 106482:806e9f7990d8 |
---|---|
278 (menu-map (make-sparse-keymap "Emacs-Lisp")) | 278 (menu-map (make-sparse-keymap "Emacs-Lisp")) |
279 (lint-map (make-sparse-keymap)) | 279 (lint-map (make-sparse-keymap)) |
280 (prof-map (make-sparse-keymap)) | 280 (prof-map (make-sparse-keymap)) |
281 (tracing-map (make-sparse-keymap))) | 281 (tracing-map (make-sparse-keymap))) |
282 (set-keymap-parent map lisp-mode-shared-map) | 282 (set-keymap-parent map lisp-mode-shared-map) |
283 (define-key map "\e\t" 'lisp-complete-symbol) | 283 (define-key map "\e\t" 'completion-at-point) |
284 (define-key map "\e\C-x" 'eval-defun) | 284 (define-key map "\e\C-x" 'eval-defun) |
285 (define-key map "\e\C-q" 'indent-pp-sexp) | 285 (define-key map "\e\C-q" 'indent-pp-sexp) |
286 (define-key map [menu-bar emacs-lisp] (cons (purecopy "Emacs-Lisp") menu-map)) | 286 (define-key map [menu-bar emacs-lisp] (cons (purecopy "Emacs-Lisp") menu-map)) |
287 (define-key menu-map [eldoc] | 287 (define-key menu-map [eldoc] |
288 `(menu-item ,(purecopy "Auto-Display Documentation Strings") eldoc-mode | 288 `(menu-item ,(purecopy "Auto-Display Documentation Strings") eldoc-mode |
429 "Hook run when entering Lisp Interaction mode." | 429 "Hook run when entering Lisp Interaction mode." |
430 :options '(turn-on-eldoc-mode) | 430 :options '(turn-on-eldoc-mode) |
431 :type 'hook | 431 :type 'hook |
432 :group 'lisp) | 432 :group 'lisp) |
433 | 433 |
434 (defun emacs-lisp-mode () | 434 (define-derived-mode emacs-lisp-mode nil "Emacs-Lisp" |
435 "Major mode for editing Lisp code to run in Emacs. | 435 "Major mode for editing Lisp code to run in Emacs. |
436 Commands: | 436 Commands: |
437 Delete converts tabs to spaces as it moves back. | 437 Delete converts tabs to spaces as it moves back. |
438 Blank lines separate paragraphs. Semicolons start comments. | 438 Blank lines separate paragraphs. Semicolons start comments. |
439 | 439 |
440 \\{emacs-lisp-mode-map} | 440 \\{emacs-lisp-mode-map} |
441 Entry to this mode calls the value of `emacs-lisp-mode-hook' | 441 Entry to this mode calls the value of `emacs-lisp-mode-hook' |
442 if that value is non-nil." | 442 if that value is non-nil." |
443 (interactive) | 443 :group 'lisp |
444 (kill-all-local-variables) | |
445 (use-local-map emacs-lisp-mode-map) | |
446 (set-syntax-table emacs-lisp-mode-syntax-table) | |
447 (setq major-mode 'emacs-lisp-mode) | |
448 (setq mode-name "Emacs-Lisp") | |
449 (lisp-mode-variables) | 444 (lisp-mode-variables) |
450 (setq imenu-case-fold-search nil) | 445 (setq imenu-case-fold-search nil) |
451 (run-mode-hooks 'emacs-lisp-mode-hook)) | 446 (add-hook 'completion-at-point-functions |
452 (put 'emacs-lisp-mode 'custom-mode-group 'lisp) | 447 'lisp-completion-at-point nil 'local)) |
453 | 448 |
454 (defvar lisp-mode-map | 449 (defvar lisp-mode-map |
455 (let ((map (make-sparse-keymap)) | 450 (let ((map (make-sparse-keymap)) |
456 (menu-map (make-sparse-keymap "Lisp"))) | 451 (menu-map (make-sparse-keymap "Lisp"))) |
457 (set-keymap-parent map lisp-mode-shared-map) | 452 (set-keymap-parent map lisp-mode-shared-map) |
517 (let ((map (make-sparse-keymap)) | 512 (let ((map (make-sparse-keymap)) |
518 (menu-map (make-sparse-keymap "Lisp-Interaction"))) | 513 (menu-map (make-sparse-keymap "Lisp-Interaction"))) |
519 (set-keymap-parent map lisp-mode-shared-map) | 514 (set-keymap-parent map lisp-mode-shared-map) |
520 (define-key map "\e\C-x" 'eval-defun) | 515 (define-key map "\e\C-x" 'eval-defun) |
521 (define-key map "\e\C-q" 'indent-pp-sexp) | 516 (define-key map "\e\C-q" 'indent-pp-sexp) |
522 (define-key map "\e\t" 'lisp-complete-symbol) | 517 (define-key map "\e\t" 'completion-at-point) |
523 (define-key map "\n" 'eval-print-last-sexp) | 518 (define-key map "\n" 'eval-print-last-sexp) |
524 (define-key map [menu-bar lisp-interaction] (cons (purecopy "Lisp-Interaction") menu-map)) | 519 (define-key map [menu-bar lisp-interaction] (cons (purecopy "Lisp-Interaction") menu-map)) |
525 (define-key menu-map [eval-defun] | 520 (define-key menu-map [eval-defun] |
526 `(menu-item ,(purecopy "Evaluate Defun") eval-defun | 521 `(menu-item ,(purecopy "Evaluate Defun") eval-defun |
527 :help ,(purecopy "Evaluate the top-level form containing point, or after point"))) | 522 :help ,(purecopy "Evaluate the top-level form containing point, or after point"))) |
533 :help ,(purecopy "Evaluate the top level form point is in, stepping through with Edebug") | 528 :help ,(purecopy "Evaluate the top level form point is in, stepping through with Edebug") |
534 :keys ,(purecopy "C-u C-M-x"))) | 529 :keys ,(purecopy "C-u C-M-x"))) |
535 (define-key menu-map [indent-pp-sexp] | 530 (define-key menu-map [indent-pp-sexp] |
536 `(menu-item ,(purecopy "Indent or Pretty-Print") indent-pp-sexp | 531 `(menu-item ,(purecopy "Indent or Pretty-Print") indent-pp-sexp |
537 :help ,(purecopy "Indent each line of the list starting just after point, or prettyprint it"))) | 532 :help ,(purecopy "Indent each line of the list starting just after point, or prettyprint it"))) |
538 (define-key menu-map [lisp-complete-symbol] | 533 (define-key menu-map [complete-symbol] |
539 `(menu-item ,(purecopy "Complete Lisp Symbol") lisp-complete-symbol | 534 `(menu-item ,(purecopy "Complete Lisp Symbol") completion-at-point |
540 :help ,(purecopy "Perform completion on Lisp symbol preceding point"))) | 535 :help ,(purecopy "Perform completion on Lisp symbol preceding point"))) |
541 map) | 536 map) |
542 "Keymap for Lisp Interaction mode. | 537 "Keymap for Lisp Interaction mode. |
543 All commands in `lisp-mode-shared-map' are inherited by this map.") | 538 All commands in `lisp-mode-shared-map' are inherited by this map.") |
544 | 539 |