emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100096: * minibuffer.el (tags-comple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100096: * minibuffer.el (tags-completion-at-point-function): Move to etags.el.
Date: Fri, 30 Apr 2010 21:08:43 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100096
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2010-04-30 21:08:43 -0400
message:
  * minibuffer.el (tags-completion-at-point-function): Move to etags.el.
  * progmodes/etags.el (tags-completion-at-point-function):
  Remove left over interactive spec.  Add autoloading stub.
  (complete-tag): Use tags-completion-at-point-function.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
  lisp/progmodes/etags.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-30 23:13:22 +0000
+++ b/lisp/ChangeLog    2010-05-01 01:08:43 +0000
@@ -1,3 +1,10 @@
+2010-05-01  Stefan Monnier  <address@hidden>
+
+       * minibuffer.el (tags-completion-at-point-function): Move to etags.el.
+       * progmodes/etags.el (tags-completion-at-point-function):
+       Remove left over interactive spec.  Add autoloading stub.
+       (complete-tag): Use tags-completion-at-point-function.
+
 2010-04-30  Chong Yidong  <address@hidden>
 
        * minibuffer.el (tags-completion-at-point-function): Fix return

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2010-04-30 23:13:22 +0000
+++ b/lisp/minibuffer.el        2010-05-01 01:08:43 +0000
@@ -1169,27 +1169,6 @@
  `:predicate'           a predicate that completion candidates need to satisfy.
  `:annotation-function' the value to use for `completion-annotate-function'.")
 
-(declare-function tags-lazy-completion-table "etags.el" ())
-(defun tags-completion-at-point-function ()
-  "Using tags, return a completion table for the text around point.
-If no tags table is loaded, do nothing and return nil."
-  (interactive)
-  (when (or tags-table-list tags-file-name)
-    (require 'etags)
-    (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
-                                     tags-case-fold-search
-                                   case-fold-search))
-         (pattern (funcall (or find-tag-default-function
-                               (get major-mode 'find-tag-default-function)
-                               'find-tag-default)))
-         beg)
-      (when pattern
-       (save-excursion
-         (search-backward pattern)
-         (setq beg (point))
-         (forward-char (length pattern))
-         (list beg (point) (tags-lazy-completion-table)))))))
-
 (defun complete-symbol (&optional arg)
   "Perform completion on the text around point.
 The completion method is determined by `completion-at-point-functions'.

=== modified file 'lisp/progmodes/etags.el'
--- a/lisp/progmodes/etags.el   2010-04-29 15:32:11 +0000
+++ b/lisp/progmodes/etags.el   2010-05-01 01:08:43 +0000
@@ -423,9 +423,9 @@
   (if (get-file-buffer file)
       ;; The file is already in a buffer.  Check for the visited file
       ;; having changed since we last used it.
-      (let (win)
+      (progn
        (set-buffer (get-file-buffer file))
-       (setq win (or verify-tags-table-function (tags-table-mode)))
+        (or verify-tags-table-function (tags-table-mode))
        (if (or (verify-visited-file-modtime (current-buffer))
                ;; Decide whether to revert the file.
                ;; revert-without-query can say to revert
@@ -787,6 +787,30 @@
           (let ((enable-recursive-minibuffers t))
             (visit-tags-table-buffer))
           (complete-with-action action (tags-completion-table) string 
pred))))))
+
+;;;###autoload (defun tags-completion-at-point-function ()
+;;;###autoload   (if (or tags-table-list tags-file-name)
+;;;###autoload       (progn
+;;;###autoload         (load "etags")
+;;;###autoload         (tags-completion-at-point-function))))
+
+(defun tags-completion-at-point-function ()
+  "Using tags, return a completion table for the text around point.
+If no tags table is loaded, do nothing and return nil."
+  (when (or tags-table-list tags-file-name)
+    (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
+                                     tags-case-fold-search
+                                   case-fold-search))
+         (pattern (funcall (or find-tag-default-function
+                               (get major-mode 'find-tag-default-function)
+                               'find-tag-default)))
+         beg)
+      (when pattern
+       (save-excursion
+         (search-backward pattern) ;FIXME: will fail if we're inside pattern.
+         (setq beg (point))
+         (forward-char (length pattern))
+         (list beg (point) (tags-lazy-completion-table)))))))
 
 (defun find-tag-tag (string)
   "Read a tag name, with defaulting and completion."
@@ -2039,20 +2063,10 @@
       (error "%s"
             (substitute-command-keys
              "No tags table loaded; try \\[visit-tags-table]")))
-  (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
-                                   tags-case-fold-search
-                                 case-fold-search))
-       (pattern (funcall (or find-tag-default-function
-                             (get major-mode 'find-tag-default-function)
-                             'find-tag-default)))
-        (comp-table (tags-lazy-completion-table))
-       beg)
-    (or pattern
-       (error "Nothing to complete"))
-    (search-backward pattern)
-    (setq beg (point))
-    (forward-char (length pattern))
-    (completion-in-region beg (point) comp-table)))
+  (let ((comp-data (tags-completion-at-point-function)))
+    (if (null comp-data)
+       (error "Nothing to complete")
+      (apply 'completion-in-region comp-data))))
 
 (dolist (x '("^No tags table in use; use .* to select one$"
             "^There is no default tag$"


reply via email to

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