         (error "mural-server timeout"))
       )))
 
-(defun mural-query-save-tag (query)
+(defun mural-query-save-tag (query tagfile)
   "Run by ido-mode to refresh results on keypress.  Runs
 QUERY (the current contents of the minibuffer) against
 mural-current-tagfile, which was setup on entry to
 ido-completing-read"
-  (let ((qresult (mural-query query mural-current-tagfile)))
+  (let ((qresult (mural-query query tagfile)))
     (setq mural-last-query-result qresult)
     (mapcar 'mural-tag-tagname qresult)))
 

(defvar ido-dynamic-match-fn nil)
(defvar mural-tagfile-to-process '()
  "alist from tagfile name to a mural_server process that handles this tagfile")

(defun mural-add-tagfile (tagfile)
  "Register tagfile and make it available for queries"

  "Interactively search for a tag in the current repository and
open it in a new buffer"
  (interactive)
  (let ((taginfo (mural-read-tag (mural-infer-tagfile))))
    (find-file (mural-tag-filename taginfo))
    (goto-line (mural-tag-row taginfo))))

