emacs-devel
[Top][All Lists]
Advanced

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

Re: PROPOSAL: New function ffap-ip-at-point


From: Eli Zaretskii
Subject: Re: PROPOSAL: New function ffap-ip-at-point
Date: Fri, 22 Jul 2022 14:20:15 +0300

> 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.



reply via email to

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