summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-01-25 16:57:30 -0600
committerCase Duckworth2022-01-25 16:57:30 -0600
commit995f9988729e50958eb13d2ac9cba3cb092f37fd (patch)
treecaf4fe126a7e2b7716a522aec395c692a49dff1f /lisp
parentAllow saving ispell-local-words in .dir-locals.el (diff)
downloademacs-995f9988729e50958eb13d2ac9cba3cb092f37fd.tar.gz
emacs-995f9988729e50958eb13d2ac9cba3cb092f37fd.zip
Fix finger
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+finger.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/lisp/+finger.el b/lisp/+finger.el new file mode 100644 index 0000000..1a878bc --- /dev/null +++ b/lisp/+finger.el
@@ -0,0 +1,46 @@
1;;; +finger.el --- Finger bugfix -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; `net-utils' defines `finger', which purportedly consults
6;; `finger-X.500-host-regexps' to determine what hosts to only send a username
7;; to. I've found that that is not the case, and so I've patched it. At some
8;; point I'll submit this to Emacs itself.
9
10;;; Code:
11
12(require 'net-utils) ; this requires everything else I'll need.
13(require 'seq)
14
15(defun finger (user host)
16 "Finger USER on HOST.
17This command uses `finger-X.500-host-regexps'
18and `network-connection-service-alist', which see."
19 ;; One of those great interactive statements that's actually
20 ;; longer than the function call! The idea is that if the user
21 ;; uses a string like "pbreton@cs.umb.edu", we won't ask for the
22 ;; host name. If we don't see an "@", we'll prompt for the host.
23 (interactive
24 (let* ((answer (read-from-minibuffer "Finger User: "
25 (net-utils-url-at-point)))
26 (index (string-match (regexp-quote "@") answer)))
27 (if index
28 (list (substring answer 0 index)
29 (substring answer (1+ index)))
30 (list answer
31 (read-from-minibuffer "At Host: "
32 (net-utils-machine-at-point))))))
33 (let* ((user-and-host (concat user "@" host))
34 (process-name (concat "Finger [" user-and-host "]"))
35 (regexps finger-X.500-host-regexps)
36 ) ;; found
37 (when (seq-some (lambda (r) (string-match-p r host)) regexps)
38 (setq user-and-host user))
39 (run-network-program
40 process-name
41 host
42 (cdr (assoc 'finger network-connection-service-alist))
43 user-and-host)))
44
45(provide '+finger)
46;;; +finger.el ends here