summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el5
-rw-r--r--lisp/+finger.el46
2 files changed, 51 insertions, 0 deletions
diff --git a/init.el b/init.el index 2a6dab5..88102be 100644 --- a/init.el +++ b/init.el
@@ -431,6 +431,11 @@
431 (global-set-key (vector 'right-margin click) 'mwheel-scroll) 431 (global-set-key (vector 'right-margin click) 'mwheel-scroll)
432 (global-set-key (vector 'left-margin click) 'mwheel-scroll))) 432 (global-set-key (vector 'left-margin click) 'mwheel-scroll)))
433 433
434(setup net-utils
435 (:require +finger) ; fixes `finger' to use var below
436 (:option finger-X.500-host-regexps '(".") ; only send username
437 ))
438
434(setup org 439(setup org
435 ;; Plain org with the `setup' form for sorting, but I install with straight. 440 ;; Plain org with the `setup' form for sorting, but I install with straight.
436 (:straight (org 441 (:straight (org
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