bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5950: defvaralias after defvar should be warned in runtime


From: Noam Postavsky
Subject: bug#5950: defvaralias after defvar should be warned in runtime
Date: Wed, 01 Aug 2018 22:14:05 -0400

[forwarding to list, original didn't make it because bug was archived]

--- Begin Message --- Subject: Re: bug#5950: defvaralias after defvar should be warned in runtime Date: Wed, 1 Aug 2018 14:55:56 -0400
Hi Noam,

I just updated my Emacs and ran into this warning, but I have no idea
what's wrong with the following code :)

  (defvaralias 'flycheck-python-pylint-executable 'python-shell-interpreter)
  (defvaralias 'flycheck-python-flake8-executable 'python-shell-interpreter)

These two variables `flycheck-&-executable' are configuration knobs
created by Flycheck, and I never want to set them individually; instead,
I want them to have the same value as `python-shell-interpreter'.  While
the code above works, it also pops a "warning" buffer now:

Warning (defvaralias): Overwriting value of ‘flycheck-python-pylint-executable’ 
by aliasing to ‘python-shell-interpreter’
Warning (defvaralias): Overwriting value of ‘flycheck-python-flake8-executable’ 
by aliasing to ‘python-shell-interpreter’

I've set warning-suppress-log-types to '(defvaralias losing-value) to
work around this, but was the warning actually intended in this case?

Clément.

--- End Message ---

It's warning because you overwrite the original value of
flycheck-python-pylint-executable when you call defvaralias.  In this
case you intended that, but usually it's a mistake.

You could make the warning suppression more selective by adding
(defvaralias losing-value flycheck-python-pylint-executable) and
(defvaralias losing-value flycheck-python-flake8-executable) to
warning-suppress-log-types.

Alternatively, you could do

  (setq flycheck-python-pylint-executable python-shell-interpreter)
  (defvaralias 'flycheck-python-pylint-executable 'python-shell-interpreter)
  (setq flycheck-python-flake8-executable python-shell-interpreter)
  (defvaralias 'flycheck-python-flake8-executable 'python-shell-interpreter)

(the warning doesn't trigger if the value being overwritten is `eq' to
the new one).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]