I'm trying to achieve the automatic authentication of my registered nickname on Freenode, so that I can join the #emacs IRC channel.

Since I upload my Emacs config to a public repository, I've opted to grab the personal data of my nickname and password from a file on my local machine.

Below is the code I've come up with trying to achieve this. And I don't know why it's not working.

It seems like a trivial task to accomplish, but I'm at a loss; not knowing if it's a problem with the syntax, semantics, and/or the way the package handles my nickname/password.

(defun jd:get-string-from-file (filePath beg end)
    (insert-file-contents filePath nil beg end)

(defvar jd:irc-nickname (jd:get-string-from-file "~/.authinfo" 0 15))
(defvar jd:irc-password (jd:get-string-from-file "~/.authinfo" 16 26))

;;; `rcirc.el'
(setq rcirc-default-nick jd:irc-nickname)
(setq rcirc-authinfo '(("freenode" nickserv jd:irc-nickname jd:irc-password)))
(setq rcirc-server-alist '(("irc.freenode.net" :port 6667 :channels ("#emacs"))))

The problem (that I see) is this line:

(setq rcirc-authinfo '(("freenode" nickserv jd:irc-nickname jd:irc-password)))

If you C-h v rcirc-authinfo, the value will be ("freenode" nickserv jd:irc-nickname jd:irc-password). I'm not sure if rcirc accepts symbols for nickname and password, but I bet not.

The problem is, the quote ' quotes everything, including jd:irc-nickname and jd:irc-password, so they are left unevaluated.

What you want to do is use backquote `, which enables you to evaluate seleced elements:

(setq rcirc-authinfo `(("freenode" nickserv ,jd:irc-nickname ,jd:irc-password)))


(setq mynick "pony")

(setq mypass "password")

'(mynick mypass)
(mynick mypass)

`(,mynick ,mypass)
("pony" "password")

Relevant manual node: (elisp) Backquote.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.