Created
March 9, 2016 02:47
-
-
Save tkhoa2711/ef99938c8752ca3e52c2 to your computer and use it in GitHub Desktop.
Retrieve IP address using Emacs Lisp (on Windows and UNIX)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-ip-address (&optional dev) | |
"Get the IP-address for device DEV (default: eth0) of the current machine." | |
(let ((dev (if dev dev "eth0"))) | |
(format-network-address (car (network-interface-info dev)) t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment