diff options
author | JSDurand <mmemmew@gmail.com> | 2024-05-21 21:37:30 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2024-05-21 21:37:30 +0800 |
commit | def754ac4c1bb310925f1b419376c718c2cb13fa (patch) | |
tree | a57096f6b1661e62cb63d5141288e2ee7891a6b3 /basic.el | |
parent | c409b9089945737c27a28ca6719dbd45e8a4ac16 (diff) |
basic: Add a function to test internet connection.
Diffstat (limited to 'basic.el')
-rw-r--r-- | basic.el | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -657,6 +657,15 @@ The remaining CONFIGS are evaluated after the package is loaded." (require ,package-name) ,@configs)) +;;; Test internet connection + +(defun durand-internet-on (&optional host) + "Test if the internet connection is working. +If HOST is non-nil, ping HOST, otherwise ping Google." + (interactive nil) + (setq host (cond (host) ("www.google.com"))) + (= 0 (call-process "ping" nil nil nil "-c" "1" "-W" "1" host))) + ;;; Go to parent in the file name completion map (defun durand-delete-goto-parent-dir (n &optional kill-flag) |