aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-04-05 03:31:50 +0000
committerStefan Monnier2008-04-05 03:31:50 +0000
commitb5507bc14e6de95edfff0eb5021674cda14538d9 (patch)
tree9cb04a3c88814fbe001d46bedc25be1c0c072e1c
parent8d73b84e3b45f2312510ce3f78be258ea0834f87 (diff)
downloademacs-b5507bc14e6de95edfff0eb5021674cda14538d9.tar.gz
emacs-b5507bc14e6de95edfff0eb5021674cda14538d9.zip
Fix problem with completion for buffer-local tables.
Reported by Radey Shouman <shouman@comcast.net>. (tags-complete-tag): Remove. (tags-lazy-completion-table): New function to replace it. (find-tag-tag, complete-tag): Update users.
-rw-r--r--lisp/progmodes/etags.el27
1 files changed, 13 insertions, 14 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index e18491ad97a..88e62b4ec85 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -780,17 +780,15 @@ tags table and its (recursively) included tags tables."
780 (quit (message "Tags completion table construction aborted.") 780 (quit (message "Tags completion table construction aborted.")
781 (setq tags-completion-table nil))))) 781 (setq tags-completion-table nil)))))
782 782
783(defun tags-complete-tag (string predicate what) 783(defun tags-lazy-completion-table ()
784 "Completion function for tags. 784 (lexical-let ((buf (current-buffer)))
785Does normal `try-completion', but builds `tags-completion-table' on 785 (lambda (string pred action)
786demand." 786 (with-current-buffer buf
787 (save-excursion 787 (save-excursion
788 ;; If we need to ask for the tag table, allow that. 788 ;; If we need to ask for the tag table, allow that.
789 (let ((enable-recursive-minibuffers t)) 789 (let ((enable-recursive-minibuffers t))
790 (visit-tags-table-buffer)) 790 (visit-tags-table-buffer))
791 (if (eq what t) 791 (complete-with-action action (tags-completion-table) string pred))))))
792 (all-completions string (tags-completion-table) predicate)
793 (try-completion string (tags-completion-table) predicate))))
794 792
795(defun find-tag-tag (string) 793(defun find-tag-tag (string)
796 "Read a tag name, with defaulting and completion." 794 "Read a tag name, with defaulting and completion."
@@ -805,7 +803,7 @@ demand."
805 (substring string 0 (string-match "[ :]+\\'" string)) 803 (substring string 0 (string-match "[ :]+\\'" string))
806 default) 804 default)
807 string) 805 string)
808 'tags-complete-tag 806 (tags-lazy-completion-table)
809 nil nil nil nil default))) 807 nil nil nil nil default)))
810 (if (equal spec "") 808 (if (equal spec "")
811 (or default (error "There is no default tag")) 809 (or default (error "There is no default tag"))
@@ -2053,6 +2051,7 @@ for \\[find-tag] (which see)."
2053 (pattern (funcall (or find-tag-default-function 2051 (pattern (funcall (or find-tag-default-function
2054 (get major-mode 'find-tag-default-function) 2052 (get major-mode 'find-tag-default-function)
2055 'find-tag-default))) 2053 'find-tag-default)))
2054 (comp-table (tags-lazy-completion-table))
2056 beg 2055 beg
2057 completion) 2056 completion)
2058 (or pattern 2057 (or pattern
@@ -2060,7 +2059,7 @@ for \\[find-tag] (which see)."
2060 (search-backward pattern) 2059 (search-backward pattern)
2061 (setq beg (point)) 2060 (setq beg (point))
2062 (forward-char (length pattern)) 2061 (forward-char (length pattern))
2063 (setq completion (tags-complete-tag pattern nil nil)) 2062 (setq completion (try-completion pattern comp-table))
2064 (cond ((eq completion t)) 2063 (cond ((eq completion t))
2065 ((null completion) 2064 ((null completion)
2066 (message "Can't find completion for \"%s\"" pattern) 2065 (message "Can't find completion for \"%s\"" pattern)
@@ -2072,7 +2071,7 @@ for \\[find-tag] (which see)."
2072 (message "Making completion list...") 2071 (message "Making completion list...")
2073 (with-output-to-temp-buffer "*Completions*" 2072 (with-output-to-temp-buffer "*Completions*"
2074 (display-completion-list 2073 (display-completion-list
2075 (all-completions pattern 'tags-complete-tag nil) 2074 (all-completions pattern comp-table nil)
2076 pattern)) 2075 pattern))
2077 (message "Making completion list...%s" "done"))))) 2076 (message "Making completion list...%s" "done")))))
2078 2077