[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer functio
From: |
Thierry Volpiatto |
Subject: |
bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function |
Date: |
Fri, 01 Mar 2013 20:07:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + (save-selected-window
>> + (set-buffer (process-buffer process))
>> + (save-excursion
>> + (let ((inhibit-read-only t)
>> + (filtered-string output-string))
>> + (while (string-match "\r" filtered-string)
>> + (setq filtered-string
>> + (replace-match "" nil nil filtered-string)))
>> + ;; Insert the text, moving the process-marker.
>> + (goto-char (process-mark process))
>> + (insert filtered-string)
>> + (set-marker (process-mark process) (point))))))
>
> This code does not affect the selected-window, so there shouldn't be any
> save-selected-window. Instead it should use with-current-buffer.
Ok
> BTW, I think the desired behavior is not the same for all net-utils
> tools. E.g. for ping, we'd like point to stay at the end. So you above
> change is good but it should be completed with changes in the relevant
> commands to set window-point-insertion-type when necessary.
Actually, the behavior of net-utils tools is to go back to bob
on initial run, and when reverting going to eob, this is not consistent,
we should do the same when reverting IMO.
I suggest we stay on bob for both by default [1] and specify to go to a
specific place (eob) when needed in some command (like ping as you
suggested).
This is for [1]
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 82c1ce0..e7da1aa 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -319,25 +319,17 @@ This variable is only used if the variable
(defun net-utils-remove-ctrl-m-filter (process output-string)
"Remove trailing control Ms."
- (let ((old-buffer (current-buffer))
- (filtered-string output-string))
- (unwind-protect
- (let ((moving))
- (set-buffer (process-buffer process))
- (let ((inhibit-read-only t))
- (setq moving (= (point) (process-mark process)))
-
- (while (string-match "\r" filtered-string)
- (setq filtered-string
- (replace-match "" nil nil filtered-string)))
-
- (save-excursion
- ;; Insert the text, moving the process-marker.
- (goto-char (process-mark process))
- (insert filtered-string)
- (set-marker (process-mark process) (point))))
- (if moving (goto-char (process-mark process))))
- (set-buffer old-buffer))))
+ (with-current-buffer (process-buffer process)
+ (save-excursion
+ (let ((inhibit-read-only t)
+ (filtered-string output-string))
+ (while (string-match "\r" filtered-string)
+ (setq filtered-string
+ (replace-match "" nil nil filtered-string)))
+ ;; Insert the text, moving the process-marker.
+ (goto-char (process-mark process))
+ (insert filtered-string)
+ (set-marker (process-mark process) (point))))))
(defun net-utils-run-program (name header program args)
"Run a network information program."
@@ -375,7 +367,6 @@ This variable is only used if the variable
(apply 'start-process program-name
(current-buffer) program-name args)
'net-utils-remove-ctrl-m-filter)
- (goto-char (point-min))
(unless nodisplay (display-buffer (current-buffer)))))
(defun net-utils--revert-function (&optional ignore-auto noconfirm)
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function, Thierry Volpiatto, 2013/03/03
bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function, Thierry Volpiatto, 2013/03/01