[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vc-got 74b0000 138/145: install a custom process filter
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vc-got 74b0000 138/145: install a custom process filter for `got send' |
Date: |
Thu, 9 Sep 2021 15:58:50 -0400 (EDT) |
branch: externals/vc-got
commit 74b0000920b6527234aa4672c16b7c860042a3dc
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>
install a custom process filter for `got send'
`got send' uses \r to "update" the outputted text; it's nice and why
don't support it?
Without this, Emacs wait for a \n and output a long line with various
^M inside; it's ugly.
While there, there's no need to call (vc-compilation-mode 'git), so
replace it with 'got.
---
vc-got.el | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/vc-got.el b/vc-got.el
index 3b657d6..20b73ed 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -654,6 +654,26 @@ If REV is t, checkout from the head."
(when branch
(vc-got--integrate branch))))
+(defun vc-got--proc-filter (proc s)
+ "Custom output filter for async process PROC.
+It's like `vc-process-filter' but supports \r inside S."
+ (let ((buffer (process-buffer proc)))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (save-excursion
+ (let ((buffer-undo-list t)
+ (inhibit-read-only t))
+ (goto-char (process-mark proc))
+ (if (not (string-match ".*\r\\(.*\\)" s))
+ (insert s)
+ ;; handle \r
+ (end-of-line)
+ (let ((end (point)))
+ (beginning-of-line)
+ (delete-region (point) end))
+ (insert (match-string 1 s)))
+ (set-marker (process-mark proc) (point))))))))
+
(defun vc-got--push-pull (cmd op prompt)
"Execute CMD OP, or prompt the user if PROMPT is non-nil."
(let ((buffer (format "*vc-got : %s*" (expand-file-name default-directory))))
@@ -668,14 +688,17 @@ If REV is t, checkout from the head."
;; part it makes sense, but we should revisit for full Got
;; support.
(with-current-buffer buffer
- (vc-compilation-mode 'git)
- (let ((comp-cmd (mapconcat #'identity cmd " ")))
+ (vc-compilation-mode 'got)
+ (let ((comp-cmd (mapconcat #'identity cmd " "))
+ (proc (get-buffer-process buffer)))
(setq-local compile-command comp-cmd)
(setq-local compilation-directory default-directory)
(setq-local compilation-arguments (list comp-cmd
nil
(lambda (_ign) buffer)
- nil))))
+ nil))
+ ;; Setup a custom process filter that handles \r.
+ (set-process-filter proc #'vc-got--proc-filter)))
(vc-set-async-update buffer))))
;; TODO: this could be expanded. After a pull the worktree needs to
- [elpa] externals/vc-got e7747ce 109/145: use log-edit-extract-headers instead of the ugly workaround, (continued)
- [elpa] externals/vc-got e7747ce 109/145: use log-edit-extract-headers instead of the ugly workaround, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 26362bf 110/145: improve error message reporting for vc-got-checkin, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 5212464 115/145: there is no need to require cl-seq, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 83559c7 108/145: add a TODO for the files handling in vc-got-diff, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 186da17 126/145: add a short description under commentary, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 1b2afa9 121/145: rework the vc-dir handling and remove the ugly hack, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 2552a6c 104/145: mark find-ignore-file as done and move it to the right place, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 26b39de 135/145: remove debug macroexpand, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 84beb0d 129/145: add docstring for vc-got-update-on-retrieve-tag, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a1839dc 131/145: don't include the common commit in log-outgoing, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 74b0000 138/145: install a custom process filter for `got send',
ELPA Syncer <=
- [elpa] externals/vc-got 3efc759 141/145: cleanup, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got f457868 024/145: typo, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 06d4d37 031/145: add Makefile, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got ddc59a0 057/145: remove extra parens from vc-got-unregister and fix pcase matchall, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got f8a9db5 060/145: fix vc-got-repository-url for checkout of non-bare repos, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 9e01941 078/145: improve vc-dir presentation & document vc-got-stage in README, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a7777ea 079/145: list also staged addition/removals, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 668dc8e 068/145: vc-got--status: handle stage info and filter result, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 7a5ead6 061/145: vc-got-repository-url: avoid infinite loops in parsing, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 0d57aba 072/145: remove the separator when showing a chunk to stage, ELPA Syncer, 2021/09/09