diff options
author | Gustav Hållberg <gustav@gmail.com> | 2010-02-26 16:54:09 +0100 |
---|---|---|
committer | Gustav Hållberg <gustav@gmail.com> | 2010-03-24 16:49:25 +0100 |
commit | a4a016302740451baa574f5be40a61bb58e7d48a (patch) | |
tree | f0aca6edf9c03edd224b53b816ebb49d8bcc0747 | |
parent | 1b6a57ddf3c8f388df84247cb21b49d3dd0e2751 (diff) | |
download | stgit-a4a016302740451baa574f5be40a61bb58e7d48a.tar.gz |
stgit.el: Use comint-carriage-motion in output from "!"
This makes carriage return and similar be handled correctly, which is
important as some git commands use those.
Signed-off-by: Gustav Hållberg <gustav@gmail.com>
-rw-r--r-- | contrib/stgit.el | 17 |
1 files changed, 17 insertions, 0 deletions
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)))) |