unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: 5950@debbugs.gnu.org
Cc: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Subject: bug#5950: defvaralias after defvar should be warned in runtime
Date: Wed, 01 Aug 2018 22:14:05 -0400	[thread overview]
Message-ID: <87sh3xzf9u.fsf@gmail.com> (raw)
In-Reply-To: <4BC6A096.8030801@yahoo.co.jp>

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

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


[-- Attachment #2: Type: message/rfc822, Size: 1764 bytes --]

From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: bug#5950: defvaralias after defvar should be warned in runtime
Date: Wed, 1 Aug 2018 14:55:56 -0400
Message-ID: <cb864996-c592-5507-f0c6-be07d17f13ee@gmail.com>

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.

[-- Attachment #3: Type: text/plain, Size: 810 bytes --]



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).


      parent reply	other threads:[~2018-08-02  2:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15  5:13 bug#5950: defvaralias after defvar should be warned in runtime IRIE Shinsuke
2010-09-15 20:16 ` Glenn Morris
2010-09-16  0:44   ` IRIE Shinsuke
2010-09-16  3:51     ` Glenn Morris
2010-09-16  9:27       ` Stefan Monnier
2018-05-26 16:52         ` Noam Postavsky
2018-05-26 19:46           ` Stefan Monnier
2018-05-26 23:54           ` Noam Postavsky
2018-06-12 11:48             ` Noam Postavsky
     [not found]               ` <cb864996-c592-5507-f0c6-be07d17f13ee@gmail.com>
     [not found]                 ` <jwvlg9pkbip.fsf-monnier+emacs@gnu.org>
2018-08-02 13:08                   ` Clément Pit-Claudel
2018-08-02 13:28                     ` Noam Postavsky
2018-08-02 14:37                       ` Clément Pit-Claudel
2018-08-02 17:03                         ` Stefan Monnier
2018-08-03  3:33                           ` Clément Pit-Claudel
2018-08-03 20:23                             ` Noam Postavsky
2018-08-03 21:00                               ` Clément Pit-Claudel
2018-08-03 22:09                                 ` Noam Postavsky
2018-08-03 22:24                                   ` Clément Pit-Claudel
2018-08-03 21:58                             ` Stefan Monnier
2018-08-02  2:14 ` Noam Postavsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sh3xzf9u.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=5950@debbugs.gnu.org \
    --cc=cpitclaudel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).