From: TOMAS FABRIZIO ORSI <torsi@fi.uba.ar>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: pbreton@cs.umb.edu, Eli Zaretskii <eliz@gnu.org>, 71438@debbugs.gnu.org
Subject: bug#71438: [PATCH] Allow ping to receive optional arguments
Date: Tue, 18 Jun 2024 23:17:14 -0300 [thread overview]
Message-ID: <CAHTSwYii3mxNdBdhhwNUDKOBW6Hy5am=1+c5RRyDAh=GyprO0w@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmmMwy8x+pVdsRUfcnoM52YJ4GmCi3EGJgk5P1=k1c22Kw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
Hello Stefan and Eli,
I apologize for my late reply. I wanted to thank you both for
your work and patience.
And Stefan for teaching me the committing etiquette.
I added a "NetUtils" heading in etc/NEWS, which
I am a little hesitant about. I was torn between
creating a new Heading and using "Miscellaneous".
I am looking forward to your feedback.
Have a good week,
- Fabrizio
[-- Attachment #2: 0003-ping-can-now-receive-a-prefix-argument.patch --]
[-- Type: text/x-patch, Size: 2827 bytes --]
From 3da7ba70ea2c6f2d9c25acd4a770a3e31b9dea3a Mon Sep 17 00:00:00 2001
From: Tomas Fabrizio Orsi <torsi@fi.uba.ar>
Date: Sat, 8 Jun 2024 12:11:18 -0300
Subject: [PATCH] ping can now receive a prefix argument
ping will check for a prefix argument. If given,
the user will be prompted for flags to pass to ping.
* etc/NEWS: Document the change
* lisp/net/net-utils.el (ping):
Copyright-paperwork-exempt: yes
Signed-off-by: Tomas Fabrizio Orsi <torsi@fi.uba.ar>
---
etc/NEWS | 2 ++
lisp/net/net-utils.el | 31 ++++++++++++++++++++++---------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index d6a8fa7..74f7ed4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1907,6 +1907,8 @@ The following new XML schemas are now supported:
- Nuget packages config file
** color.el now supports the Oklab color representation.
+** Netutils
+*** 'ping' can now receive a prefix argument for additional options
\f
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 83842cd..fe68054 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -425,22 +425,35 @@ This variable is only used if the variable
options)))
;;;###autoload
-(defun ping (host)
- "Ping HOST.
-If your system's ping continues until interrupted, you can try setting
-`ping-program-options'."
+(defun ping (host &optional flags)
+ "Ping HOST using `ping-program'.
+
+The user option `ping-program-options' is passed as flags to
+`ping-program'. With a \\[universal-argument] prefix arg, prompt the
+user for the flags to pass.
+
+When called from Lisp, the optional argument FLAGS, if non-nil, is a
+list of strings that will be passed as flags for the `ping-program'. If
+FLAGS is nil, `ping-program-options' will be used.
+
+If your system's ping continues until interrupted, you can try using a
+prefix argument or setting `ping-program-options'."
(interactive
(list (let ((default (ffap-machine-at-point)))
- (read-string (format-prompt "Ping host" default) nil nil default))))
- (let ((options
- (if ping-program-options
+ (read-string (format-prompt "Ping host" default) nil nil default))
+ (when current-prefix-arg
+ (split-string
+ (read-string (format-prompt "Ping options" ping-program-options)
+ nil nil ping-program-options)))))
+ (let ((full-command
+ (if (or (equal flags (list "")) (not flags))
(append ping-program-options (list host))
- (list host))))
+ (append flags (list host)))))
(net-utils-run-program
(concat "Ping" " " host)
(concat "** Ping ** " ping-program " ** " host)
ping-program
- options)))
+ full-command)))
;;;###autoload
(defun nslookup-host (host &optional name-server)
--
2.44.2
next prev parent reply other threads:[~2024-06-19 2:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 15:28 bug#71438: [PATCH] Allow ping to receive optional arguments TOMAS FABRIZIO ORSI
2024-06-08 18:48 ` Peter Breton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 18:57 ` TOMAS FABRIZIO ORSI
2024-06-09 12:02 ` Stefan Kangas
2024-06-09 13:47 ` Eli Zaretskii
2024-06-09 15:03 ` TOMAS FABRIZIO ORSI
2024-06-09 15:21 ` Eli Zaretskii
2024-06-09 15:38 ` Stefan Kangas
2024-06-09 15:48 ` TOMAS FABRIZIO ORSI
2024-06-16 21:46 ` TOMAS FABRIZIO ORSI
2024-06-17 1:14 ` Stefan Kangas
2024-06-17 2:03 ` TOMAS FABRIZIO ORSI
2024-06-17 6:19 ` Stefan Kangas
2024-06-19 2:17 ` TOMAS FABRIZIO ORSI [this message]
2024-06-20 18:45 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHTSwYii3mxNdBdhhwNUDKOBW6Hy5am=1+c5RRyDAh=GyprO0w@mail.gmail.com' \
--to=torsi@fi.uba.ar \
--cc=71438@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=pbreton@cs.umb.edu \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.