]> git.eshelyaron.com Git - emacs.git/commitdiff
Make "git pull" output slightly prettier
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 1 Oct 2022 14:06:27 +0000 (16:06 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 1 Oct 2022 14:06:37 +0000 (16:06 +0200)
* lisp/vc/vc-git.el (vc-git--pushpull): Translate ^M in output
(bug#58199).

lisp/vc/vc-git.el

index f5ac43f5361bdb7a3f4658fdaf73b3c970f8ec76..87f6a5a37c8b727f87dd6d3babb3d06051cd4625 100644 (file)
@@ -1110,6 +1110,14 @@ If PROMPT is non-nil, prompt for the Git command to run."
             vc-filter-command-function))
          (proc (apply #'vc-do-async-command
                       buffer root git-program command extra-args)))
+    ;; "git pull" includes progress output that uses ^M to move point
+    ;; to the beginning of the line.  Just translate these to newlines
+    ;; (but don't do anything with the CRLF sequence).
+    (add-function :around (process-filter proc)
+                  (lambda (filter process string)
+                    (funcall filter process
+                             (replace-regexp-in-string "\r\\(\\'\\|[^\n]\\)"
+                                                       "\n\\1" string))))
     (with-current-buffer buffer
       (vc-run-delayed
         (vc-compilation-mode 'git)