            (ycmd--handle-extra-conf-exception results))
           (default-handler (funcall default-handler results)))))
 
-(defun ycmd-goto ()
-  "Go to the definition or declaration of the symbol at current position."
-  (interactive)
-  (ycmd--goto "GoTo"))
-
-(defun ycmd-goto-declaration ()
-  "Go to the declaration of the symbol at the current position."
-  (interactive)
-  (ycmd--goto "GoToDeclaration"))
-
-(defun ycmd-goto-definition ()
-  "Go to the definition of the symbol at the current position."
-  (interactive)
-  (ycmd--goto "GoToDefinition"))
-
-(defun ycmd-goto-implementation ()
-  "Go to the implementation of the symbol at the current position."
-  (interactive)
-  (ycmd--goto "GoToImplementation"))
-
-(defun ycmd-goto-imprecise ()
-  "Fast implementation of Go To at the cost of precision.
-Useful in case compile-time is considerable."
-  (interactive)
-  (ycmd--goto "GoToImprecise"))
-
-(defun ycmd--handle-goto-exception (results)
-  "Handle a Go To exception in RESULTS."
-  (let ((msg (assoc-default 'message results nil "UNKNOWN")))
-    (warn (format "goto exception: %s" msg))))
-
-(defun ycmd--handle-goto-success (location)
-  "Handle a successfull Go To response for LOCATION."
-  (push-mark)
-  (ring-insert find-tag-marker-ring (point-marker))
-  (ycmd--goto-location location))
-
-(defun ycmd--goto (type)
-  "Implementation of GoTo according to the request TYPE."
+(defun ycmd--send-request (type success-handler &optional exception-handler)
+  "Send a request of TYPE to the `ycmd' server.
+
+SUCCESS-HANDLER is called when for a successful response.  If
+EXCEPTION-HANDLER is non-nil use it as default exception
+handler."
   (when ycmd-mode
     (deferred:$
 
-      (ycmd--send-goto-request type (current-buffer) (point))
+      (ycmd--send-completer-command-request
+       type (current-buffer) (point))
 
       (deferred:nextc it
-        (lambda (location)
-          (when location
-            (if (assoc-default 'exception location)
+        (lambda (result)
+          (when result
+            (if (assoc-default 'exception result)
                 (ycmd--handle-exception
-                 location #'ycmd--handle-goto-exception)
-              (ycmd--handle-goto-success location))))))))
-
-(defun ycmd--send-goto-request (type buffer pos)
+                 result exception-handler)
+              (funcall success-handler result))))))))
+
+(defun ycmd--send-completer-command-request (type buffer pos)
   "Send Go To request of TYPE to BUFFER at POS."
   (with-current-buffer buffer
     (goto-char pos)

       "/run_completer_command"
       content
       :parser 'json-read))))

(defun ycmd--goto-location (location)
  "Move cursor to LOCATION.

    (define-key map "o" 'ycmd-open)
    (define-key map "c" 'ycmd-close)
    (define-key map "." 'ycmd-goto)
    (define-key map "gd" 'ycmd-goto-definition)
    (define-key map "gD" 'ycmd-goto-declaration)
    (define-key map "gi" 'ycmd-goto-implementation)
    (define-key map "gI" 'ycmd-goto-imprecise)
    (define-key map "s" 'ycmd-toggle-force-semantic-completion)
    (define-key map "v" 'ycmd-show-debug-info)
    (define-key map "d" 'ycmd-get-documentation)
    map)
  "Keymap for `ycmd-mode' interactive commands.")

