From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: nnimap-authinfo-file customization proposes "inline" format
Date: Mon, 03 Nov 2008 15:02:52 -0600 [thread overview]
Message-ID: <86zlkg1q0z.fsf@lifelogs.com> (raw)
In-Reply-To: <87mygk4ndz.fsf@gmail.com>
On Fri, 31 Oct 2008 19:42:32 +0100 Paul R <paul.r.ml@gmail.com> wrote:
PR> M-x customize-variable RET nnimap-authinfo-file RET
PR> From 'Value menu' choose "inline", then INS a new entry.
PR> Save it, try to use it : That won't work, because netrc-parse expects
PR> a file name and nothing else.
Can you try the following patch?
Thanks
Ted
Index: netrc.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/netrc.el,v
retrieving revision 7.25
diff -c -r7.25 netrc.el
*** netrc.el 11 Jun 2008 14:19:44 -0000 7.25
--- netrc.el 3 Nov 2008 21:01:40 -0000
***************
*** 59,119 ****
(defun netrc-parse (file)
(interactive "fFile to Parse: ")
"Parse FILE and return a list of all entries in the file."
! (when (file-exists-p file)
! (with-temp-buffer
! (let ((tokens '("machine" "default" "login"
! "password" "account" "macdef" "force"
! "port"))
! (encryption-model (when (netrc-bound-and-true-p encrypt-file-alist)
! (encrypt-find-model file)))
! alist elem result pair)
! (if encryption-model
! (encrypt-insert-file-contents file encryption-model)
! (insert-file-contents file))
! (goto-char (point-min))
! ;; Go through the file, line by line.
! (while (not (eobp))
! (narrow-to-region (point) (point-at-eol))
! ;; For each line, get the tokens and values.
(while (not (eobp))
! (skip-chars-forward "\t ")
! ;; Skip lines that begin with a "#".
! (if (eq (char-after) ?#)
! (goto-char (point-max))
! (unless (eobp)
! (setq elem
! (if (= (following-char) ?\")
! (read (current-buffer))
! (buffer-substring
! (point) (progn (skip-chars-forward "^\t ")
! (point)))))
! (cond
! ((equal elem "macdef")
! ;; We skip past the macro definition.
! (widen)
! (while (and (zerop (forward-line 1))
! (looking-at "$")))
! (narrow-to-region (point) (point)))
! ((member elem tokens)
! ;; Tokens that don't have a following value are ignored,
! ;; except "default".
! (when (and pair (or (cdr pair)
! (equal (car pair) "default")))
! (push pair alist))
! (setq pair (list elem)))
! (t
! ;; Values that haven't got a preceding token are ignored.
! (when pair
! (setcdr pair elem)
! (push pair alist)
! (setq pair nil)))))))
! (when alist
! (push (nreverse alist) result))
! (setq alist nil
! pair nil)
! (widen)
! (forward-line 1))
! (nreverse result)))))
(defun netrc-machine (list machine &optional port defaultport)
"Return the netrc values from LIST for MACHINE or for the default entry.
--- 59,121 ----
(defun netrc-parse (file)
(interactive "fFile to Parse: ")
"Parse FILE and return a list of all entries in the file."
! (if (listp file)
! file
! (when (file-exists-p file)
! (with-temp-buffer
! (let ((tokens '("machine" "default" "login"
! "password" "account" "macdef" "force"
! "port"))
! (encryption-model (when (netrc-bound-and-true-p encrypt-file-alist)
! (encrypt-find-model file)))
! alist elem result pair)
! (if encryption-model
! (encrypt-insert-file-contents file encryption-model)
! (insert-file-contents file))
! (goto-char (point-min))
! ;; Go through the file, line by line.
(while (not (eobp))
! (narrow-to-region (point) (point-at-eol))
! ;; For each line, get the tokens and values.
! (while (not (eobp))
! (skip-chars-forward "\t ")
! ;; Skip lines that begin with a "#".
! (if (eq (char-after) ?#)
! (goto-char (point-max))
! (unless (eobp)
! (setq elem
! (if (= (following-char) ?\")
! (read (current-buffer))
! (buffer-substring
! (point) (progn (skip-chars-forward "^\t ")
! (point)))))
! (cond
! ((equal elem "macdef")
! ;; We skip past the macro definition.
! (widen)
! (while (and (zerop (forward-line 1))
! (looking-at "$")))
! (narrow-to-region (point) (point)))
! ((member elem tokens)
! ;; Tokens that don't have a following value are ignored,
! ;; except "default".
! (when (and pair (or (cdr pair)
! (equal (car pair) "default")))
! (push pair alist))
! (setq pair (list elem)))
! (t
! ;; Values that haven't got a preceding token are ignored.
! (when pair
! (setcdr pair elem)
! (push pair alist)
! (setq pair nil)))))))
! (when alist
! (push (nreverse alist) result))
! (setq alist nil
! pair nil)
! (widen)
! (forward-line 1))
! (nreverse result))))))
(defun netrc-machine (list machine &optional port defaultport)
"Return the netrc values from LIST for MACHINE or for the default entry.
next prev parent reply other threads:[~2008-11-03 21:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 21:00 Paul R
2008-10-31 17:36 ` Ted Zlatanov
2008-10-31 18:42 ` Paul R
2008-11-03 21:02 ` Ted Zlatanov [this message]
2008-11-03 23:31 ` Paul R
2008-11-04 16:51 ` Ted Zlatanov
2008-11-04 18:43 ` Paul R
2008-11-10 22:00 ` Ted Zlatanov
2009-02-13 22:38 ` auth-source documentation (was: nnimap-authinfo-file customization proposes "inline" format) Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zlkg1q0z.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).