summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/basic.el b/basic.el
index 03a075e..6e1d7fd 100644
--- a/basic.el
+++ b/basic.el
@@ -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)