restclient.el icon indicating copy to clipboard operation
restclient.el copied to clipboard

Warning (bytecomp): assignment to free variable ‘success'

Open blaenk opened this issue 9 years ago • 9 comments

This causes the Compile-Log to pop up whenever I start emacs. I'm actually not sure why that's happening, it seems to imply that it's re-compiling the file each time emacs starts up? I'm not sure what may be causing that. I'm on Emacs 25.

blaenk avatar Jun 11 '16 23:06 blaenk

I just made the Compile-Log not show up each time.

blaenk avatar Jun 16 '16 20:06 blaenk

have you resolved the issue? I just reinstalled all packages and it started to show up, I'm also on Emacs 25, installed via use-package from melpa.

sandric avatar Jun 27 '16 15:06 sandric

Could you try putting

(require 'url-http)
(require 'url-cache)

after (require 'url)? I can't reproduce this warning, but it seems like loading order may be the cause.

pashky avatar Jun 27 '16 15:06 pashky

Nope, just tried, the same error(

sandric avatar Jun 27 '16 15:06 sandric

Okay... the documented way to shut this warning up is to put (defvar success) but funnily enough then I start getting another warning that variable is not properly prefixed. So I don't know really.

What line does it point to, btw? There're two different success assignments there. And what's your emacs version?

pashky avatar Jun 27 '16 15:06 pashky

Sorry, I have no idea - I'm a newcomer to emacs(. I googled how to enable line numbers in Compile-Log but it looks like from GNU's man page it should be there as defaults. Nevertheless, all I get is that:

.emacs.d/elpa/restclient-20160608.156/restclient.elc:Warning: assignment to
    free variable ‘success’
.emacs.d/elpa/restclient-20160608.156/restclient.elc:Warning: assignment to
    free variable ‘success’

As for my emacs - its 25.1.50

sandric avatar Jun 27 '16 21:06 sandric

Ok, I just recompiled newer source and now the warning is looks like this (just in case it might be helpful):

/usr/local/Cellar/emacs/HEAD/share/emacs/25.1.50/lisp/url/url-http.elc:Warning:
    assignment to free variable ‘success’

sandric avatar Jun 27 '16 21:06 sandric

Ok, so I upgraded to later 25 pretest and started to get those warnings.

Upon studying the code I can see that those advice assignments are no longer needed, so you can replace advice blocks with this:

(defadvice url-http-handle-authentication (around restclient-fix)
  (if restclient-within-call
      (setq ad-return-value t)
    ad-do-it))
(ad-activate 'url-http-handle-authentication)

(defadvice url-cache-extract (around restclient-fix-2)
  (unless restclient-within-call
    ad-do-it))
(ad-activate 'url-cache-extract)

But I'm a bit afraid to publish this change now, as it was there for reason and it means that it will break things for people on older emacses with older url.el. I need to find a way to keep it but omit the warning.

pashky avatar Jun 28 '16 09:06 pashky

It's not possible to just use the newer one if the emacs version is >=25 and the older one otherwise?

On Tuesday, June 28, 2016, pashky [email protected] wrote:

Ok, so I upgraded to later 25 pretest and started to get those warnings.

Upon studying the code I can see that those advice assignments are no longer needed, so you can replace advice blocks with this:

(defadvice url-http-handle-authentication (around restclient-fix) (if restclient-within-call (setq ad-return-value t) ad-do-it)) (ad-activate 'url-http-handle-authentication)

(defadvice url-cache-extract (around restclient-fix-2) (unless restclient-within-call ad-do-it)) (ad-activate 'url-cache-extract)

But I'm a bit afraid to publish this change now, as it was there for reason and it means that it will break things for people on older emacses with older url.el. I need to find a way to keep it but omit the warning.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pashky/restclient.el/issues/129#issuecomment-228995822, or mute the thread https://github.com/notifications/unsubscribe/AAFKyALsNtJCnz23pKl9HiFFru4S1PaQks5qQOZBgaJpZM4IzqpA .

blaenk avatar Jun 28 '16 09:06 blaenk