From a4a016302740451baa574f5be40a61bb58e7d48a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustav=20H=C3=A5llberg?= Date: Fri, 26 Feb 2010 16:54:09 +0100 Subject: [PATCH] stgit.el: Use comint-carriage-motion in output from "!" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This makes carriage return and similar be handled correctly, which is important as some git commands use those. Signed-off-by: Gustav HÃ¥llberg --- contrib/stgit.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/contrib/stgit.el b/contrib/stgit.el index 407185c..f42ad58 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -14,6 +14,7 @@ (require 'git nil t) (require 'cl) +(require 'comint) (require 'ewoc) (require 'easymenu) (require 'format-spec) @@ -2223,6 +2224,19 @@ deepest patch had before the squash." (stgit-reload))) (funcall old-sentinel process sentinel))) +(defun stgit-execute-process-filter (process output) + (with-current-buffer (process-buffer process) + (let* ((old-point (point)) + (pmark (process-mark process)) + (insert-at (marker-position pmark)) + (at-pmark (= insert-at old-point))) + (goto-char insert-at) + (insert-before-markers output) + (comint-carriage-motion insert-at (point)) + (set-marker pmark (point)) + (unless at-pmark + (goto-char old-point))))) + (defun stgit-execute () "Prompt for an stg command to execute in a shell. @@ -2261,7 +2275,10 @@ When the command has finished, reload the stgit buffer." (process-sentinel process)) (set (make-local-variable 'stgit-buffer) old-buffer) + (set-process-filter process 'stgit-execute-process-filter) (set-process-sentinel process 'stgit-execute-process-sentinel)))) + (with-current-buffer buffer + (comint-carriage-motion (point-min) (point-max))) (shrink-window-if-larger-than-buffer (get-buffer-window buffer)) (stgit-reload)))) -- 2.11.0