Subject: Re: bug#13831: 24.3.50; [PATCH] net-utils-mode have no revert-buffer function

From: Thierry Volpiatto <[email-masked]>
Date: Thu, 28 Feb 2013 07:18:17 +0100

Hi Stefan,

Stefan Monnier <[email-masked]> 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