From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Wed, 25 Nov 2009 06:08:42 +0000 (+0000)
Subject: * progmodes/meta-mode.el (meta-complete-symbol):
X-Git-Tag: emacs-pretest-23.1.90~235
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d6b8d4e75e3b293ebe643c102ee821c20efe925c;p=emacs.git

* progmodes/meta-mode.el (meta-complete-symbol):
* progmodes/etags.el (complete-tag): Use completion-in-region.
---

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 002a04641b7..915ad94959f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
 2009-11-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* progmodes/meta-mode.el (meta-complete-symbol):
+	* progmodes/etags.el (complete-tag):
 	* mail/mailabbrev.el (mail-abbrev-complete-alias):
 	Use completion-in-region.
 
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index f3c37916330..2893fdfb766 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2047,28 +2047,13 @@ for \\[find-tag] (which see)."
 			      (get major-mode 'find-tag-default-function)
 			      'find-tag-default)))
         (comp-table (tags-lazy-completion-table))
-	beg
-	completion)
+	beg)
     (or pattern
 	(error "Nothing to complete"))
     (search-backward pattern)
     (setq beg (point))
     (forward-char (length pattern))
-    (setq completion (try-completion pattern comp-table))
-    (cond ((eq completion t))
-	  ((null completion)
-	   (message "Can't find completion for \"%s\"" pattern)
-	   (ding))
-	  ((not (string= pattern completion))
-	   (delete-region beg (point))
-	   (insert completion))
-	  (t
-	   (message "Making completion list...")
-	   (with-output-to-temp-buffer "*Completions*"
-	     (display-completion-list
-	      (all-completions pattern comp-table nil)
-	      pattern))
-	   (message "Making completion list...%s" "done")))))
+    (completion-in-region beg (point) comp-table)))
 
 (dolist (x '("^No tags table in use; use .* to select one$"
 	     "^There is no default tag$"
diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el
index a52fd1d3d7e..ed6d87dcfae 100644
--- a/lisp/progmodes/meta-mode.el
+++ b/lisp/progmodes/meta-mode.el
@@ -487,29 +487,12 @@ If the list was changed, sort the list and remove duplicates first."
                (close (nth 3 entry))
                (begin (match-beginning sub))
                (end (match-end sub))
-               (pattern (meta-match-buffer 0))
-               (symbol (buffer-substring begin end))
-               (list (funcall (nth 2 entry)))
-               (completion (try-completion symbol list)))
-          (cond ((eq completion t)
-                 (and close
-                      (not (looking-at (regexp-quote close)))
-                      (insert close)))
-                ((null completion)
-                 (error "Can't find completion for \"%s\"" pattern))
-                ((not (string-equal symbol completion))
-                 (delete-region begin end)
-                 (insert completion)
-                 (and close
-                      (eq (try-completion completion list) t)
-                      (not (looking-at (regexp-quote close)))
-                      (insert close)))
-                (t
-                 (message "Making completion list...")
-                 (let ((list (all-completions symbol list nil)))
-                   (with-output-to-temp-buffer "*Completions*"
-                     (display-completion-list list symbol)))
-                 (message "Making completion list... done"))))
+               (list (funcall (nth 2 entry))))
+          (completion-in-region
+           begin end
+           (if (zerop (length close)) list
+             (apply-partially 'completion-table-with-terminator
+                              close list))))
       (funcall (nth 1 entry)))))