   :type 'boolean
   :safe 'booleanp)
 
+(defcustom rtags-wrap-results t
+  "Whether rtags-next-match/rtags-prev-match wraps around"
+  :group 'rtags
+  :type 'boolean
+  :safe 'booleanp)
+
+(defcustom rtags-close-taglist-on-focus-lost nil
+  "Whether rtags-taglist should close when it loses focus"
+  :group 'rtags
+  :type 'boolean
+  :safe 'booleanp)
+
+(defcustom rtags-close-taglist-on-selection t
+  "Whether rtags-taglist should close when something is selected"
+  :group 'rtags
+  :type 'boolean
+  :safe 'booleanp)
+
 (defcustom rtags-follow-symbol-try-harder t
   "Fall back to string-matching if follow symbol fails."
   :group 'rtags

    (if (> (length tagname) 0)
        (setq prompt (concat prompt ": (default: " tagname ") "))
      (setq prompt (concat prompt ": ")))
    (if (fboundp 'completing-read-default)
        (setq input (completing-read-default prompt (function rtags-symbolname-complete) nil nil nil 'rtags-symbol-history))
      (setq input (completing-read prompt (function rtags-symbolname-complete) nil nil nil 'rtags-symbol-history)))
    (setq rtags-symbol-history (rtags-remove-last-if-duplicated rtags-symbol-history))
    (when (not (equal "" input))
      (setq tagname input))

  (run-hooks 'rtags-mode-hook)
  (goto-char (point-min))
  (setq next-error-function 'rtags-next-prev-match)
  (rtags-init-current-line-overlay)
  (setq buffer-read-only t))

(defun rtags-wrap-word (word)
