From: Eli Zaretskii <eliz@gnu.org>
To: "Iñigo Serna" <inigoserna@gmx.com>
Cc: emacs-devel@gnu.org
Subject: Re: PROPOSAL: New function ffap-ip-at-point
Date: Fri, 22 Jul 2022 14:20:15 +0300 [thread overview]
Message-ID: <83czdxl7gw.fsf@gnu.org> (raw)
In-Reply-To: <87r12d5xhv.fsf@gmx.com> (message from Iñigo Serna on Fri, 22 Jul 2022 10:49:30 +0200)
> From: Iñigo Serna <inigoserna@gmx.com>
> Date: Fri, 22 Jul 2022 10:49:30 +0200
>
> I propose the addition of this `ffap-ip-at-point' function.
> Equivalent to (and based on) `ffap-machine-at-point', it will
> return
> the IP address at point if it exists, or nil.
IPv4 or IPv6 addresses? or both? This should be stated in the doc
string.
This also needs a NEWS entry.
> +(defun ffap-ip-at-point ()
> + "Return IP address at point if it exists, or nil."
"If it exists" is ambiguous for an IP address, so please try coming up
with a better wording.
> +(defun ffap-ip-p (ip)
> + "Decide whether IP is a valid IP address."
> + (when-let* ((start (string-match "\\([0-9]\\{1,3\\}\\.\\)\\{3\\}[0-9]\\{1,3\\}" ip))
> + (end (match-end 0))
> + (nums (mapcar #'string-to-number (split-string (substring ip start end) "\\."))))
> + (message "|%S|%S|%S|" start end (length ip))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Leftover from debugging?
Finally, can you add a couple of tests for this facility?
Thanks.
next prev parent reply other threads:[~2022-07-22 11:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 8:49 PROPOSAL: New function ffap-ip-at-point Iñigo Serna
2022-07-22 9:36 ` Robert Pluim
2022-07-22 11:20 ` Eli Zaretskii [this message]
2022-07-22 14:46 ` Iñigo Serna
2022-07-22 15:01 ` Eli Zaretskii
2022-07-22 15:04 ` Brian Cully via Emacs development discussions.
2022-07-22 15:28 ` Iñigo Serna
2022-07-22 15:09 ` Lars Ingebrigtsen
2022-07-22 15:34 ` Iñigo Serna
2022-07-22 15:55 ` Robert Pluim
2022-07-22 20:10 ` Lars Ingebrigtsen
2022-07-23 7:31 ` Robert Pluim
2022-07-23 7:37 ` Lars Ingebrigtsen
2022-07-23 7:46 ` Robert Pluim
2022-07-23 7:47 ` Lars Ingebrigtsen
2022-07-26 12:21 ` Robert Pluim
2022-07-26 12:48 ` Eli Zaretskii
2022-07-26 12:54 ` Robert Pluim
2022-07-23 7:39 ` Andreas Schwab
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83czdxl7gw.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=inigoserna@gmx.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).