I am attempting to secure my emacs 28.1 following the well-known guide here. After running into a (seemingly common) error with the bad certificate check I was lead to this emacs stackexchange post. The solution, allegedly, was to add the following lines to the intialization ~/.emacs.d/init.el:

(if (fboundp 'gnutls-available-p)
    (fmakunbound 'gnutls-available-p))

However, I am unable to get this to work. I ran M-x eval-expression and did (message system-configuration-options) which gave me --with-gnutls=yes.

But when I do M-x eval-expression and do (gnutls-available-p) I get an error:

Debugger entered--Lisp error: (void-function gnutls-available-p)
  eval((gnutls-available-p) t)
  eval-expression((gnutls-available-p) nil nil 127)
  funcall-interactively(eval-expression (gnutls-available-p) nil nil 127)
  call-interactively(eval-expression record nil)
  command-execute(eval-expression record)
  execute-extended-command(nil "eval-expression" "eval-expression")
  funcall-interactively(execute-extended-command nil "eval-expression" "eval-expression")
  call-interactively(execute-extended-command nil nil)

I cannot for the life of me figure out how this function is void as it should be defined in my case. Confirming this I see M-x eval-expression with (fboundp 'gnutls-available-p) is nil. I also attempted to evaluate the conditional and got nil as a response.

So it seems that a function I expect is unbound. But, when evaluated with fboundp I at least don't get an error. Further, it seems that the condition only fails to work in the init.el. Is there a require I am missing that may help me here? I've been at this an hour and cannot work around it.

  • Does the configure output (before running make) when building Emacs from source indicate that gnutls is present/detected?
    – lawlist
    Feb 23, 2023 at 17:48
  • Well, you yourself undefined it with that (fmakunbound 'gnutls-available-p), so of course Emacs is going to complain about a void-function when you try to call it. It seems to me that the advice in the second link is more than a little bogus.
    – NickD
    Feb 24, 2023 at 3:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.