emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112013: * lisp/net/net-utils.el (net


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112013: * lisp/net/net-utils.el (net-utils-remove-ctrl-m-filter):
Date: Mon, 11 Mar 2013 14:30:49 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112013
author: Thierry Volpiatto <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-03-11 14:30:49 -0400
message:
  * lisp/net/net-utils.el (net-utils-remove-ctrl-m-filter):
  Use with-current-buffer and don't move point.
  (net-utils-run-simple): Remove useless code.
  (net-utils-remove-ctl-m): Remove unused custom.
modified:
  lisp/ChangeLog
  lisp/net/net-utils.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-11 17:45:23 +0000
+++ b/lisp/ChangeLog    2013-03-11 18:30:49 +0000
@@ -1,3 +1,10 @@
+2013-03-11  Thierry Volpiatto  <address@hidden>
+
+       * net/net-utils.el (net-utils-remove-ctrl-m-filter):
+       Use with-current-buffer and don't move point.
+       (net-utils-run-simple): Remove useless code.
+       (net-utils-remove-ctl-m): Remove unused custom.
+
 2013-03-11  Per Starbäck  <address@hidden>
 
        * international/characters.el (glyphless-set-char-table-range): New fun.

=== modified file 'lisp/net/net-utils.el'
--- a/lisp/net/net-utils.el     2013-03-01 17:27:57 +0000
+++ b/lisp/net/net-utils.el     2013-03-11 18:30:49 +0000
@@ -54,11 +54,6 @@
   :group 'comm
   :version "20.3")
 
-(defcustom net-utils-remove-ctl-m (memq system-type '(windows-nt msdos))
-  "If non-nil, remove control-Ms from output."
-  :group 'net-utils
-  :type  'boolean)
-
 (defcustom traceroute-program
   (if (eq system-type 'windows-nt)
       "tracert"
@@ -319,25 +314,17 @@
 
 (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 +362,6 @@
          (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]