I am using SLIME (which includes hyperspec.el). I wanted to view the HyperSpec using Emacs' EWW instead of the desktop web browser (e.g. Firefox, Chromium, etc.). To do this, I added an advice to set the web browser to EWW for looking at the HyperSpec:

(advice-add 'hyperspec-lookup
            (lambda (orig-fun &rest args)
              (let ((browse-url-browser-function 'eww-browse-url))
                (apply orig-fun args))))

However, I always get the following message in the *Messages* buffer the first time I use hyperspec-lookup after starting Emacs.

Making browse-url-browser-function local to *eww* while let-bound!

Is this an error message? What does it mean? How do I fix it?

  • I don't know what hyperspec-lookup is or does. But the message means that you've made variable browse-url-browser-function a buffer-local variable, but it is a local variable bound by let. Your code (above) let-binds that variable, and within the let some code makes it a buffer-local variable. You can use debug-on-entry for hyperspec-lookup to walk through the debugger and see what code makes it a buffer-local variable. – Drew Dec 31 '20 at 5:56
  • A guess is that you want to use setq-local there, to set the value of browse-url-browser-function, instead of let-binding it. – Drew Dec 31 '20 at 6:01
  • 1
    However, see this `emacs-devel@gnu.org message from @stefan in 2013. He seems to suggest ignoring that message and that he maybe shouldn't have added it. Dunno whether his comment in that message applies generally or just to that case. On the other hand, this 2010 message from him suggests that the message usually indicates a problem. Maybe he will chime in here, to clarify things. – Drew Dec 31 '20 at 6:05
  • Here's another question on emacs.SE that's about the same error message. – Drew Dec 31 '20 at 6:11
  • @Drew Replacing the let-binding with setq-local solves the problem. Thank you. – Flux Dec 31 '20 at 21:01

The problem can be solved by replacing the let-binding with setq-local:

(advice-add 'hyperspec-lookup
            (lambda (orig-fun &rest args)
              (setq-local browse-url-browser-function 'eww-browse-url)
              (apply orig-fun args)))

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.