el/dot-emacs.el: Add a (lightly modified) `nntp-open-authinfo-kludge'.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 21 Mar 2016 02:18:24 +0000 (02:18 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 21 Mar 2016 02:18:24 +0000 (02:18 +0000)
The original is by Richard Kettlewell,

http://www.greenend.org.uk/rjk/tech/authinfo.html

I've changed it a bit, to be able to set the magic `NNTPAUTH' variable
differently for different Gnus select methods.

el/dot-emacs.el

index e50d773..b307dc2 100644 (file)
@@ -508,6 +508,27 @@ so that it can be used for convenient filtering."
          (setenv "REAL_MOVEMAIL" try))
       (setq path (cdr path)))))
 
+;; AUTHINFO GENERIC kludge.
+
+(defvar nntp-authinfo-generic nil
+  "Set to the `NNTPAUTH' string to pass on to `authinfo-kludge'.
+
+Use this to arrange for per-server settings.")
+
+(defun nntp-open-authinfo-kludge (buffer)
+  "Open a connection to SERVER using `authinfo-kludge'."
+  (let ((proc (start-process "nntpd" buffer
+                            "env" (concat "NNTPAUTH="
+                                          (or nntp-authinfo-generic
+                                              (getenv "NNTPAUTH")
+                                              (error "NNTPAUTH unset")))
+                            "authinfo-kludge" nntp-address)))
+    (set-buffer buffer)
+    (nntp-wait-for-string "^\r*200")
+    (beginning-of-line)
+    (delete-region (point-min) (point))
+    proc))
+
 (eval-after-load "erc"
     '(load "~/.ercrc.el"))