unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
       [not found] <CAN4ruPhihJ4p2+gBtrbyBFXD_hyJ_pMtnRPT7osVAiEMu_XEhA@mail.gmail.com>
@ 2013-04-02  8:18 ` Michael Olson
  2013-04-03 18:41   ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olson @ 2013-04-02  8:18 UTC (permalink / raw)
  To: 14121


[-- Attachment #1.1: Type: text/plain, Size: 864 bytes --]

---------- Forwarded message ----------
From: Michael Olson <mwolson@gnu.org>
Date: Mon, Apr 1, 2013 at 11:40 AM
Subject: Eager macroexpansion failure in Emacs 24.3
To: Emacs Development Discussions <emacs-devel@gnu.org>


emacs --no-init-file --load ~/test-case.el

In *Messages* buffer:

Eager macro-expansion failure: (error "(erc-response\\.contents parsed) is
not a valid place expression")

I can work around this by putting (require 'erc) and the function
definition in different 'when' blocks, but it's not ideal.

The erc-response struct is defined in erc-backend.el, which is loaded by
erc.el.

Putting (require 'erc) inside of a 'when' statement along with code that
relies on functions provided by a struct defined by a file it loads seems
to trigger the problem.

-- 
Michael Olson  |  http://mwolson.org/



-- 
Michael Olson  |  http://mwolson.org/

[-- Attachment #1.2: Type: text/html, Size: 1524 bytes --]

[-- Attachment #2: test-case.el --]
[-- Type: application/octet-stream, Size: 545 bytes --]


(when t
  (require 'erc)
  (defun my-erc-remove-trailing-whitespace (proc parsed)
    "Remove trailing whitespace from the current message.
Some IM clients use an OTR plug-in that sends some annoying
trailing space to the screen, so we want to clean that up."
    (let ((msg (erc-response.contents parsed)))
      (when (stringp msg)
        (setf (erc-response.contents parsed)
              (erc-replace-regexp-in-string "[[:space:]]+\\'" "" msg))
        nil)))
  (add-hook 'erc-server-PRIVMSG-functions 'my-erc-remove-trailing-whitespace))

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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-02  8:18 ` bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3 Michael Olson
@ 2013-04-03 18:41   ` Stefan Monnier
  2013-04-03 18:47     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-04-03 18:41 UTC (permalink / raw)
  To: Michael Olson; +Cc: 14121

tags 14121 notabug
thanks

> emacs --no-init-file --load ~/test-case.el
[...]
> In *Messages* buffer:
[...]
> Eager macro-expansion failure: (error "(erc-response\\.contents parsed) is
> not a valid place expression")

Not a big surprise:

   emacs24 -Q --batch -f batch-byte-compile test-case.el 
   
   In end of data:
   test-case.el:14:1:Warning: the following functions are not known to be
       defined: erc-response.contents, setf, erc-replace-regexp-in-string
   Wrote /home/monnier/tmp/test-case.elc

Emacs-24.3 tries to expand macros more eagerly (i.e. more like the
byte-compiler), so files that fail to byte-compile properly are also
likely to fail that eager macro-expansion.

But do note that the above message is somewhat harmless: when eager
macro-expansion fails, Emacs falls back on macro-expanding lazily as it
has always done.  IOW other than emitting the above message your code
should still work fine.


        Stefan





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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-03 18:41   ` Stefan Monnier
@ 2013-04-03 18:47     ` Eli Zaretskii
  2013-04-03 23:41       ` Michael Olson
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2013-04-03 18:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: mwolson, 14121

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Wed, 03 Apr 2013 14:41:34 -0400
> Cc: 14121@debbugs.gnu.org
> 
> Emacs-24.3 tries to expand macros more eagerly (i.e. more like the
> byte-compiler), so files that fail to byte-compile properly are also
> likely to fail that eager macro-expansion.
> 
> But do note that the above message is somewhat harmless: when eager
> macro-expansion fails, Emacs falls back on macro-expanding lazily as it
> has always done.

Perhaps the failure message should mention that.





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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-03 18:47     ` Eli Zaretskii
@ 2013-04-03 23:41       ` Michael Olson
  2013-04-04  0:51         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olson @ 2013-04-03 23:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mwolson@gnu.org, 14121@debbugs.gnu.org

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

If the message really is harmless (and no change to the code is
recommended, which seems to be the case), then it really ought to be
removed completely.

On Wednesday, April 3, 2013, Eli Zaretskii wrote:

> > From: Stefan Monnier <monnier@iro.umontreal.ca <javascript:;>>
> > Date: Wed, 03 Apr 2013 14:41:34 -0400
> > Cc: 14121@debbugs.gnu.org <javascript:;>
> >
> > Emacs-24.3 tries to expand macros more eagerly (i.e. more like the
> > byte-compiler), so files that fail to byte-compile properly are also
> > likely to fail that eager macro-expansion.
> >
> > But do note that the above message is somewhat harmless: when eager
> > macro-expansion fails, Emacs falls back on macro-expanding lazily as it
> > has always done.
>
> Perhaps the failure message should mention that.
>


-- 
Michael Olson  |  http://mwolson.org/

[-- Attachment #2: Type: text/html, Size: 1275 bytes --]

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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-03 23:41       ` Michael Olson
@ 2013-04-04  0:51         ` Stefan Monnier
  2013-04-04  3:22           ` Michael Olson
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-04-04  0:51 UTC (permalink / raw)
  To: Michael Olson; +Cc: 14121@debbugs.gnu.org

> If the message really is harmless (and no change to the code is
> recommended, which seems to be the case),

No, the message does mean "you should fix your code".  It's just that we
additionally try to handle it right, for backward compatibility's sake.


        Stefan





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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-04  0:51         ` Stefan Monnier
@ 2013-04-04  3:22           ` Michael Olson
  2013-04-04 12:33             ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olson @ 2013-04-04  3:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14121@debbugs.gnu.org

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

What is the "fix" then?  Using a macro in the same 'when' block that the
macro is defined in doesn't seem wrong to me.


On Wed, Apr 3, 2013 at 5:51 PM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> > If the message really is harmless (and no change to the code is
> > recommended, which seems to be the case),
>
> No, the message does mean "you should fix your code".  It's just that we
> additionally try to handle it right, for backward compatibility's sake.
>
>
>         Stefan
>



-- 
Michael Olson  |  http://mwolson.org/

[-- Attachment #2: Type: text/html, Size: 1082 bytes --]

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

* bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3
  2013-04-04  3:22           ` Michael Olson
@ 2013-04-04 12:33             ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-04-04 12:33 UTC (permalink / raw)
  To: Michael Olson; +Cc: 14121@debbugs.gnu.org

> What is the "fix" then?

E.g. move the `require' to the top-level.

> Using a macro in the same 'when' block that the
> macro is defined in doesn't seem wrong to me.

It is, because macro expansion can take place (long) before the code is
executed, i.e. long before the macro is defined.


        Stefan





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

end of thread, other threads:[~2013-04-04 12:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAN4ruPhihJ4p2+gBtrbyBFXD_hyJ_pMtnRPT7osVAiEMu_XEhA@mail.gmail.com>
2013-04-02  8:18 ` bug#14121: Fwd: Eager macroexpansion failure in Emacs 24.3 Michael Olson
2013-04-03 18:41   ` Stefan Monnier
2013-04-03 18:47     ` Eli Zaretskii
2013-04-03 23:41       ` Michael Olson
2013-04-04  0:51         ` Stefan Monnier
2013-04-04  3:22           ` Michael Olson
2013-04-04 12:33             ` Stefan Monnier

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