all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r113896: Declare external variables.
       [not found] <E1VA0wJ-0001uE-N7@vcs.savannah.gnu.org>
@ 2013-08-15 20:25 ` Stefan Monnier
  2013-08-16  7:34   ` Michael Albinus
  2013-08-15 20:32 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-08-15 20:25 UTC (permalink / raw
  To: Michael Albinus; +Cc: emacs-devel

> +(eval-when-compile
> +  (defvar directory-sep-char)
> +  (defvar dired-move-to-filename-regexp))

You don't want to "eval" those defvars, since evaluating such a defvar is
mostly a no-op.  So don't put them inside eval-when-compile.


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
       [not found] <E1VA0wJ-0001uE-N7@vcs.savannah.gnu.org>
  2013-08-15 20:25 ` [Emacs-diffs] trunk r113896: Declare external variables Stefan Monnier
@ 2013-08-15 20:32 ` Stefan Monnier
  2013-08-16 12:46   ` Michael Albinus
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-08-15 20:32 UTC (permalink / raw
  To: Michael Albinus; +Cc: emacs-devel

> +  (defvar buffer-name)

This is bad: buffer-name should not be a dynamically-scoped variable.


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
  2013-08-15 20:25 ` [Emacs-diffs] trunk r113896: Declare external variables Stefan Monnier
@ 2013-08-16  7:34   ` Michael Albinus
  2013-08-16 16:28     ` Stefan Monnier
  2013-08-16 22:38     ` Xue Fuqiao
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Albinus @ 2013-08-16  7:34 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +(eval-when-compile
>> +  (defvar directory-sep-char)
>> +  (defvar dired-move-to-filename-regexp))
>
> You don't want to "eval" those defvars, since evaluating such a defvar is
> mostly a no-op.  So don't put them inside eval-when-compile.

But it doesn't hurt, does it?

I've written it this way for didactic purposes: it reminds me what it is
good for (byte-compiler!).

>         Stefan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
  2013-08-15 20:32 ` Stefan Monnier
@ 2013-08-16 12:46   ` Michael Albinus
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Albinus @ 2013-08-16 12:46 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +  (defvar buffer-name)
>
> This is bad: buffer-name should not be a dynamically-scoped variable.

I don't like it either. It's old code, maybe it came in for whatever
compatibility reason. Don't remember.

Anyway, I've fixed it. It's not the most important part of Tramp, it is
the code reporting Tramp bugs.

>         Stefan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
  2013-08-16  7:34   ` Michael Albinus
@ 2013-08-16 16:28     ` Stefan Monnier
  2013-08-17 10:21       ` Michael Albinus
  2013-08-16 22:38     ` Xue Fuqiao
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-08-16 16:28 UTC (permalink / raw
  To: Michael Albinus; +Cc: emacs-devel

>>> +(eval-when-compile
>>> +  (defvar directory-sep-char)
>>> +  (defvar dired-move-to-filename-regexp))
>> You don't want to "eval" those defvars, since evaluating such a defvar is
>> mostly a no-op.  So don't put them inside eval-when-compile.
> But it doesn't hurt, does it?

Yes it does.  It actually hides those defvars from the compiler since it
passes the code to `eval' and only passes the result (aka nil) to the
compiler (at least, that's what "eval-when-compile" is supposed to
mean).

It's a bad habit.  The byte-compiler has to do extra work to find those
defvars because of people who write code like that.

Please fix it, so as not to set a bad example,


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
  2013-08-16  7:34   ` Michael Albinus
  2013-08-16 16:28     ` Stefan Monnier
@ 2013-08-16 22:38     ` Xue Fuqiao
  1 sibling, 0 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-08-16 22:38 UTC (permalink / raw
  To: Michael Albinus; +Cc: Stefan Monnier, emacs-devel

On Fri, Aug 16, 2013 at 3:34 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> +(eval-when-compile
>>> +  (defvar directory-sep-char)
>>> +  (defvar dired-move-to-filename-regexp))
>>
>> You don't want to "eval" those defvars, since evaluating such a defvar is
>> mostly a no-op.  So don't put them inside eval-when-compile.
> I've written it this way for didactic purposes: it reminds me what it is
> good for (byte-compiler!).

Like Stefan said, it burdens the byte-compiler.  You can add some
comments before it.

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Emacs-diffs] trunk r113896: Declare external variables.
  2013-08-16 16:28     ` Stefan Monnier
@ 2013-08-17 10:21       ` Michael Albinus
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Albinus @ 2013-08-17 10:21 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Please fix it, so as not to set a bad example,

Done.

>         Stefan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-17 10:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1VA0wJ-0001uE-N7@vcs.savannah.gnu.org>
2013-08-15 20:25 ` [Emacs-diffs] trunk r113896: Declare external variables Stefan Monnier
2013-08-16  7:34   ` Michael Albinus
2013-08-16 16:28     ` Stefan Monnier
2013-08-17 10:21       ` Michael Albinus
2013-08-16 22:38     ` Xue Fuqiao
2013-08-15 20:32 ` Stefan Monnier
2013-08-16 12:46   ` Michael Albinus

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.