From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 09:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13831 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 13831@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136195755325744 (code B ref -1); Wed, 27 Feb 2013 09:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 09:32:33 +0000 Received: from localhost ([127.0.0.1]:52576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdNI-0006hA-0O for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:32:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60904) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdNF-0006h1-3o for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:32:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAdLR-0003Zw-Ox for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:30:39 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:58401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAdLR-0003Zp-Lv for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:30:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAdLL-0000sl-SD for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:30:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAdLJ-0003Y1-GJ for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:30:31 -0500 Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]:58800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAdLJ-0003Xv-7n for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:30:29 -0500 Received: by mail-we0-f176.google.com with SMTP id s43so281087wey.35 for ; Wed, 27 Feb 2013 01:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type; bh=NZEln/EwwwhskjwhktFe8ceFSrX7TasOudKBE7q+5yw=; b=rEq+lo78H6jqTy4KMaIsybXQKsR/BgQWmdoUyolLcrX+2ViQ/CNzL9apZf2W5ZRnbh TYxsvYEo4cKVom/0wkmK3vEu0JhpthEqv7KdMyxcmuhvHiymx6dT5oKEKWEJ6Hx+XtRl grriWT00ltwgTKAhql5PObltfCgfmbUtDaHw3sEhzRlX+Aj0mGmxOMkEu2TUKcw1wvet KdosHgbWa3Vc8AOxxWy6skT+i6da7LYOSzBxjn85oSjueEc1/ib3vMqItmzTpuAY4smD ncb0CiH/Jndj14fiOMOksdOX/YRwFUoCSSaIHTfc1RVU/LRrTqM8n4YBKUKKgL3DC8zr Rnug== X-Received: by 10.180.97.233 with SMTP id ed9mr24620476wib.32.1361957428389; Wed, 27 Feb 2013 01:30:28 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ej8sm26037455wib.9.2013.02.27.01.30.24 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 01:30:27 -0800 (PST) From: Thierry Volpiatto Date: Wed, 27 Feb 2013 10:30:18 +0100 Message-ID: <87liaam7dh.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Hello, net-utils-mode have no revert-buffer function. This patch allow using "g" in e.g "*netstat*" buffer. In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit) of 2013-02-26 on dell-14z Windowing system distributor `The X.Org Foundation', version 11.0.11103000 System Description: Ubuntu 12.04.2 LTS Configured using: `configure --with-x-toolkit=lucid --without-toolkit-scroll-bars' Important settings: value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: recentf-mode: t TeX-PDF-mode: t winner-mode: t global-undo-tree-mode: t undo-tree-mode: t auto-image-file-mode: t show-paren-mode: t display-time-mode: t savehist-mode: t minibuffer-depth-indicate-mode: t eldoc-mode: t diff-auto-refine-mode: t helm-mode: t shell-dirtrack-mode: t helm-adaptative-mode: t helm-match-plugin-mode: t tooltip-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-SPC C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n M-w q M-x C-< g q M-x r e p o Recent messages: Wrote /home/thierry/labo/emacs-savanah-git/lisp/net/net-utils.el Type a prefix key to toggle it. Run 'actions' with their prefixes. '?' for more help. Finding changes in /home/thierry/labo/emacs-savanah-git/lisp/net/net-utils.el...done End of buffer [3 times] Beginning of buffer [7 times] Mark set End of buffer [4 times] Saved text from "diff --git a/lisp/net/net-utils.el b/lis" Reverting `*netstat*'... reverting `*netstat*' done Load-path shadows: ~/elisp/auctex/lpath hides ~/elisp/emacs-wget/lpath /usr/local/share/emacs/24.3.50/lisp/emacs-lisp/tq hides ~/elisp/emms/lisp/tq Features: (shadow gnus-dired nnir mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win emacsbug view woman man helm-man helm-apt vc vc-dispatcher help-mode helm-misc helm-ring net-utils helm-command recentf ido conf-mode allout tex-info tex dbus vc-rcs sh-script smie executable jka-compr vc-git naquadah-theme em-smart em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util align-let server winner undo-tree diff slime-xref-browser slime-banner slime-tramp slime-asdf slime-fancy slime-fontifying-fu slime-package-fu slime-references slime-scratch slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-repl image-file newsticker newst-treeview tree-widget newst-plainview newst-reader newst-ticker newst-backend xdvi-search preview-latex pcomplete-extension em-term term disp-table ehelp electric helm-ipython helm-elisp helm-eval python rx whitespace paren time avoid savehist smtpmail-async smtpmail sendmail helm-async boxquote markdown-mode org-google-weather google-weather url-cache iterator googlecl google-maps google-maps-static google-maps-geocode google-maps-base json simple-call-tree el-expectations el-mock iedit-rect rect iedit iedit-lib zop-to-char smallurl mm-url gnus gnus-ems nnheader rectangle-utils tv-utils async pcvs pcvs-parse pcvs-info pcvs-defs ewoc mb-depth ioccur cl-info slime hyperspec slime-autoloads tex-site auto-loads esh-toggle flymake eldoc-eval eldoc no-word dired-extension emms-mpd-config emms-playlist-limit emms-volume emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time emms-lyrics emms-url hl-line emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer emms-info emms-streams later-do emms-source-playlist emms-source-file emms-player-simple emms-setup emms emms-compat magit-stgit magit-bisect magit-key-mode magit diff-mode log-edit pcvs-util add-log htmlize-hack htmlize muse-colors muse-docbook muse-texinfo texnfo-upd texinfo muse-latex muse-html muse-xml-common muse-wiki cus-edit cus-start cus-load muse-publish muse-project muse-protocols muse-regexps wid-edit muse muse-nested-tags muse-mode muse-autoloads org-config-thierry ob-sh org-crypt cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs vc-hg org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-agenda appt diary-lib diary-loaddefs org-annotation-helper org-capture org-mks remember org-remember org-datetree addressbook-bookmark message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol bookmark-firefox-handler bookmark-extensions org ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs find-func cal-menu calendar cal-loaddefs bookmark pp init-helm-thierry helm-mode helm-imenu imenu helm-ls-git helm-descbinds helm-ls-hg helm-files image-dired tramp tramp-compat tramp-loaddefs trampver shell pcomplete format-spec dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen helm-tags helm-bookmark helm-adaptative helm-info helm-net browse-url xml url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap helm-plugin helm-help helm-match-plugin helm-grep wgrep-helm wgrep helm-regexp grep helm-external helm-utils warnings dired compile comint ansi-color ring helm-locate helm advice help-fns helm-config helm-aliases epa-file epa derived epg epg-config auth-source eieio byte-opt bytecomp byte-compile cconv gnus-util time-date mm-util mail-prsvr password-cache usage-memo info easymenu cl-macs gv edmacro kmacro cl nadvice cl-lib tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind inotify dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty emacs) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function In-Reply-To: <87liaam7dh.fsf@gmail.com> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 09:51: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 To: 13831@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136195866027507 (code B ref -1); Wed, 27 Feb 2013 09:51:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 09:51:00 +0000 Received: from localhost ([127.0.0.1]:52626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdfA-00079b-Au for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:51:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38427) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAdf7-00079U-Ur for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAddH-0000Tx-7x for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:49:08 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:49107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAddH-0000Tt-4a for submit@debbugs.gnu.org; Wed, 27 Feb 2013 04:49:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAddF-0004kx-IZ for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:49:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAddE-0000Te-Ac for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:49:01 -0500 Received: from plane.gmane.org ([80.91.229.3]:35341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAddE-0000Sl-3g for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 04:49:00 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UAddX-0002CM-OW for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 10:49:19 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2013 10:49:19 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2013 10:49:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ From: Thierry Volpiatto Date: Wed, 27 Feb 2013 10:48:50 +0100 Organization: Emacs Helm Lines: 95 Message-ID: <87hakym6il.fsf@gmail.com> References: <87liaam7dh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:rgEVVaP920Kco+rd4kzEkQL9+f0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Thierry Volpiatto writes: > Hello, > net-utils-mode have no revert-buffer function. > This patch allow using "g" in e.g "*netstat*" buffer. diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 28fd5c6..3a20add 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -1,3 +1,5 @@ + +Process nil processus arrêté ;;; net-utils.el --- network functions ;; Copyright (C) 1998-2013 Free Software Foundation, Inc. @@ -285,7 +287,10 @@ This variable is only used if the variable (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (set (make-local-variable 'revert-buffer-function) + 'net-utils-revert-function) + (define-key net-utils-mode-map (kbd "g") 'revert-buffer)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -354,14 +359,17 @@ This variable is only used if the variable ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defvar net-utils-program-name nil) +(defvar net-utils-program-args nil) (defun net-utils-run-simple (buffer-name program-name args) "Run a network utility for diagnostic output only." - (interactive) (when (get-buffer buffer-name) (kill-buffer buffer-name)) (get-buffer-create buffer-name) (with-current-buffer buffer-name (net-utils-mode) + (set (make-local-variable 'net-utils-program-name) program-name) + (set (make-local-variable 'net-utils-program-args) args) (set-process-filter (apply 'start-process (format "%s" program-name) buffer-name program-name args) @@ -369,6 +377,31 @@ This variable is only used if the variable (goto-char (point-min))) (display-buffer buffer-name)) +(defun net-utils-revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (let ((inhibit-read-only t)) + (erase-buffer) + (set-process-filter + (apply 'start-process (format "%s" net-utils-program-name) + (buffer-name) net-utils-program-name net-utils-program-args) + #'(lambda (process output-string) + (let ((filtered-string output-string)) + (set-buffer (process-buffer process)) + (let ((inhibit-read-only t)) + (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))))))) + (set-process-sentinel + (get-process net-utils-program-name) + #'(lambda (process event) + (when (string= event "finished\n") + (message "reverting `%s' done" (buffer-name))))))) + ;;;###autoload (defun ifconfig () "Run ifconfig and display diagnostic output." @@ -428,9 +461,8 @@ This variable is only used if the variable (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Andreas Schwab Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 10:14:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136196000829410 (code B ref 13831); Wed, 27 Feb 2013 10:14:02 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 10:13:28 +0000 Received: from localhost ([127.0.0.1]:52641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAe0t-0007eI-Ap for submit@debbugs.gnu.org; Wed, 27 Feb 2013 05:13:27 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:39221) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAe0q-0007eA-6W for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 05:13:25 -0500 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3ZGCNP2v9Pz3hhk5; Wed, 27 Feb 2013 11:11:33 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3ZGCNP0cD9zbbnZ; Wed, 27 Feb 2013 11:11:33 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id fRqi744-dU-8; Wed, 27 Feb 2013 11:11:30 +0100 (CET) X-Auth-Info: a21mJsw3O0m6NMg8PHUoGk2p96OWn6tpzOMglCFNGVA= Received: from hawking.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 27 Feb 2013 11:11:30 +0100 (CET) From: Andreas Schwab References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> X-Yow: .. I want a COLOR T.V. and a VIBRATING BED!!! Date: Wed, 27 Feb 2013 11:11:30 +0100 In-Reply-To: <87hakym6il.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 27 Feb 2013 10:48:50 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el > index 28fd5c6..3a20add 100644 > --- a/lisp/net/net-utils.el > +++ b/lisp/net/net-utils.el > @@ -1,3 +1,5 @@ > + > +Process nil processus arr=C3=AAt=C3=A9 error: (void-variable Process) > @@ -369,6 +377,31 @@ This variable is only used if the variable > (goto-char (point-min))) > (display-buffer buffer-name)) > =20 > +(defun net-utils-revert-function (&optional ignore-auto noconfirm) > + (message "Reverting `%s'..." (buffer-name)) > + (let ((inhibit-read-only t)) > + (erase-buffer) > + (set-process-filter > + (apply 'start-process (format "%s" net-utils-program-name) ^^^^^^^^^^^^ That's a no-op. > + (buffer-name) net-utils-program-name net-utils-program-arg= s) > + #'(lambda (process output-string) > + (let ((filtered-string output-string)) > + (set-buffer (process-buffer process)) > + (let ((inhibit-read-only t)) > + (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))))))) > + (set-process-sentinel > + (get-process net-utils-program-name) There is no guarantee that a process with this name exists. Andreas. --=20 Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function In-Reply-To: <87liaam7dh.fsf@gmail.com> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 10:53:02 +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 To: 13831@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1361962381417 (code B ref -1); Wed, 27 Feb 2013 10:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 10:53:01 +0000 Received: from localhost ([127.0.0.1]:52693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAedA-00006d-9R for submit@debbugs.gnu.org; Wed, 27 Feb 2013 05:53:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57984) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAed8-00006X-BB for submit@debbugs.gnu.org; Wed, 27 Feb 2013 05:52:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAebI-0007NS-Lw for submit@debbugs.gnu.org; Wed, 27 Feb 2013 05:51:08 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:48205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAebI-0007N7-IR for submit@debbugs.gnu.org; Wed, 27 Feb 2013 05:51:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAebE-0002Wv-H4 for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 05:51:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAebA-0007Em-92 for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 05:51:00 -0500 Received: from plane.gmane.org ([80.91.229.3]:59220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAeb9-0007EL-U2 for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 05:50:56 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UAebQ-0007wN-EM for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2013 11:51:12 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2013 11:51:12 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Feb 2013 11:51:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ From: Thierry Volpiatto Date: Wed, 27 Feb 2013 11:50:42 +0100 Organization: Emacs Helm Lines: 150 Message-ID: <87d2vmm3nh.fsf@gmail.com> References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:shGvn33Bx0uC8/JtdP7AcIbBrd0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Andreas Schwab writes: > Thierry Volpiatto writes: > >> diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el >> index 28fd5c6..3a20add 100644 >> --- a/lisp/net/net-utils.el >> +++ b/lisp/net/net-utils.el >> @@ -1,3 +1,5 @@ >> + >> +Process nil processus arrêté > > error: (void-variable Process) Yes sorry, fixed. >> @@ -369,6 +377,31 @@ This variable is only used if the variable >> (goto-char (point-min))) >> (display-buffer buffer-name)) >> >> +(defun net-utils-revert-function (&optional ignore-auto noconfirm) >> + (message "Reverting `%s'..." (buffer-name)) >> + (let ((inhibit-read-only t)) >> + (erase-buffer) >> + (set-process-filter >> + (apply 'start-process (format "%s" net-utils-program-name) > ^^^^^^^^^^^^ > > That's a no-op. Fixed. >> + (buffer-name) net-utils-program-name net-utils-program-args) >> + #'(lambda (process output-string) >> + (let ((filtered-string output-string)) >> + (set-buffer (process-buffer process)) >> + (let ((inhibit-read-only t)) >> + (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))))))) >> + (set-process-sentinel >> + (get-process net-utils-program-name) > > There is no guarantee that a process with this name exists. Where ? in the sentinel ? The process take this name in `net-utils-run-simple': --8<---------------cut here---------------start------------->8--- (set (make-local-variable 'net-utils-program-name) program-name) (set (make-local-variable 'net-utils-program-args) args) (set-process-filter (apply 'start-process (format "%s" program-name) --8<---------------cut here---------------end--------------->8--- I have also removed (interactive) in this same function which was wrong IMO. Here the corrected patch: diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 28fd5c6..83b3268 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -285,7 +285,10 @@ This variable is only used if the variable (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (set (make-local-variable 'revert-buffer-function) + 'net-utils-revert-function) + (define-key net-utils-mode-map (kbd "g") 'revert-buffer)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -354,14 +357,17 @@ This variable is only used if the variable ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defvar net-utils-program-name nil) +(defvar net-utils-program-args nil) (defun net-utils-run-simple (buffer-name program-name args) "Run a network utility for diagnostic output only." - (interactive) (when (get-buffer buffer-name) (kill-buffer buffer-name)) (get-buffer-create buffer-name) (with-current-buffer buffer-name (net-utils-mode) + (set (make-local-variable 'net-utils-program-name) program-name) + (set (make-local-variable 'net-utils-program-args) args) (set-process-filter (apply 'start-process (format "%s" program-name) buffer-name program-name args) @@ -369,6 +375,33 @@ This variable is only used if the variable (goto-char (point-min))) (display-buffer buffer-name)) +(defun net-utils-revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (let ((proc (get-process net-utils-program-name))) + (when proc (set-process-filter proc t) (delete-process proc))) + (let ((inhibit-read-only t)) + (erase-buffer) + (set-process-filter + (apply 'start-process net-utils-program-name + (buffer-name) net-utils-program-name net-utils-program-args) + #'(lambda (process output-string) + (let ((filtered-string output-string)) + (set-buffer (process-buffer process)) + (let ((inhibit-read-only t)) + (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))))))) + (set-process-sentinel + (get-process net-utils-program-name) + #'(lambda (process event) + (when (string= event "finished\n") + (message "reverting `%s' done" (buffer-name))))))) + ;;;###autoload (defun ifconfig () "Run ifconfig and display diagnostic output." @@ -428,9 +461,8 @@ This variable is only used if the variable (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Andreas Schwab Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 12:00:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13619663876483 (code B ref 13831); Wed, 27 Feb 2013 12:00:02 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 11:59:47 +0000 Received: from localhost ([127.0.0.1]:52778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAffk-0001gU-FJ for submit@debbugs.gnu.org; Wed, 27 Feb 2013 06:59:45 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:47840) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAffh-0001gK-6J for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 06:59:42 -0500 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3ZGFl175lTz4KK7H; Wed, 27 Feb 2013 12:57:49 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3ZGFl16HqMzbbpM; Wed, 27 Feb 2013 12:57:49 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id JXCopW6eZZ1l; Wed, 27 Feb 2013 12:57:48 +0100 (CET) X-Auth-Info: +K3q0SRAyXge2QKlDg5U8Gy1woT1OVhX+qx3aMK1YVk= Received: from hawking.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 27 Feb 2013 12:57:48 +0100 (CET) From: Andreas Schwab References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> X-Yow: I'm meditating on the FORMALDEHYDE and the ASBESTOS leaking into my PERSONAL SPACE!! Date: Wed, 27 Feb 2013 12:57:47 +0100 In-Reply-To: <87d2vmm3nh.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 27 Feb 2013 11:50:42 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) RTFM. NAME is name for process. It is modified if necessary to make it unique. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 12:06: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 To: Andreas Schwab Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13619667487040 (code B ref 13831); Wed, 27 Feb 2013 12:06:01 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 12:05:48 +0000 Received: from localhost ([127.0.0.1]:52784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAflb-0001pV-QE for submit@debbugs.gnu.org; Wed, 27 Feb 2013 07:05:47 -0500 Received: from mail-ee0-f45.google.com ([74.125.83.45]:35180) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAflY-0001pN-Vg for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 07:05:46 -0500 Received: by mail-ee0-f45.google.com with SMTP id b57so394895eek.18 for <13831@debbugs.gnu.org>; Wed, 27 Feb 2013 04:03:54 -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=HL/VXo3QZPjGwZy6k4gpLMPYp6Df/OBwQHe0PVfb/hY=; b=FFV8cd7Dzy4KOHmmKY2hbQLkWvYTMRqSbVFW7bYk9CTKyb0oNiR6WhyT6nm2JIgUJd +uGGzxkcQzSipREEyHx2zFQLSx3/VhRlC80ptxTD000DDw0FPF+ozQ/fE0vWdbKv5m7I jXcP2CZlzHxXknXkt9HQd3U45H91AZNPdWtmWeXLB0QLYYZzdxPV8v1UaZaFNLJCaLxb P6fM4CFAdJ08ZtT9KRjFXi5MDEpm2c6P/XkXoUtYBbZyt1RCgHsYK5BfWvloHKc0vHuw q0mdwJu+517kvUyWsGsA18ztuH1OH0v2nhrSaqVzKsOrAqjhD3YAMIwA3ZSlEJ4yJoVv yN6A== X-Received: by 10.14.173.67 with SMTP id u43mr5673164eel.22.1361966633957; Wed, 27 Feb 2013 04:03:53 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m46sm6078249eeo.16.2013.02.27.04.03.51 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 04:03:52 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> Date: Wed, 27 Feb 2013 13:03:42 +0100 In-Reply-To: (Andreas Schwab's message of "Wed, 27 Feb 2013 12:57:47 +0100") Message-ID: <878v6am09t.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Andreas Schwab writes: > RTFM. Ok, best is you implement this feature request yourself. I will not follow up on this. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 14:11:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136197421621288 (code B ref 13831); Wed, 27 Feb 2013 14:11:02 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 14:10:16 +0000 Received: from localhost ([127.0.0.1]:52937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAhi4-0005XI-6B for submit@debbugs.gnu.org; Wed, 27 Feb 2013 09:10:16 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:25013) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAhi1-0005X9-LO for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 09:10:14 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFxKJt/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jEAs0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFxKJt/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jEAs0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2594787" Received: from 69-196-162-109.dsl.teksavvy.com (HELO pastel.home) ([69.196.162.109]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2013 09:08:21 -0500 Received: by pastel.home (Postfix, from userid 20848) id 149046BCBF; Wed, 27 Feb 2013 09:08:22 -0500 (EST) From: Stefan Monnier Message-ID: References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> Date: Wed, 27 Feb 2013 09:08:22 -0500 In-Reply-To: <87d2vmm3nh.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 27 Feb 2013 11:50:42 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> There is no guarantee that a process with this name exists. > Where ? in the sentinel ? > The process take this name in `net-utils-run-simple': > --8<---------------cut here---------------start------------->8--- > (set (make-local-variable 'net-utils-program-name) program-name) > (set (make-local-variable 'net-utils-program-args) args) > (set-process-filter > (apply 'start-process (format "%s" program-name) > --8<---------------cut here---------------end--------------->8--- Using process names (like buffer names, BTW) is often unreliable. Better use the process object itself. I.e. rather than (set (make-local-variable 'net-utils-program-name) program-name) and then later call start-process (which may choose a different name than program-name if there's already a process by that name), better just do (set (make-local-variable 'net-utils-proc) (start-process ...)) so you can then use net-utils-proc, being absolutely sure this is the process you started. Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 14:39: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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136197588323556 (code B ref 13831); Wed, 27 Feb 2013 14:39:01 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 14:38:03 +0000 Received: from localhost ([127.0.0.1]:52958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAi8t-00067Z-GQ for submit@debbugs.gnu.org; Wed, 27 Feb 2013 09:38:01 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:36002) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAi8k-00067L-Ku for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 09:37:52 -0500 Received: by mail-wi0-f178.google.com with SMTP id hq4so743164wib.17 for <13831@debbugs.gnu.org>; Wed, 27 Feb 2013 06:35:59 -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=CIsEuWtpI0z6nOcZwfFEn1ibDE/SXRNWypmrZCgUOsA=; b=x00nTJitwZpTr03bvEXZ8zdvWg/ob8wH+waiedmJUHgMpe2IOvXUZDYXYZXb7jheEV Y0hWlMSAsHKoosBSpiM+DY+clKjMcVVqEbuaYStJsrDVXYnhKUtmdqzWPgRTBO573vwv h/FoaEY1iCgjAYSjPP2LHPUT/8Cb5hMqpkSPjOCl5Y5UsPWI6CZ2WN9LUypXzXDW76J/ hWYpeoTJCMvO+DZnSxrhBQ7tMrs9fbCWq7yN4duwAFcM3xHxXa6efKERkC3WJkJ1r0Iv Q1Uwv/eOQhfSjhwCKgMRp0g7bZS204YDoBLJuquZcJW7jmXkRRx9mLyAn86FGmaJrYSK OsUg== X-Received: by 10.180.87.162 with SMTP id az2mr26506423wib.27.1361975759083; Wed, 27 Feb 2013 06:35:59 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ed6sm9129427wib.9.2013.02.27.06.35.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 06:35:57 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> Date: Wed, 27 Feb 2013 15:35:49 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 27 Feb 2013 09:08:22 -0500") Message-ID: <871uc1ese2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>> There is no guarantee that a process with this name exists. >> Where ? in the sentinel ? >> The process take this name in `net-utils-run-simple': >> --8<---------------cut here---------------start------------->8--- >> (set (make-local-variable 'net-utils-program-name) program-name) >> (set (make-local-variable 'net-utils-program-args) args) >> (set-process-filter >> (apply 'start-process (format "%s" program-name) >> --8<---------------cut here---------------end--------------->8--- > > Using process names (like buffer names, BTW) is often unreliable. > Better use the process object itself. I.e. rather than (set > (make-local-variable 'net-utils-program-name) program-name) and then > later call start-process (which may choose a different name than > program-name if there's already a process by that name), better just do > (set (make-local-variable 'net-utils-proc) (start-process ...)) so you > can then use net-utils-proc, being absolutely sure this is the process > you started. Thanks Stefan, it is what I understood and it was fixed. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 15:28: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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136197885828383 (code B ref 13831); Wed, 27 Feb 2013 15:28:01 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 15:27:38 +0000 Received: from localhost ([127.0.0.1]:53661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAiuv-0007Nj-TF for submit@debbugs.gnu.org; Wed, 27 Feb 2013 10:27:38 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:34255) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAius-0007NZ-GI for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 10:27:36 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r1RFPgCG000423; Wed, 27 Feb 2013 10:25:42 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 9A4B4B40E2; Wed, 27 Feb 2013 10:25:42 -0500 (EST) From: Stefan Monnier Message-ID: References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> <871uc1ese2.fsf@gmail.com> Date: Wed, 27 Feb 2013 10:25:42 -0500 In-Reply-To: <871uc1ese2.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 27 Feb 2013 15:35:49 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4505=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4505> : streams <914484> : uri <1356625> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > Thanks Stefan, it is what I understood and it was fixed. Good. Do you still need help installing it (if so, please resend the patch because I haven't seen the updated version)? Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2013 16:39:02 +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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13619831022306 (code B ref 13831); Wed, 27 Feb 2013 16:39:02 +0000 Received: (at 13831) by debbugs.gnu.org; 27 Feb 2013 16:38:22 +0000 Received: from localhost ([127.0.0.1]:53752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAk1M-0000b7-2y for submit@debbugs.gnu.org; Wed, 27 Feb 2013 11:38:20 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:37364) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAk1I-0000ax-0d for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 11:38:17 -0500 Received: by mail-ee0-f46.google.com with SMTP id e49so691256eek.33 for <13831@debbugs.gnu.org>; Wed, 27 Feb 2013 08:36:24 -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=z+WjQKt7se8Y0UnzMFan8AAbnjwjePZ88QBAyHMmn+o=; b=yZNyASAoLtWuA2yhahRaaxhpDelaQBuajuicDQc2y9f3GjmJzbcgfuJL14tM+M/XE4 cQtOzJ2YvP0SABYUzaHkYUmQJbt3bmhnkYzUji8p0vYqbAWaeAbBb1wFLgo88tGjRo1O qwoC97mDgGbknj4mGpdCP+WugV9Jl/yTF9M5vCde/1cTruiogBd5uyjgUru4O0agTRm9 K0+ZP2RO3BB7S9yf3rkSCfwnmTLjMDDK6/tdgZIHTJ3mAJOxIsRx60zUOl4LOWRuIw7E cCCzeAY/4RKhGxI6sAJzUzL+4il2wtICuBakVzy0kAojoA1DahP2s9tIIoT0fnNgGeqj WxAA== X-Received: by 10.14.193.134 with SMTP id k6mr7561485een.37.1361982983898; Wed, 27 Feb 2013 08:36:23 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id 3sm7304155eej.6.2013.02.27.08.36.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 08:36:22 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> <871uc1ese2.fsf@gmail.com> Date: Wed, 27 Feb 2013 17:36:12 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 27 Feb 2013 10:25:42 -0500") Message-ID: <87k3ptbtoj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Thanks Stefan, it is what I understood and it was fixed. > > Good. Do you still need help installing it (if so, please resend the > patch because I haven't seen the updated version)? Yes please, I only have a git repo of Emacs now. Here the patch modified again, tested with netstat. Let me know if you find something wrong. You will find a (format "%s" program-name), it was here I don't know why, I leave it, but it can probably be removed. Also `net-utils-run-simple' was interactive with no arguments provided interactively, which was wrong, I removed it. Many functions are actually using `net-utils-run-program' and will not have `revert-buffer' enabled, I corrected only `trace-route', but others could be modified, that can be done later, it will be easy. Thanks. diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 28fd5c6..db5637b 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -285,7 +285,10 @@ This variable is only used if the variable (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (set (make-local-variable 'revert-buffer-function) + 'net-utils-revert-function) + (define-key net-utils-mode-map (kbd "g") 'revert-buffer)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -354,21 +357,56 @@ This variable is only used if the variable ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defvar net-utils-program-name nil) +(defvar net-utils-program-args nil) +(defvar net-utils-mode-process nil) (defun net-utils-run-simple (buffer-name program-name args) "Run a network utility for diagnostic output only." - (interactive) (when (get-buffer buffer-name) (kill-buffer buffer-name)) (get-buffer-create buffer-name) (with-current-buffer buffer-name (net-utils-mode) - (set-process-filter - (apply 'start-process (format "%s" program-name) - buffer-name program-name args) - 'net-utils-remove-ctrl-m-filter) + (set (make-local-variable 'net-utils-program-name) program-name) + (set (make-local-variable 'net-utils-program-args) args) + (set (make-local-variable 'net-utils-mode-process) + (apply 'start-process (format "%s" program-name) + buffer-name program-name args)) + (set-process-filter net-utils-mode-process + 'net-utils-remove-ctrl-m-filter) (goto-char (point-min))) (display-buffer buffer-name)) +(defun net-utils-revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (when net-utils-mode-process + (set-process-filter net-utils-mode-process t) + (delete-process net-utils-mode-process)) + (let ((inhibit-read-only t)) + (erase-buffer) + (setq net-utils-mode-process (apply 'start-process net-utils-program-name + (buffer-name) net-utils-program-name + net-utils-program-args)) + (set-process-filter + net-utils-mode-process + #'(lambda (process output-string) + (let ((filtered-string output-string)) + (set-buffer (process-buffer process)) + (let ((inhibit-read-only t)) + (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))))))) + (set-process-sentinel + net-utils-mode-process + #'(lambda (process event) + (when (string= event "finished\n") + (message "Reverting `%s' done" (process-buffer process)))))))) + ;;;###autoload (defun ifconfig () "Run ifconfig and display diagnostic output." @@ -428,9 +466,8 @@ This variable is only used if the variable (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Feb 2013 04:54: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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13620272355105 (code B ref 13831); Thu, 28 Feb 2013 04:54:01 +0000 Received: (at 13831) by debbugs.gnu.org; 28 Feb 2013 04:53:55 +0000 Received: from localhost ([127.0.0.1]:54742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAvVC-0001KI-P0 for submit@debbugs.gnu.org; Wed, 27 Feb 2013 23:53:55 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:33215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAvVA-0001KB-OU for 13831@debbugs.gnu.org; Wed, 27 Feb 2013 23:53:53 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2661339" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2013 23:51:56 -0500 Received: by pastel.home (Postfix, from userid 20848) id ED15D6C2AE; Wed, 27 Feb 2013 23:51:54 -0500 (EST) From: Stefan Monnier Message-ID: References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> <871uc1ese2.fsf@gmail.com> <87k3ptbtoj.fsf@gmail.com> Date: Wed, 27 Feb 2013 23:51:54 -0500 In-Reply-To: <87k3ptbtoj.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 27 Feb 2013 17:36:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Yes please, I only have a git repo of Emacs now. > Here the patch modified again, tested with netstat. > Let me know if you find something wrong. Setting the process-filter to t seems odd, so I changed it to nil. Also I renamed the new functions and vars to use a "net-utils--" prefix. And I got rid of net-utils-mode-process. Finally, I removed the `g' binding, since it's already provided by `special-mode-map'. Oh, and now I see that the revert function uses a different code (e.g. different process filter) than the original code. That's weird. Why not call net-utils-run-simple from the revert function? Oh, right because net-utils-run-simple kills its buffer first. OK, can you test the patch below which changes net-utils-run-simple such that it doesn't kill the buffer, thus making the revert function much simpler? > Many functions are actually using `net-utils-run-program' and will not > have `revert-buffer' enabled, I corrected only `trace-route', but others > could be modified, that can be done later, it will be easy. Feel free do those conversions (tho I see that there's a difference in that using net-utils-run-simple means that no header gets inserted; this difference between net-utils-run-simple and net-utils-run-simple should probably be eliminated by always inserting a standard header built from program-name and args). Stefan === modified file 'lisp/net/net-utils.el' --- lisp/net/net-utils.el 2013-01-01 09:11:05 +0000 +++ lisp/net/net-utils.el 2013-02-28 04:45:02 +0000 @@ -285,7 +285,8 @@ (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (setq-local revert-buffer-function #'net-utils--revert-function)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -354,20 +355,38 @@ ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun net-utils-run-simple (buffer-name program-name args) +;; Todo: This data could be saved in a bookmark. +(defvar net-utils--revert-cmd nil) + +(defun net-utils-run-simple (buffer program-name args) "Run a network utility for diagnostic output only." - (interactive) - (when (get-buffer buffer-name) - (kill-buffer buffer-name)) - (get-buffer-create buffer-name) - (with-current-buffer buffer-name + (with-current-buffer (if (stringp buffer) (get-buffer-create buffer) buffer) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-filter proc nil) + (delete-process proc))) + (let ((inhibit-read-only t)) + (erase-buffer)) (net-utils-mode) + (setq-local net-utils--revert-cmd + `(net-utils-run-simple ,(current-buffer) ,program-name ,args)) (set-process-filter - (apply 'start-process (format "%s" program-name) - buffer-name program-name args) + (apply 'start-process program-name + (current-buffer) program-name args) 'net-utils-remove-ctrl-m-filter) - (goto-char (point-min))) - (display-buffer buffer-name)) + (goto-char (point-min)) + (display-buffer (current-buffer)))) + +(defun net-utils--revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (apply (car net-utils--revert-cmd) (cdr net-utils--revert-cmd)) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-sentinel + proc + (lambda (process event) + (when (string= event "finished\n") + (message "Reverting `%s' done" (process-buffer process)))))))) ;;;###autoload (defun ifconfig () @@ -428,9 +447,8 @@ (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Feb 2013 06:21: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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136203242413481 (code B ref 13831); Thu, 28 Feb 2013 06:21:01 +0000 Received: (at 13831) by debbugs.gnu.org; 28 Feb 2013 06:20:24 +0000 Received: from localhost ([127.0.0.1]:54833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAwqu-0003VO-Dz for submit@debbugs.gnu.org; Thu, 28 Feb 2013 01:20:24 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:40623) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAwqs-0003VH-LL for 13831@debbugs.gnu.org; Thu, 28 Feb 2013 01:20:23 -0500 Received: by mail-wi0-f175.google.com with SMTP id l13so7263647wie.2 for <13831@debbugs.gnu.org>; Wed, 27 Feb 2013 22:18:27 -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=7sVHHkOUpTmBBx8Vo/ld38f52/iZC+79dpeWi5A/RzI=; b=LqdnC5nGcQgm/zf+CfDEb0/E+OoPl/FcYwpkHogbLefDb8IfZaPH3LhxWSI4CYq6h3 XvYPHzXKv/XEynh4wpp9xIfn3lSiLSIIbMnbu0u5Ar92/4WeyWMURxTAc2xo/VGJ+Ynu b4UmN+Ka45CXkrCxkMjCl1+0+AAZAoMe/Iv8w3hfyf3aOgyP1GTMzk54LuU2iHOzqxhH NOS1oQhwtsquGfGf/2TCQWSxk1Cl6RuH0MpX/SqH/gycJmudhg1bDGIgrlU3v08Y4tnC B5jkx806ZsIAnBur3+08mfPbMbwh0TQHap6b7hQOW+nMnQCH14FhxQLeNvNHQzXARs9V r5gQ== X-Received: by 10.194.170.165 with SMTP id an5mr8508486wjc.41.1362032307411; Wed, 27 Feb 2013 22:18:27 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id bj9sm31238937wib.4.2013.02.27.22.18.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 22:18:26 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm References: <87liaam7dh.fsf@gmail.com> <87hakym6il.fsf@gmail.com> <87d2vmm3nh.fsf@gmail.com> <871uc1ese2.fsf@gmail.com> <87k3ptbtoj.fsf@gmail.com> Date: Thu, 28 Feb 2013 07:18:17 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 27 Feb 2013 23:51:54 -0500") Message-ID: <877gltm05y.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Stefan, Stefan Monnier writes: > Setting the process-filter to t seems odd, so I changed it to nil. > Also I renamed the new functions and vars to use a "net-utils--" prefix. > And I got rid of net-utils-mode-process. Finally, I removed the `g' > binding, since it's already provided by `special-mode-map'. > > Oh, and now I see that the revert function uses a different code > (e.g. different process filter) than the original code. That's weird. > Why not call net-utils-run-simple from the revert function? Oh, right > because net-utils-run-simple kills its buffer first. > OK, can you test the patch below which changes net-utils-run-simple such > that it doesn't kill the buffer, thus making the revert function > much simpler? It doesn't work: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument stringp nil) start-process(nil "*netstat*" nil) apply(start-process nil "*netstat*" nil nil) (setq net-utils-mode-process (apply (quote start-process) net-utils-program-name (buffer-name) net-utils-program-name net-utils-program-args)) (let ((inhibit-read-only t)) (erase-buffer) (setq net-utils-mode-process (apply (quote start-process) net-utils-program-name (buffer-name) net-utils-program-name net-utils-program-args)) (set-process-filter net-utils-mode-process (function (lambda (process output-string) (let ((filtered-string output-string)) (set-buffer (process-buffer process)) (let ((inhibit-read-only t)) (while (string-match "" filtered-string) (setq filtered-string ...)) (save-excursion (goto-char ...) (insert filtered-string) (set-marker ... ...))))))) (set-process-sentinel net-utils-mode-process (function (lambda (process event) (if (string= event "finished\n") (progn (message "Reverting `%s' done" (process-buffer process)))))))) net-utils-revert-function(t nil) revert-buffer(t) call-interactively(revert-buffer nil nil) command-execute(revert-buffer) --8<---------------cut here---------------end--------------->8--- I will modify your patch to make it working as soon as possible (not today). You can install my patch which is working, and we make changes in one or two days with your patch modified.(Or just wait) > Feel free do those conversions (tho I see that there's a difference in > that using net-utils-run-simple means that no header gets inserted; this > difference between net-utils-run-simple and net-utils-run-simple should > probably be eliminated by always inserting a standard header built from > program-name and args). Yes the header is not important (for traceroute unneeded). Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Feb 2013 14:07: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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136206038828328 (code B ref 13831); Thu, 28 Feb 2013 14:07:01 +0000 Received: (at 13831) by debbugs.gnu.org; 28 Feb 2013 14:06:28 +0000 Received: from localhost ([127.0.0.1]:55473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB47v-0007Mp-Lr for submit@debbugs.gnu.org; Thu, 28 Feb 2013 09:06:28 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:31003) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB47s-0007Mh-Cu for 13831@debbugs.gnu.org; Thu, 28 Feb 2013 09:06:25 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2679227" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2013 09:04:26 -0500 Received: by pastel.home (Postfix, from userid 20848) id 2E4786BDCD; Thu, 28 Feb 2013 09:04:27 -0500 (EST) From: Stefan Monnier Message-ID: 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> Date: Thu, 28 Feb 2013 09:04:27 -0500 In-Reply-To: <877gltm05y.fsf@gmail.com> (Thierry Volpiatto's message of "Thu, 28 Feb 2013 07:18:17 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > It doesn't work: > --8<---------------cut here---------------start------------->8--- > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > start-process(nil "*netstat*" nil) > apply(start-process nil "*netstat*" nil nil) > (setq net-utils-mode-process (apply (quote start-process) > net-utils-program-name (buffer-name) net-utils-program-name > net-utils-program-args)) This backtrace clearly shows you tried this in a session that has left-overs from your old code: the new code does not mention net-utils-program-name. Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Feb 2013 19:49:02 +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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136208088328255 (code B ref 13831); Thu, 28 Feb 2013 19:49:02 +0000 Received: (at 13831) by debbugs.gnu.org; 28 Feb 2013 19:48:03 +0000 Received: from localhost ([127.0.0.1]:56638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB9SU-0007Lg-9j for submit@debbugs.gnu.org; Thu, 28 Feb 2013 14:48:02 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:48429) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB9SR-0007LC-VV for 13831@debbugs.gnu.org; Thu, 28 Feb 2013 14:48:01 -0500 Received: by mail-ee0-f46.google.com with SMTP id e49so1777820eek.5 for <13831@debbugs.gnu.org>; Thu, 28 Feb 2013 11:46:01 -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=W0h3ldYW9xOpO7ulg+pO5ts1hLhIltUiOqn6jkLciuA=; b=LYWBO+7vR48961d61+uCnYtzQivnkZ3Q0B3mAKdNVOD3mOZ2fw9P2HVa94ztvboN7b ewBzFcmfpYk7tPzyU1IV6eY26uIB7VrwexqLx+4dsuBZzHfjZ+OuF8lsXjWD9kjLYX1I e0vGrfYZbl4OCi0beLUcaxN729BY3Ih7X3nklIIlpKQtOfVaYMZQ9JegvYXXfjtvfNxw Kr249hwjFSlJbRY6ydlJhYAhTA+RWCrTkzIdKNnVfu5yAK1Rb90RKYKw1hfL3L0Ogq4N zURL7awYuUU2VCwENRKCgeZP8Gz3H4w5KTdIUtfs3P8r1bHDrguBSACkKHzYchcUQU+I mMGg== X-Received: by 10.14.223.69 with SMTP id u45mr19858584eep.23.1362080761595; Thu, 28 Feb 2013 11:46:01 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id d47sm13438093eem.9.2013.02.28.11.45.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 28 Feb 2013 11:46:00 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm 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> Date: Thu, 28 Feb 2013 20:45:57 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 28 Feb 2013 09:04:27 -0500") Message-ID: <87vc9cgr2i.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> It doesn't work: > >> --8<---------------cut here---------------start------------->8--- >> Debugger entered--Lisp error: (wrong-type-argument stringp nil) >> start-process(nil "*netstat*" nil) >> apply(start-process nil "*netstat*" nil nil) >> (setq net-utils-mode-process (apply (quote start-process) >> net-utils-program-name (buffer-name) net-utils-program-name >> net-utils-program-args)) > > This backtrace clearly shows you tried this in a session that has > left-overs from your old code: the new code does not mention > net-utils-program-name. Indeed yes, tried this very early this morning. Just tried now and it is working, but point move at eof, it should stay on top of buffer. Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 03:08: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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13621072306679 (code B ref 13831); Fri, 01 Mar 2013 03:08:01 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 03:07:10 +0000 Received: from localhost ([127.0.0.1]:57085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBGJR-0001jg-Sh for submit@debbugs.gnu.org; Thu, 28 Feb 2013 22:07:10 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:31330) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBGJP-0001jW-3N for 13831@debbugs.gnu.org; Thu, 28 Feb 2013 22:07:07 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2741375" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2013 22:05:05 -0500 Received: by pastel.home (Postfix, from userid 20848) id ADB896A658; Thu, 28 Feb 2013 22:05:06 -0500 (EST) From: Stefan Monnier Message-ID: 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> Date: Thu, 28 Feb 2013 22:05:06 -0500 In-Reply-To: <87vc9cgr2i.fsf@gmail.com> (Thierry Volpiatto's message of "Thu, 28 Feb 2013 20:45:57 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Indeed yes, tried this very early this morning. > Just tried now and it is working, Thanks. > but point move at eof, it should stay on top of buffer. I think the difference between the initial run and the revert is that for the initial run, the traceroute buffer is not in the selected-window, whereas in the revert case, it is the selected-window. Apparently the behavior is partly on purpose, since net-utils-remove-ctrl-m-filter (which, BTW, should use with-current-buffer rather than unwind-protect) explicitly moves point. Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function 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 07:05: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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136212148427835 (code B ref 13831); Fri, 01 Mar 2013 07:05:01 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 07:04:44 +0000 Received: from localhost ([127.0.0.1]:57328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBK1L-0007Et-G9 for submit@debbugs.gnu.org; Fri, 01 Mar 2013 02:04:44 -0500 Received: from mail-ee0-f43.google.com ([74.125.83.43]:60333) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBK1H-0007Ek-EI for 13831@debbugs.gnu.org; Fri, 01 Mar 2013 02:04:41 -0500 Received: by mail-ee0-f43.google.com with SMTP id c50so2151106eek.2 for <13831@debbugs.gnu.org>; Thu, 28 Feb 2013 23:02:38 -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=5kk6mJfBg91fzMtp4HngBR/ymsVwDt1cukc8pMpLWTY=; b=WUaQtYThd7hAYfYEewnvf3ZNOF+XCqxwuEAsvJNlxuU/rcGPeOmUif+5eqhxVOjlw9 W5eTYBR4WBA4Tekxi1JzsYIGMEZYu9yLBH38icgh3zONFj5U2JIuoFjHpBZca8RtrDVy Z6N2ICgoJtn1fqAm5YCIZQcXv6jsYnnvSgB0UsAQTxhmQW8MYGNIHQsliW16fr8QK7Qp hjEk470KayVBR/pP9sgd+dSXXhTfJHTX/nd+SzZbXEijGAzuKtdiirrzV6K/Rwr7BqC5 /4s3yS9LcQ7BiD0pcR4jc7GeLCdu2yUk8V9ZoE3YRGXBg61n1+oRqSDmcr9ztXAqK16G aPDw== X-Received: by 10.14.183.67 with SMTP id p43mr24865251eem.10.1362121358162; Thu, 28 Feb 2013 23:02:38 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id a1sm15650326eep.2.2013.02.28.23.02.36 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 28 Feb 2013 23:02:36 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm 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> Date: Fri, 01 Mar 2013 08:02:34 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 28 Feb 2013 22:05:06 -0500") Message-ID: <87zjyny54l.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Stefan, Stefan Monnier writes: >> Indeed yes, tried this very early this morning. >> Just tried now and it is working, > > Thanks. > >> but point move at eof, it should stay on top of buffer. > > I think the difference between the initial run and the revert is that > for the initial run, the traceroute buffer is not in the > selected-window, whereas in the revert case, it is the selected-window. > > Apparently the behavior is partly on purpose, since > net-utils-remove-ctrl-m-filter (which, BTW, should use > with-current-buffer rather than unwind-protect) explicitly moves point. Here your patch modified, I have simplified `net-utils-remove-ctrl-m-filter'. diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 28fd5c6..5fe8d35 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -285,7 +285,8 @@ This variable is only used if the variable (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (setq-local revert-buffer-function #'net-utils--revert-function)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -318,25 +319,18 @@ 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)))) + (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)))))) (defun net-utils-run-program (name header program args) "Run a network information program." @@ -354,20 +348,38 @@ This variable is only used if the variable ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun net-utils-run-simple (buffer-name program-name args) +;; Todo: This data could be saved in a bookmark. +(defvar net-utils--revert-cmd nil) + +(defun net-utils-run-simple (buffer program-name args) "Run a network utility for diagnostic output only." - (interactive) - (when (get-buffer buffer-name) - (kill-buffer buffer-name)) - (get-buffer-create buffer-name) - (with-current-buffer buffer-name + (with-current-buffer (if (stringp buffer) (get-buffer-create buffer) buffer) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-filter proc nil) + (delete-process proc))) + (let ((inhibit-read-only t)) + (erase-buffer)) (net-utils-mode) + (setq-local net-utils--revert-cmd + `(net-utils-run-simple ,(current-buffer) ,program-name ,args)) (set-process-filter - (apply 'start-process (format "%s" program-name) - buffer-name program-name args) + (apply 'start-process program-name + (current-buffer) program-name args) 'net-utils-remove-ctrl-m-filter) - (goto-char (point-min))) - (display-buffer buffer-name)) + (goto-char (point-min)) + (display-buffer (current-buffer)))) + +(defun net-utils--revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (apply (car net-utils--revert-cmd) (cdr net-utils--revert-cmd)) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-sentinel + proc + (lambda (process event) + (when (string= event "finished\n") + (message "Reverting `%s' done" (process-buffer process)))))))) ;;;###autoload (defun ifconfig () @@ -428,9 +440,8 @@ This variable is only used if the variable (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 14:32:03 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13621482986034 (code B ref 13831); Fri, 01 Mar 2013 14:32:03 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 14:31:38 +0000 Received: from localhost ([127.0.0.1]:57707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBQzj-0001ZB-NJ for submit@debbugs.gnu.org; Fri, 01 Mar 2013 09:31:33 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:60569) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBQzf-0001Z0-Cn for 13831@debbugs.gnu.org; Fri, 01 Mar 2013 09:31:28 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2772573" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 01 Mar 2013 09:29:23 -0500 Received: by pastel.home (Postfix, from userid 20848) id D25446A69F; Fri, 1 Mar 2013 09:29:23 -0500 (EST) From: Stefan Monnier Message-ID: 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> Date: Fri, 01 Mar 2013 09:29:23 -0500 In-Reply-To: <87zjyny54l.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 01 Mar 2013 08:02:34 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Here your patch modified, I have simplified > `net-utils-remove-ctrl-m-filter'. Actually, my patch is already in the trunk. Could you make the patch relative to trunk's version? > + (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. 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. Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function In-Reply-To: <87liaam7dh.fsf@gmail.com> 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 14:34:02 +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 To: 13831@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13621483836176 (code B ref -1); Fri, 01 Mar 2013 14:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Mar 2013 14:33:03 +0000 Received: from localhost ([127.0.0.1]:57716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBR1A-0001bP-1E for submit@debbugs.gnu.org; Fri, 01 Mar 2013 09:33:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42771) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBR15-0001bF-Ui for submit@debbugs.gnu.org; Fri, 01 Mar 2013 09:32:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBQz2-0007x3-HR for submit@debbugs.gnu.org; Fri, 01 Mar 2013 09:30:53 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:39755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBQz2-0007ww-Ck for submit@debbugs.gnu.org; Fri, 01 Mar 2013 09:30:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBQyv-0001h8-O9 for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 09:30:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBQyt-0007v3-QR for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 09:30:41 -0500 Received: from plane.gmane.org ([80.91.229.3]:60863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBQyt-0007uv-G0 for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 09:30:39 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UBQz3-0006ia-Hl for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2013 15:30:49 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Mar 2013 15:30:49 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Mar 2013 15:30:49 +0100 X-Injected-Via-Gmane: http://gmane.org/ From: Thierry Volpiatto Date: Fri, 01 Mar 2013 15:30:16 +0100 Organization: Emacs Helm Lines: 148 Message-ID: <87y5e7w5tz.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> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:mvwMUEQee2hOeZGUrxhn82V2qr0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi Stefan, Thierry Volpiatto writes: > Hi Stefan, > > Stefan Monnier writes: > >>> Indeed yes, tried this very early this morning. >>> Just tried now and it is working, >> >> Thanks. >> >>> but point move at eof, it should stay on top of buffer. >> >> I think the difference between the initial run and the revert is that >> for the initial run, the traceroute buffer is not in the >> selected-window, whereas in the revert case, it is the selected-window. >> >> Apparently the behavior is partly on purpose, since >> net-utils-remove-ctrl-m-filter (which, BTW, should use >> with-current-buffer rather than unwind-protect) explicitly moves point. > > Here your patch modified, I have simplified > `net-utils-remove-ctrl-m-filter'. We forget to handle the case where the buffer is reverted from somewhere else e.g ibuffer, helm etc..., this next patch handle this: (Don't display buffer) diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 28fd5c6..3498f23 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -285,7 +285,8 @@ This variable is only used if the variable (define-derived-mode net-utils-mode special-mode "NetworkUtil" "Major mode for interacting with an external network utility." (set (make-local-variable 'font-lock-defaults) - '((net-utils-font-lock-keywords)))) + '((net-utils-font-lock-keywords))) + (setq-local revert-buffer-function #'net-utils--revert-function)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions @@ -318,25 +319,18 @@ 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)))) + (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)))))) (defun net-utils-run-program (name header program args) "Run a network information program." @@ -354,20 +348,39 @@ This variable is only used if the variable ;; General network utilities (diagnostic) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun net-utils-run-simple (buffer-name program-name args) +;; Todo: This data could be saved in a bookmark. +(defvar net-utils--revert-cmd nil) + +(defun net-utils-run-simple (buffer program-name args &optional nodisplay) "Run a network utility for diagnostic output only." - (interactive) - (when (get-buffer buffer-name) - (kill-buffer buffer-name)) - (get-buffer-create buffer-name) - (with-current-buffer buffer-name + (with-current-buffer (if (stringp buffer) (get-buffer-create buffer) buffer) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-filter proc nil) + (delete-process proc))) + (let ((inhibit-read-only t)) + (erase-buffer)) (net-utils-mode) + (setq-local net-utils--revert-cmd + `(net-utils-run-simple ,(current-buffer) + ,program-name ,args 'nodisplay)) (set-process-filter - (apply 'start-process (format "%s" program-name) - buffer-name program-name args) + (apply 'start-process program-name + (current-buffer) program-name args) 'net-utils-remove-ctrl-m-filter) - (goto-char (point-min))) - (display-buffer buffer-name)) + (goto-char (point-min)) + (unless nodisplay (display-buffer (current-buffer))))) + +(defun net-utils--revert-function (&optional ignore-auto noconfirm) + (message "Reverting `%s'..." (buffer-name)) + (apply (car net-utils--revert-cmd) (cdr net-utils--revert-cmd)) + (let ((proc (get-buffer-process (current-buffer)))) + (when proc + (set-process-sentinel + proc + (lambda (process event) + (when (string= event "finished\n") + (message "Reverting `%s' done" (process-buffer process)))))))) ;;;###autoload (defun ifconfig () @@ -428,9 +441,8 @@ This variable is only used if the variable (if traceroute-program-options (append traceroute-program-options (list target)) (list target)))) - (net-utils-run-program + (net-utils-run-simple (concat "Traceroute" " " target) - (concat "** Traceroute ** " traceroute-program " ** " target) traceroute-program options))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function 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 15:25:02 +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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136215147411042 (code B ref 13831); Fri, 01 Mar 2013 15:25:02 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 15:24:34 +0000 Received: from localhost ([127.0.0.1]:58265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBRp3-0002s2-VN for submit@debbugs.gnu.org; Fri, 01 Mar 2013 10:24:34 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:51238) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBRp2-0002rw-KR for 13831@debbugs.gnu.org; Fri, 01 Mar 2013 10:24:33 -0500 Received: by mail-wi0-f172.google.com with SMTP id ez12so9216542wid.17 for <13831@debbugs.gnu.org>; Fri, 01 Mar 2013 07:22:29 -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=s6F+vJoYeO0jGqY8EQuR8hJyC4iCestunNwpGXCcX34=; b=CPgKtmeeR9LIFJJFQUKdH1MkmKv0pIrBmb92nusosxLE+MkOk459dFFsRmK6eFCUCG ZCZkTG/KqerIU091AV8sXCu4wuzr8GCwYmv9N93TQ1LHTYFGnG04OhIfVHJkJnS5Et7F utVhwvU4y2/7kJMeeqcyEuU2Oh1S6R0Jx/YIRObmpsEMihyFXOQ/ZDSjnj74DlL55uyR iDjPNZBx1Y4aNIglZirB51jbcjBeNWt887lJRddO3qUDhR22rVQQ+hinYZAoc2zbK02Z 8c7nXkg9PvYqj5CuLEyyXY9DVdbtYpTB9mQJZENFLsANvT5DCaHN1dxeUnLZ4VhV0Rwn lrMA== X-Received: by 10.194.88.138 with SMTP id bg10mr18366602wjb.13.1362151349572; Fri, 01 Mar 2013 07:22:29 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id n10sm22747469wia.0.2013.03.01.07.22.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 01 Mar 2013 07:22:28 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm 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> Date: Fri, 01 Mar 2013 16:22:20 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 01 Mar 2013 09:29:23 -0500") Message-ID: <87ip5b16xf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Here your patch modified, I have simplified >> `net-utils-remove-ctrl-m-filter'. > > Actually, my patch is already in the trunk. Could you make the patch > relative to trunk's version? Ok, this allow reverting from somewhere else (e.g ibuffer, helm): diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index cc28bab..5e27c0e 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -358,7 +358,7 @@ This variable is only used if the variable ;; Todo: This data could be saved in a bookmark. (defvar net-utils--revert-cmd nil) -(defun net-utils-run-simple (buffer program-name args) +(defun net-utils-run-simple (buffer program-name args &optional nodisplay) "Run a network utility for diagnostic output only." (with-current-buffer (if (stringp buffer) (get-buffer-create buffer) buffer) (let ((proc (get-buffer-process (current-buffer)))) @@ -369,13 +369,14 @@ This variable is only used if the variable (erase-buffer)) (net-utils-mode) (setq-local net-utils--revert-cmd - `(net-utils-run-simple ,(current-buffer) ,program-name ,args)) + `(net-utils-run-simple ,(current-buffer) + ,program-name ,args 'nodisplay)) (set-process-filter (apply 'start-process program-name (current-buffer) program-name args) 'net-utils-remove-ctrl-m-filter) (goto-char (point-min)) - (display-buffer (current-buffer)))) + (unless nodisplay (display-buffer (current-buffer))))) (defun net-utils--revert-function (&optional ignore-auto noconfirm) (message "Reverting `%s'..." (buffer-name)) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2013 17:31:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136215901622466 (code B ref 13831); Fri, 01 Mar 2013 17:31:02 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 17:30:16 +0000 Received: from localhost ([127.0.0.1]:58413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBTmi-0005qI-AK for submit@debbugs.gnu.org; Fri, 01 Mar 2013 12:30:16 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:5290) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBTmh-0005qB-2g for 13831@debbugs.gnu.org; Fri, 01 Mar 2013 12:30:15 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2793040" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 01 Mar 2013 12:28:10 -0500 Received: by pastel.home (Postfix, from userid 20848) id 0E4256A69F; Fri, 1 Mar 2013 12:28:11 -0500 (EST) From: Stefan Monnier Message-ID: 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> <87ip5b16xf.fsf@gmail.com> Date: Fri, 01 Mar 2013 12:28:11 -0500 In-Reply-To: <87ip5b16xf.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 01 Mar 2013 16:22:20 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Ok, this allow reverting from somewhere else (e.g ibuffer, helm): Thanks, installed, Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 01 12:31:07 2013 Received: (at control) by debbugs.gnu.org; 1 Mar 2013 17:31:07 +0000 Received: from localhost ([127.0.0.1]:58417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBTnW-0005ri-IF for submit@debbugs.gnu.org; Fri, 01 Mar 2013 12:31:06 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:7791) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBTnV-0005rb-2w for control@debbugs.gnu.org; Fri, 01 Mar 2013 12:31:05 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh8BBVYzCzQSFBgNiEjBLY1hgykDiGGcGYFegxU X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh8BBVYzCzQSFBgNiEjBLY1hgykDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2793124" Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 01 Mar 2013 12:29:00 -0500 Received: by pastel.home (Postfix, from userid 20848) id 9F6216A69F; Fri, 1 Mar 2013 12:29:01 -0500 (EST) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Message-ID: 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> <87ip5b16xf.fsf@gmail.com> Date: Fri, 01 Mar 2013 12:29:01 -0500 In-Reply-To: <87ip5b16xf.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 01 Mar 2013 16:22:20 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) close 13831 thanks From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function 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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13621650122545 (code B ref 13831); Fri, 01 Mar 2013 19:11:01 +0000 Received: (at 13831) by debbugs.gnu.org; 1 Mar 2013 19:10:12 +0000 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 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 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) 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) From: Thierry Volpiatto Organization: Emacs Helm 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> Date: Fri, 01 Mar 2013 20:07:53 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 01 Mar 2013 09:29:23 -0500") Message-ID: <87ppzjj5va.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) 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 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Mar 2013 06:17:02 +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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136229138521924 (code B ref 13831); Sun, 03 Mar 2013 06:17:02 +0000 Received: (at 13831) by debbugs.gnu.org; 3 Mar 2013 06:16:25 +0000 Received: from localhost ([127.0.0.1]:56311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UC2Dh-0005hZ-1g for submit@debbugs.gnu.org; Sun, 03 Mar 2013 01:16:25 -0500 Received: from mail-ea0-f181.google.com ([209.85.215.181]:52278) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UC2Dd-0005hK-8H for 13831@debbugs.gnu.org; Sun, 03 Mar 2013 01:16:22 -0500 Received: by mail-ea0-f181.google.com with SMTP id i13so575377eaa.40 for <13831@debbugs.gnu.org>; Sat, 02 Mar 2013 22:16:08 -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=rp8T+QJZsVSQTtVOh244wPyY6HUpqsV+OYUAkz49B/g=; b=08S2l5rQFZ9QYyCUSX7CF7TcEouR40j3yQu7RbsL5l3uaOwhf5L6qrHmD9EAC1EJAh z2yriin2Lwwbnu8DVbUbJIoX2PRRRdJTg593uz+JWvmPAGGBFQ4PL1j0lUEvRwQ5ks27 30z6G75WPghq6ppCpdNdTpJe92hhNE48cG48WgWK3fNzSowJlh01i+1Iw2imnSe9LyrK cp9kIvD3kR+kuStoHypACsyT+5la9dBT0igy0be+240bW8xnLewuK+I7u6Q7Ms+t8p9C cRcEwEW8trYKiTVw/IO+ighagkvmvXWXr1PjlNUxYedf+7iUHubFgeNeyHIJ4CDwC6s8 jRVA== X-Received: by 10.14.218.71 with SMTP id j47mr44658986eep.28.1362291367801; Sat, 02 Mar 2013 22:16:07 -0800 (PST) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id o3sm25593679eem.15.2013.03.02.22.16.05 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Mar 2013 22:16:06 -0800 (PST) From: Thierry Volpiatto Organization: Emacs Helm 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> Date: Sun, 03 Mar 2013 07:16:03 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 01 Mar 2013 09:29:23 -0500") Message-ID: <87k3ppvwik.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Stefan, `net-utils-remove-ctl-m' is defined, but never used, probably it is good to use it (it allow not running the test for control-m char on non--Windows platforms), otherwise we should remove it. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Mar 2013 18:33:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136302674723131 (code B ref 13831); Mon, 11 Mar 2013 18:33:02 +0000 Received: (at 13831) by debbugs.gnu.org; 11 Mar 2013 18:32:27 +0000 Received: from localhost ([127.0.0.1]:46727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UF7WM-000612-M9 for submit@debbugs.gnu.org; Mon, 11 Mar 2013 14:32:26 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:22603) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UF7WK-00060n-7Q for 13831@debbugs.gnu.org; Mon, 11 Mar 2013 14:32:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="4243270" Received: from 206-248-162-253.dsl.teksavvy.com (HELO ceviche.home) ([206.248.162.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 11 Mar 2013 14:31:21 -0400 Received: by ceviche.home (Postfix, from userid 20848) id B032F660E5; Mon, 11 Mar 2013 14:31:22 -0400 (EDT) From: Stefan Monnier Message-ID: 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> <87ppzjj5va.fsf@gmail.com> Date: Mon, 11 Mar 2013 14:31:22 -0400 In-Reply-To: <87ppzjj5va.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 01 Mar 2013 20:07:53 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 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 Installed, thank you, Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2013 14:46: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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13631859131659 (code B ref 13831); Wed, 13 Mar 2013 14:46:01 +0000 Received: (at 13831) by debbugs.gnu.org; 13 Mar 2013 14:45:13 +0000 Received: from localhost ([127.0.0.1]:51384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFmvY-0000Qh-Ir for submit@debbugs.gnu.org; Wed, 13 Mar 2013 10:45:12 -0400 Received: from mail-ea0-f170.google.com ([209.85.215.170]:55437) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFmvV-0000QU-Gl for 13831@debbugs.gnu.org; Wed, 13 Mar 2013 10:45:10 -0400 Received: by mail-ea0-f170.google.com with SMTP id a15so483572eae.29 for <13831@debbugs.gnu.org>; Wed, 13 Mar 2013 07:43:57 -0700 (PDT) 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=x6KaRSVJ4yEOV1nVJAmVN5RWJKJmNMm6KaJSx488EZ4=; b=P3Z7F5wwRfZrCs4ftwRBUGLz44g3gr7RF4a43mJJZ0eLP0LN+kTTCOKlV9oNo0rQka KhBKkoBy09bysqNmrDCdCccAn4mwFc5eH1Dv9a0thdL2j0+a0xYD/AxyVQBy+B1wHFrK pi+ytZEIgzI+AH6qknKZKjpomzkUHIZZopKFQ/7LrQDk2P/Nw+Wt8QDSSDwBqx8tZSU2 g+88QDxz11K2PxHY3SI+K0CFEXUcKWIixmVgtmie3INjjn5Kti7/Tf2sV/XGoMWUv6EI aFWRihyPz95sEg2AiFYUgJ0xjAJQsoyMdr89rXiBhsnsh1Pi2KPNEvzVeDnE0bz5m9YE Ni0Q== X-Received: by 10.14.223.199 with SMTP id v47mr59702151eep.18.1363185837531; Wed, 13 Mar 2013 07:43:57 -0700 (PDT) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id 44sm36392496eek.5.2013.03.13.07.43.55 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 13 Mar 2013 07:43:56 -0700 (PDT) From: Thierry Volpiatto Organization: Emacs Helm 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> <87ppzjj5va.fsf@gmail.com> Date: Wed, 13 Mar 2013 15:43:48 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 11 Mar 2013 14:31:22 -0400") Message-ID: <87d2v39x7f.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Stefan, Stefan Monnier writes: > Installed, thank you, Ok thanks. Also here something wrong also: --8<---------------cut here---------------start------------->8--- ;; Simplified versions of some at-point functions from ffap.el. ;; It's not worth loading all of ffap just for these. (defun net-utils-machine-at-point () --8<---------------cut here---------------end--------------->8--- This function return not only machine but anything at point, which is annoying. Thus we find some lines later: --8<---------------cut here---------------start------------->8--- (read-from-minibuffer "Lookup host: " (or (ffap-string-at-point 'machine) "")))) --8<---------------cut here---------------end--------------->8--- And ffap is not required. I think actually it is not a problem loading ffap when needed: --8<---------------cut here---------------start------------->8--- (defun net-utils-machine-at-point () (require 'ffap) (ffap-machine-at-point)) (defun net-utils-url-at-point () (require 'ffap) (ffap-url-at-point)) --8<---------------cut here---------------end--------------->8--- This reduce code and do the right thing. I can send a patch if ok. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2013 17:54:02 +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 To: Thierry Volpiatto Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.136319721922127 (code B ref 13831); Wed, 13 Mar 2013 17:54:02 +0000 Received: (at 13831) by debbugs.gnu.org; 13 Mar 2013 17:53:39 +0000 Received: from localhost ([127.0.0.1]:51709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFpru-0005kq-Ru for submit@debbugs.gnu.org; Wed, 13 Mar 2013 13:53:39 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:32193) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFprs-0005kb-HH for 13831@debbugs.gnu.org; Wed, 13 Mar 2013 13:53:37 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av8EABK/CFHO+KL9/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="4719994" Received: from 206-248-162-253.dsl.teksavvy.com (HELO pastel.home) ([206.248.162.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Mar 2013 13:52:22 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8D9B667A3B; Wed, 13 Mar 2013 13:52:23 -0400 (EDT) From: Stefan Monnier Message-ID: 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> <87ppzjj5va.fsf@gmail.com> <87d2v39x7f.fsf@gmail.com> Date: Wed, 13 Mar 2013 13:52:23 -0400 In-Reply-To: <87d2v39x7f.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 13 Mar 2013 15:43:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I think actually it is not a problem loading ffap when needed: > --8<---------------cut here---------------start------------->8--- > (defun net-utils-machine-at-point () > (require 'ffap) > (ffap-machine-at-point)) > (defun net-utils-url-at-point () > (require 'ffap) > (ffap-url-at-point)) > --8<---------------cut here---------------end--------------->8--- > This reduce code and do the right thing. We can even (require 'ffap) at top-level. It's not that big of a deal. > I can send a patch if ok. Please do, Stefan From unknown Tue Jun 17 01:43:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2013 20:15: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 To: Stefan Monnier Cc: 13831@debbugs.gnu.org Received: via spool by 13831-submit@debbugs.gnu.org id=B13831.13632056562620 (code B ref 13831); Wed, 13 Mar 2013 20:15:01 +0000 Received: (at 13831) by debbugs.gnu.org; 13 Mar 2013 20:14:16 +0000 Received: from localhost ([127.0.0.1]:51914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFs40-0000gD-30 for submit@debbugs.gnu.org; Wed, 13 Mar 2013 16:14:16 -0400 Received: from mail-ea0-f178.google.com ([209.85.215.178]:63609) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFs3y-0000fu-21 for 13831@debbugs.gnu.org; Wed, 13 Mar 2013 16:14:15 -0400 Received: by mail-ea0-f178.google.com with SMTP id g14so649989eak.23 for <13831@debbugs.gnu.org>; Wed, 13 Mar 2013 13:13:01 -0700 (PDT) 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=qzBeGb/EZqXuLm7BvH6D8Oud24ynigHD8x0bj2Qok0c=; b=DnPT1haEpuMwNpi+c5Xxy7J5WU/LYrnzAzOOoSebMzCXQSq9gaX9xmEPgXGlDj7m9u zUPaqsG7cMhv80J9Eoqz6/7szqyoBaHd3JrP65iV3/cvfSzNO3gBU0zlBNUfWtVBbNHh yqugr7jC1V+yShOxSClyHp74FhUv3wiVAwUuZPqpIaJaqicnDuaSbtQjStOkOK30mwYP YRz457kc0QP7PBkivgiJb8jxGFFAitLriOp0/K48kuWMP/+fSh88FbIEJngEW0MTquGk ZHmIwx8MJBXOKM0hynPFjtORTIZ5eGw1IbhkT8aOkdhrxlW4DL9kaGUhH3eIhfnxodCN I7yg== X-Received: by 10.14.184.68 with SMTP id r44mr29203963eem.40.1363205581105; Wed, 13 Mar 2013 13:13:01 -0700 (PDT) Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id 44sm38118058eek.5.2013.03.13.13.12.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 13 Mar 2013 13:13:00 -0700 (PDT) From: Thierry Volpiatto Organization: Emacs Helm 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> <87ppzjj5va.fsf@gmail.com> <87d2v39x7f.fsf@gmail.com> Date: Wed, 13 Mar 2013 21:12:54 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 13 Mar 2013 13:52:23 -0400") Message-ID: <87ehfjxdmh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> I think actually it is not a problem loading ffap when needed: >> --8<---------------cut here---------------start------------->8--- >> (defun net-utils-machine-at-point () >> (require 'ffap) >> (ffap-machine-at-point)) >> (defun net-utils-url-at-point () >> (require 'ffap) >> (ffap-url-at-point)) >> --8<---------------cut here---------------end--------------->8--- >> This reduce code and do the right thing. > > We can even (require 'ffap) at top-level. It's not that big of a deal. Ok. >> I can send a patch if ok. > > Please do, I didn't use `ffap-machine-at-point' because it is hanging forever when called on e.g www.google.fr. Don't know if it is a bug or the expected behavior (I doubt of this according to its docstring). --8<---------------cut here---------------start------------->8--- (net-utils-machine-at-point, net-utils-url-at-point): Use `ffap-string-at-point'. (ping): Use localhost as default input if no machine at point. Use `net-utils-run-simple'. (run-dig): Use `net-utils-run-simple'. --8<---------------cut here---------------end--------------->8--- diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 9a6c7b1..6155f5b 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -44,6 +44,8 @@ ;;; Code: +(require 'ffap) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Customization Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -287,30 +289,15 @@ This variable is only used if the variable ;; Utility functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Simplified versions of some at-point functions from ffap.el. -;; It's not worth loading all of ffap just for these. (defun net-utils-machine-at-point () - (let ((pt (point))) - (buffer-substring-no-properties - (save-excursion - (skip-chars-backward "-a-zA-Z0-9.") - (point)) - (save-excursion - (skip-chars-forward "-a-zA-Z0-9.") - (skip-chars-backward "." pt) - (point))))) + "Return a string of characters from around point. +Same as `ffap-string-at-point' called with 'machine as arg." + (ffap-string-at-point 'machine)) (defun net-utils-url-at-point () - (let ((pt (point))) - (buffer-substring-no-properties - (save-excursion - (skip-chars-backward "--:=&?$+@-Z_a-z~#,%") - (skip-chars-forward "^A-Za-z0-9" pt) - (point)) - (save-excursion - (skip-chars-forward "--:=&?$+@-Z_a-z~#,%") - (skip-chars-backward ":;.,!?" pt) - (point))))) + "Return a string of characters from around point. +Same as `ffap-string-at-point' called with 'url as arg." + (ffap-string-at-point 'url)) (defun net-utils-remove-ctrl-m-filter (process output-string) "Remove trailing control Ms." @@ -445,14 +432,14 @@ This variable is only used if the variable If your system's ping continues until interrupted, you can try setting `ping-program-options'." (interactive - (list (read-from-minibuffer "Ping host: " (net-utils-machine-at-point)))) + (list (read-from-minibuffer "Ping host: " (or (net-utils-machine-at-point) + "localhost")))) (let ((options - (if ping-program-options - (append ping-program-options (list host)) - (list host)))) - (net-utils-run-program + (if ping-program-options + (append ping-program-options (list host)) + (list host)))) + (net-utils-run-simple (concat "Ping" " " host) - (concat "** Ping ** " ping-program " ** " host) ping-program options))) @@ -535,13 +522,12 @@ If your system's ping continues until interrupted, you can try setting (interactive (list (read-from-minibuffer "Lookup host: " - (or (ffap-string-at-point 'machine) "")))) - (net-utils-run-program - "Dig" + (net-utils-machine-at-point)))) + (net-utils-run-simple (concat "** " - (mapconcat 'identity - (list "Dig" host dig-program) - " ** ")) + (mapconcat 'identity + (list "Dig" host dig-program) + " ** ")) dig-program (list host))) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997