   "Stop recording debug information."
   (interactive)
   (setq merlin-debug nil))
+
+(defun merlin-debug-last-commands ()
+  "Display last commands executed and their result (if any)"
+  (interactive)
+  (let (buf)
+    (dolist (command merlin-debug-last-commands)
+      (push (concat "- result: " (or (cdr command) "failed")) buf)
+      (push (mapconcat 'identity
+                       (merlin--map-flatten-to-string "command: " (car command))
+                       " ") buf))
+    (message "Last commands executed, most recent at the end:\n%s"
+             (mapconcat 'identity buf "\n"))))
 
 (defun merlin/buffer-substring (start end)
    "Return content of buffer between two points or empty string if points are not valid"

      (if (equal merlin/verbosity-context (car-safe merlin--verbosity-cache))
          (setcdr merlin--verbosity-cache (1+ (cdr merlin--verbosity-cache)))
        (setq merlin--verbosity-cache (cons merlin/verbosity-context 0))))
    (setq args (merlin--map-flatten
                 (lambda (x) (if (stringp x) x (prin1-to-string x)))
                 "server" command "-protocol" "sexp"
                 ;; Is debug mode enabled
                 (when merlin-debug '("-log-file" "-"))
                 ;; If command is repeated, increase verbosity

        (packages    (merlin--map-flatten (lambda (x) (cons "-package" x))
                                          merlin-buffer-packages))
        )
    ;; Log last commands
    (setq merlin-debug-last-commands
          (cons (cons (cons command args) nil) merlin-debug-last-commands))
    (let ((cdr (nthcdr 5 merlin-debug-last-commands)))
      (when cdr (setcdr cdr nil)))
    ;; Compute verbosity

    (when (eq merlin/verbosity-context t)
        (setq merlin/verbosity-context (cons command args)))
    (if (not merlin/verbosity-context)
