                         (find-file-noselect file)))))
 
      ((string-match ":" modtagname)
-      (if (boundp 'find-tag-tag-order)
-          ;; Method one: Add module-recognising functions to the
-          ;; list of order functions.  However, the tags system
-          ;; from Emacs 18, and derives thereof (read: XEmacs)
-          ;; hasn't got this feature.
-          (progn
-            (erlang-tags-install-module-check)
-            (unwind-protect
-                (funcall (symbol-function 'find-tag)
-                         modtagname next-p regexp-p)
-              (erlang-tags-remove-module-check)))
-        ;; Method two: Call the tags system until a file matching
-        ;; the module is found.  This could result in that many
-        ;; files are read. (e.g. The tag "foo:file" will take a
-        ;; while to process.)
-        (let* ((modname (substring modtagname 0 (match-beginning 0)))
-               (tagname (substring modtagname (match-end 0) nil))
-               (last-tag tagname)
-               file)
-          (while
-              (progn
-                (funcall (symbol-function 'find-tag) tagname next-p regexp-p)
-                (setq next-p t)
-                ;; Determine the module form the file name.  (The
-                ;; alternative, to check `-module', would make this
-                ;; code useless for non-Erlang programs.)
-                (setq file (erlang-get-module-from-file-name buffer-file-name))
-                (not (and (stringp file)
-                          (string= modname file))))))))
+      (progn
+        (erlang-tags-install-module-check)
+        (unwind-protect
+            (funcall (symbol-function 'find-tag)
+                     modtagname next-p regexp-p)
+          (erlang-tags-remove-module-check))))
      (t
       (funcall (symbol-function 'find-tag) modtagname next-p regexp-p)))
     (current-buffer)))                  ; Return the new buffer.

  :type '(restricted-sexp :match-alternatives (stringp 'nil))
  :safe (lambda (val) (or (eq nil val) (stringp val))))

(defconst erlang-xemacs-p (string-match "Lucid\\|XEmacs" emacs-version)
  "Non-nil when running under XEmacs or Lucid Emacs.")

(defvar erlang-xemacs-popup-menu '("Erlang Mode Commands" . nil)
  "Common popup menu for all buffers in Erlang mode.

This variable is destructively modified every time the Erlang menu
is modified.  The effect is that all changes take effect in all
buffers in Erlang mode, just like under GNU Emacs.

Never EVER set this variable!")

(defvar erlang-menu-items '(erlang-menu-base-items
                            erlang-menu-skel-items
                            erlang-menu-shell-items

Should the Erlang tags system be installed this command knows
about Erlang modules."
  (interactive)
  (require 'etags)
  (let ((erlang-replace-etags-tags-completion-table t))
    (complete-tag)))


(defun erlang-find-tag-for-completion ()
