emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/etags.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/etags.el,v
Date: Sat, 05 Apr 2008 03:31:51 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/04/05 03:31:51

Index: etags.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/etags.el,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -b -r1.206 -r1.207
--- etags.el    11 Feb 2008 17:35:37 -0000      1.206
+++ etags.el    5 Apr 2008 03:31:50 -0000       1.207
@@ -780,17 +780,15 @@
        (quit (message "Tags completion table construction aborted.")
              (setq tags-completion-table nil)))))
 
-(defun tags-complete-tag (string predicate what)
-  "Completion function for tags.
-Does normal `try-completion', but builds `tags-completion-table' on
-demand."
+(defun tags-lazy-completion-table ()
+  (lexical-let ((buf (current-buffer)))
+    (lambda (string pred action)
+      (with-current-buffer buf
   (save-excursion
     ;; If we need to ask for the tag table, allow that.
     (let ((enable-recursive-minibuffers t))
       (visit-tags-table-buffer))
-    (if (eq what t)
-       (all-completions string (tags-completion-table) predicate)
-      (try-completion string (tags-completion-table) predicate))))
+          (complete-with-action action (tags-completion-table) string 
pred))))))
 
 (defun find-tag-tag (string)
   "Read a tag name, with defaulting and completion."
@@ -805,7 +803,7 @@
                                            (substring string 0 (string-match 
"[ :]+\\'" string))
                                            default)
                                  string)
-                               'tags-complete-tag
+                               (tags-lazy-completion-table)
                                nil nil nil nil default)))
     (if (equal spec "")
        (or default (error "There is no default tag"))
@@ -2053,6 +2051,7 @@
        (pattern (funcall (or find-tag-default-function
                              (get major-mode 'find-tag-default-function)
                              'find-tag-default)))
+        (comp-table (tags-lazy-completion-table))
        beg
        completion)
     (or pattern
@@ -2060,7 +2059,7 @@
     (search-backward pattern)
     (setq beg (point))
     (forward-char (length pattern))
-    (setq completion (tags-complete-tag pattern nil nil))
+    (setq completion (try-completion pattern comp-table))
     (cond ((eq completion t))
          ((null completion)
           (message "Can't find completion for \"%s\"" pattern)
@@ -2072,7 +2071,7 @@
           (message "Making completion list...")
           (with-output-to-temp-buffer "*Completions*"
             (display-completion-list
-             (all-completions pattern 'tags-complete-tag nil)
+             (all-completions pattern comp-table nil)
              pattern))
           (message "Making completion list...%s" "done")))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]