changeset 106484:fbf8c0853c94

(latex-complete, latex-indent-or-complete): Remove. (latex-mode): Set completion-at-point-functions instead.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 07 Dec 2009 21:15:19 +0000
parents d34942d911b5
children 85eebb6799d7
files lisp/ChangeLog lisp/textmodes/tex-mode.el
diffstat 2 files changed, 11 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Dec 07 20:27:40 2009 +0000
+++ b/lisp/ChangeLog	Mon Dec 07 21:15:19 2009 +0000
@@ -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.
@@ -12,9 +17,10 @@
 	(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.
 
--- a/lisp/textmodes/tex-mode.el	Mon Dec 07 20:27:40 2009 +0000
+++ b/lisp/textmodes/tex-mode.el	Mon Dec 07 21:15:19 2009 +0000
@@ -1076,6 +1076,8 @@
   (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 @@
                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
 ;;;;