dash.el icon indicating copy to clipboard operation
dash.el copied to clipboard

Fail to load dash when macro named as `x` exists

Open lorniu opened this issue 2 years ago • 2 comments

I'm using the latest compiled Emacs, and if a macro named x is defined elsewhere, loading dash.el will fail.

Reading the source code, find that it is because the cl package in which the macro defsetf is located is no longer loaded, so the parameter (x) is expanded as a macro. So, an error occurred.

Hopefully this will be fixed, thanks.

image

lorniu avatar Jul 16 '22 05:07 lorniu

"If it hurts, don't do that." ;) IMO it's unusual both to define a macro x without a prefix such as e.g. my-x, and to load uncompiled dash.el instead of byte-compiled dash.elc, especially considering how heavily Dash uses macros. So I wouldn't consider this a grave bug.

That said, I do of course agree that it would be nice to be able to load dash.el unconditionally.

One option I can think of is quoting problematic form(s) with (eval `... lexical-binding).

Another option is to finally drop support for Emacs versions 24.1 and 24.2, and start depending on Emacs 24.3.

WDYT? @magnars @Fuco1

basil-conto avatar Jul 24 '22 04:07 basil-conto

@basil-conto I have a macro called x in my custom file, but I get the error when updating packages from *packages* instead of manually loading dash.el.

I've renamed x to avoid problem, but anyone who also defined a global x macro maybe puzzled in the same scene (saw the wrong-number-of-args error when updating packages). I spend some time to deep into the source code and at last found that the root cause of the problem was the x macro, so IMO maybe some other better solution is needed. :)

lorniu avatar Jul 27 '22 04:07 lorniu