From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Date: Fri, 01 Mar 2013 20:07:53 +0100 Organization: Emacs Helm Message-ID: <87ppzjj5va.fsf@gmail.com> References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> <871uc1ese2.fsf@gmail.com> <87k3ptbtoj.fsf@gmail.com> <877gltm05y.fsf@gmail.com> <87vc9cgr2i.fsf@gmail.com> <87zjyny54l.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362164969 2637 80.91.229.3 (1 Mar 2013 19:09:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Mar 2013 19:09:29 +0000 (UTC) Cc: 13831@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 01 20:09:52 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UBVL4-0008Ep-NP for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Mar 2013 20:09:50 +0100 Original-Received: from localhost ([::1]:48347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBVKg-0000fn-AK for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Mar 2013 14:09:26 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBVKW-0000es-4J for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 14:09:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBVKJ-0005fR-CU for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 14:09:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBVKI-0005eg-3o for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 14:09:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UBVMD-0000g3-O6 for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 14:11:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13831 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13621650122545 (code B ref 13831); Fri, 01 Mar 2013 19:11:01 +0000 Original-Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 19:10:12 +0000 Original-Received: from localhost ([127.0.0.1]:58502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBVLP-0000f0-R3 for submit@debbugs.gnu.org; Fri, 01 Mar 2013 14:10:12 -0500 Original-Received: from mail-wi0-f174.google.com ([209.85.212.174]:64924) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBVLL-0000er-To for 13831@debbugs.gnu.org; Fri, 01 Mar 2013 14:10:10 -0500 Original-Received: by mail-wi0-f174.google.com with SMTP id hi8so9505712wib.1 for <13831@debbugs.gnu.org>; Fri, 01 Mar 2013 11:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=GhQs9GSStkrmkiwsGF4UaBldD/K8uDCPQaIE0I7N0Zw=; b=WGUxOmFW7+GqP95BHRLPW4mhUdqfXYJ6Ll2WkVCEBoaUqKwRavLaEBVpCPllG3+Dvw HOwfz5k9uDJ8lGlMfc5nhPS1NYQNzHTYZuk5uS9NZ1/SDu2Abf2ctOoeKUu+EeOfqoiF t6EhZ/D6nFz6ZjBJ/jq+/KeE09cpP0QLdcDQKJAf44RUnMntokbtuPKgYoC18cPaPo8O 3eAURaCnVENnutJg3JXB0+Mu9UeWpfLfpF6pUqWyEinEDyFLpn41rTjOwqCmaaU8j2Wc dulq4VyYcaKClMQOnHt14e1HBkinRW3F/BtxvsWJ4Mom5SMpl7pZtARBk5sUXjqd6hOm wezg== X-Received: by 10.180.102.164 with SMTP id fp4mr5778343wib.1.1362164883921; Fri, 01 Mar 2013 11:08:03 -0800 (PST) Original-Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id fg6sm24047278wib.10.2013.03.01.11.08.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 01 Mar 2013 11:08:02 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Fri, 01 Mar 2013 09:29:23 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:71990 Archived-At: Stefan Monnier 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