 
 (defun ycmd--get-fixit-diff (chunks)
   "Return diff string for CHUNKS."
-  (let ((chunks-by-filepath
-         (--group-by (let-alist it .range.start.filepath)
-                     chunks))
-        diffs)
-    (dolist (file-chunk chunks-by-filepath (nreverse diffs))
-      (let* ((filepath (car file-chunk))
-             (chunk (cdr file-chunk))
+  (let (diffs)
+    (ycmd--loop-chunks-by-filename (chunks (nreverse diffs))
+      (let* ((filepath (car it))
+             (chunk (cdr it))
              (buffer (find-file-noselect filepath))
              (buffertext (with-current-buffer buffer (buffer-string))))
         (with-temp-buffer


;;; FixIts

(defun ycmd--show-fixits (fixits &optional title)
  "Select a buffer and display FIXITS.
Optional TITLE is shown on first line."

(defun ycmd--apply-fixit (button)
  "Apply BUTTON's FixIt chunk."
  (-when-let* ((chunks (button-get button 'fixit)))
    (ycmd--loop-chunks-by-filename (chunks)
      (ycmd--replace-chunk-list (cdr it)))
    (quit-window t (get-buffer-window "*ycmd-fixits*"))))

(define-derived-mode ycmd-fixit-mode ycmd-view-mode "ycmd-fixits"
