sshirokov / ZNC.el

Make ERC and ZNC get along more goodest.
MIT License
56 stars 20 forks source link

Byte compilation warning: value from (get-buffer wants-name) is unused #34

Closed quanticle closed 3 years ago

quanticle commented 5 years ago

I've installed znc into my emacs 26.1 on Fedora Linux, and I'm getting the following warning:

Warning (bytecomp): value returned from (get-buffer wants-name) is unused

It appears that this warning is coming from line 119 of znc.el, in the following function:

(defadvice erc-server-reconnect (after znc-erc-rename last nil activate)
  "Maybe rename the buffer we create"
  (let* ((wants-name (and (local-variable-p 'znc-buffer-name (erc-server-buffer))
                          (buffer-local-value 'znc-buffer-name (erc-server-buffer))))
         (current (erc-server-buffer))
         (returning ad-return-value))
    (if wants-name
        (progn
          (ignore-errors (znc-kill-buffer-always wants-name))
          (with-current-buffer returning
            (znc-set-name wants-name)
            (rename-buffer wants-name))
          (get-buffer wants-name))
      returning)))

Does there need to be a (get-buffer wants-name) there? Is there a side-effect that znc.el is relying on?

vincent-hobeika-sonarsource commented 5 years ago

I have the same issue here with emacs 26.1 on Debian Buster. The issue wasn't here with prior versions of emacs.

alexmurray commented 5 years ago

I think the byte-compiler is wrong... the (get-buffer wants-name) occurs as the last element in the affirmative branch of the (if wants-name (progn so will be the return value from erc-server-reconnect in the case that wants-name is t - so it is not unused in that case as far as I can tell.

rpav commented 4 years ago

This is, nevertheless, an annoying issue. Regardless of fault, znc.el is the only package that causes warnings at startup, and it's due to this. Changing it to something like the following solves the issue:

(when-let ((buffer (get-buffer wants-name)))
   buffer)
titanofold commented 3 years ago

Looks like Pull Request #27 should address this.

ghost commented 3 years ago

fixed, please test again