 
 ;; SPECIAL CASE OF COMMANDS
 
-(defun merlin-refresh ()
-  "Refresh changed merlin cmis."
-  (interactive)
-  (merlin--acquire-buffer)
-  (merlin-send-command 'refresh)
-  (merlin-after-save))
-
 (defun merlin-parse-position (result)
   "Returns a pair whose first member is a point set at merlin cursor position
   and second member is the state of the marker"

;; ERROR REPORT ;;
;;;;;;;;;;;;;;;;;;

(defun merlin-find-error-for-line (line errors)
  "Return the first error mentioning line number LINE among ERRORS.
Return nil if there is no error on this line."
  (let* ((found nil))
    (while (and (not found) errors)
      (let* ((err (car errors))
             (start-line (cdr (assoc 'line (cdr (assoc 'start err)))))
             (end-line (cdr (assoc 'line (cdr (assoc 'end err))))))
        (if (and (>= line start-line) (<= line end-line))
            (setq found err)
          (setq errors (cdr errors)))))
    found))

(defvar merlin-error-timer nil
  "Timer to show the error at point in the echo area.")

(defun merlin-error-start-timer ()
  "Start the error timer as an idle timer.
When it expires, the current Merlin error is shown in the echo
area."
  (merlin-error-cancel-timer)
  (setq merlin-error-timer
        (run-with-idle-timer 0.1 'repeat 'merlin-show-error-on-current-line))
  (merlin-error-start-gc-timer))

(defun merlin-error-cancel-timer ()
  "Cancel the error display timer."
  (when merlin-error-timer
    (cancel-timer merlin-error-timer)
    (setq merlin-error-timer nil)))

(defvar merlin-error-gc-timer nil
  "Timer to collect unused Merlin timers.
This triggers `merlin-error-gc' to check whether there are any
buffers left using Merlin.  If not, we can cancel this timer and
`merlin-error-timer'.")

(defun merlin-error-gc ()
  "Check whether there are still buffers using Merlin.
Clean up Merlin timers if there are none."
  (when (not (member t
                     (mapcar
                      (lambda (buf) (buffer-local-value 'merlin-mode buf))
                      (buffer-list))))
    ;; No buffer uses Merlin anymore. Kill all hu^H^Htimers.
    (merlin-error-cancel-timer)
    (merlin-error-cancel-gc-timer)))

(defun merlin-error-start-gc-timer ()
  "Start the Merlin GC timer (see `merlin-error-gc-timer').
The timer fires every 10 seconds of idle time."
  (merlin-error-cancel-gc-timer)
  (setq merlin-error-gc-timer (run-at-time 10 10 'merlin-error-gc)))

(defun merlin-error-cancel-gc-timer ()
  "Cancel the Merlin GC timer (see `merlin-error-gc-timer')."
  (when merlin-error-gc-timer
    (cancel-timer merlin-error-gc-timer)
    (setq merlin-error-gc-timer nil)))

(defun merlin-chomp (str)
  "Remove whitespace at the beginning and end of STR."
  (replace-regexp-in-string "^[[:space:]\n]\+\\|[[:space:]\n]\+$" "" str))


        (push #'merlin--kill-error-if-edited
              (overlay-get overlay 'modification-hooks))
        (when merlin-error-in-fringe
          (if (merlin--error-warning-p (cdr (assoc 'message err)))
              (merlin-add-display-properties overlay
                                             'question-mark
                                             "?"
