(latex-complete, latex-indent-or-complete): Remove.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 7 Dec 2009 21:15:19 +0000 (21:15 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 7 Dec 2009 21:15:19 +0000 (21:15 +0000)
(latex-mode): Set completion-at-point-functions instead.

lisp/ChangeLog
lisp/textmodes/tex-mode.el

index 1eec4f8..4045f55 100644 (file)
@@ -1,8 +1,13 @@
 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.
 
index 3cbd6e1..7443db7 100644 (file)
@@ -1076,6 +1076,8 @@ subshell is initiated, `tex-shell-hook' is run."
   (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)
@@ -1509,27 +1511,6 @@ Puts point on a blank line between them."
                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
 ;;;;