         ))))
 
 (defun mural-query-save-tag (query)
-  (let ((qresult (mural-query query)))
+  (let ((qresult (mural-query query mural-current-tagfile)))
     (setq mural-last-query-result qresult)
-    (mapcar (lambda (x) (elt x 0)) qresult)))
+    (mapcar 'mural-tag-tagname qresult)))
 
 ;;(mural-parse-response "MATCH foo bar 1\nMATCH hi bye 2\nDONE hi hi")
 ;; returns '((tag file row) ...)

  (let* ((tag (mural-read-tag))
        (taginfo (assoc tag mural-last-query-result)))
    (progn
      (find-file (mural-abspath-for-tag taginfo))
      (goto-line (mural-tag-row taginfo))
      (setq mural-last-query-result nil)
      )))

(defun mural-abspath-for-tag (taginfo)
  (expand-file-name
   (mural-tag-filename taginfo)
   ;; need to make this conditional on the tag file to support multiple repos
   (file-name-directory (directory-file-name tags-file-name))))

;; (mural-abspath-for-tag '("hi" "flib/core/preparable/Preparer.php" 1))

(defvar ido-dynamic-last-query nil)


;;
;; mural adds a fast, fuzzy tag search typeahead to emacs.
;;
;; Features:
;;
;;   -- fuzzy search means that you can type any sequence of letters
;;      in a tag.  e.g, 'prof_get_s' will find 'profile_get_short'.
;;      This lets you find tags who's name you only vagely remember,
;;      is robust to some typos, and only requires typing a fraction
;;      of the characters in most case (e.g
;;      SimpleBeanFactoryAwareAspectInstanceFactory could by found by
;;      just typing SBFAAIF, or some subset thereof)
;;
;;   -- results are refined on each keypress, which lets you stop as
;;      soon as an unambiguous result is found.
;;
;;   -- it's dramatically faster than pure emacs solutions for large
;;      tags files.  Single queries return in 35ms, compared to
;;      several seconds to do a tab completion in find-tag and over
;;      10s for a fuzzy match in ido-mode.
;;
;;   -- supports multiple tag files and repositories.  The repo to
;;      search is chosen based on the location of the file in the
;;      current buffer.
;;
;;   -- changes to the tags file are picked up without a restart using inotify.
;;
;;
;; To use, put this in your .emacs:
;;
;;   (require 'mural)
;;   (mural-add-tagfile "~/www/TAGS")
;;   (mural-add-tagfile "~/local/hphp/src/TAGS")
;;   (global-set-key (kbd "C-o") 'mural-open-dwim)
;;
;; To debug launch:
;; (call-process mural-server-path nil t nil tags-file-name)
