2009-12-07 Stefan Monnier <monnier@iro.umontreal.ca>
+ * textmodes/tex-mode.el (latex-complete)
+ (latex-indent-or-complete): Remove.
+ (latex-mode): Set completion-at-point-functions instead.
+
+ Provide a standard completion command and hook it into TAB.
* minibuffer.el (completion-at-point-functions): New var.
(completion-at-point): New command.
- * indent.el (indent-for-tab-command): Handle the new `complete' behavior.
+ * indent.el (indent-for-tab-command): Handle the `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.
(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.
+ (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.
+ (inferior-emacs-lisp-mode): Setup completion-at-point-functions.
* progmodes/sym-comp.el: Move to...
* obsolete/sym-comp.el: Move from progmodes.
(add-hook 'fill-nobreak-predicate 'latex-fill-nobreak-predicate nil t)
(set (make-local-variable 'indent-line-function) 'latex-indent)
(set (make-local-variable 'fill-indent-according-to-mode) t)
+ (add-hook 'completion-at-point-functions
+ 'latex-complete-data nil 'local)
(set (make-local-variable 'outline-regexp) latex-outline-regexp)
(set (make-local-variable 'outline-level) 'latex-outline-level)
(set (make-local-variable 'forward-sexp-function) 'latex-forward-sexp)
nil
(list comp-beg comp-end table))))))))
-(defun latex-complete ()
- "Perform completion at point for LaTeX mode.
-Return non-nil if we found what to complete."
- (interactive)
- (let ((data (latex-complete-data)))
- (when data
- (apply 'completion-in-region data)
- t)))
-
-(defun latex-indent-or-complete ()
- "Perform completion at point or indentation, according to DWIM.
-The heuristic is to try indentation, if that fails try completion,
-if that fails insert a tab."
- (interactive)
- (let ((undo buffer-undo-list)
- (pos (point)))
- (indent-according-to-mode)
- (or (not (and (eq pos (point)) (eq undo buffer-undo-list)))
- (latex-complete)
- (insert-tab))))
-
;;;;
;;;; LaTeX syntax navigation
;;;;