From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 13831@debbugs.gnu.org
Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function
Date: Fri, 01 Mar 2013 20:07:53 +0100 [thread overview]
Message-ID: <87ppzjj5va.fsf@gmail.com> (raw)
In-Reply-To: <jwv38wfgptp.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 01 Mar 2013 09:29:23 -0500")
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
next prev parent reply other threads:[~2013-03-01 19:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 9:30 bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Thierry Volpiatto
2013-02-27 9:48 ` Thierry Volpiatto
2013-02-27 10:11 ` Andreas Schwab
2013-02-27 10:50 ` Thierry Volpiatto
2013-02-27 11:57 ` Andreas Schwab
2013-02-27 12:03 ` Thierry Volpiatto
2013-02-27 14:08 ` Stefan Monnier
2013-02-27 14:35 ` Thierry Volpiatto
2013-02-27 15:25 ` Stefan Monnier
2013-02-27 16:36 ` Thierry Volpiatto
2013-02-28 4:51 ` Stefan Monnier
2013-02-28 6:18 ` Thierry Volpiatto
2013-02-28 14:04 ` Stefan Monnier
2013-02-28 19:45 ` Thierry Volpiatto
2013-03-01 3:05 ` Stefan Monnier
2013-03-01 7:02 ` Thierry Volpiatto
2013-03-01 14:29 ` Stefan Monnier
2013-03-01 15:22 ` Thierry Volpiatto
2013-03-01 17:28 ` Stefan Monnier
2013-03-01 19:07 ` Thierry Volpiatto [this message]
2013-03-11 18:31 ` Stefan Monnier
2013-03-13 14:43 ` Thierry Volpiatto
2013-03-13 17:52 ` Stefan Monnier
2013-03-13 20:12 ` Thierry Volpiatto
2013-03-03 6:16 ` Thierry Volpiatto
2013-03-01 14:30 ` Thierry Volpiatto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppzjj5va.fsf@gmail.com \
--to=thierry.volpiatto@gmail.com \
--cc=13831@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.