Function: ghostel--local-host-p
ghostel--local-host-p is a natively compiled function defined in
ghostel.el.
Signature
(ghostel--local-host-p HOST)
Documentation
Return non-nil if HOST refers to the local machine.
A trailing ".local" (mDNS) suffix on HOST is ignored: the macOS
kernel hostname drifts between NAME and NAME.local with network state,
while the function system-name(var)/system-name(fun) keeps the value from Emacs startup.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--local-host-p (host)
"Return non-nil if HOST refers to the local machine.
A trailing \".local\" (mDNS) suffix on HOST is ignored: the macOS
kernel hostname drifts between NAME and NAME.local with network state,
while the function `system-name' keeps the value from Emacs startup."
(or (null host)
(string= host "")
(save-match-data
(let ((host (if (string-suffix-p ".local" host t)
(substring host 0 (- (length host) (length ".local")))
host)))
(or (eq t (compare-strings host nil nil "localhost" nil nil t))
(eq t (compare-strings host nil nil (system-name) nil nil t))
(eq t (compare-strings
host nil nil
(car (split-string (system-name) "\\.")) nil nil t)))))))