Closed skeeto closed 9 years ago
Question: should this apply to hooks as well? If so, there should probably be an example since most examples floating around the web don't use sharp-quotes.
@shosti That's a good point. It looks like key bindings and hooks are cases where the manual uses plain quoting. It's also another situation where it's a (usually) top-level expression that's intentionally referring to a global function.
The way I'm sort of seeing it is that regular users writing their .emacs
configs can just stick to plain quotes all the time. It's very ad hoc and user configurations are rarely byte compiled anyway. However, package authors, the kind of people using this style guide, should be more rigorous in their discipline.
I think you should also mention in the rule the rationale behind it.
Although the lexical aspect is mostly moot in keybinds and hooks, the sharp quote still gives the compiler useful information. Might it be best to say something along lines of "for keybind and hooks, it is optional but recommended"? Or would we rather not say that since the manual doesn't use it?
@skeeto Ping :-)
@skeeto Ping :-)
I don't think we should list key bindings or hooks as exceptions.
AFAICS, sharp quotes have a consistent benefit (byte compiler warnings), and no real drawbacks in any usages. There are actually a lot of places of them being used in key binding forms inside Emacs core (roughly ~100 matches). The ones in lisp/net/quickurl.el
, for example, were added originally in 1999 by RMS himself.
I totally agree.
On Sunday, January 25, 2015, Dmitry Gutov notifications@github.com wrote:
I don't think we should list key bindings or hooks as exceptions.
AFAICS, sharp quotes have a consistent benefit (byte compiler warnings), and no real drawbacks in any usages. There are actually a lot of places of them being used in key binding forms inside Emacs core (roughly ~100 matches). The ones in lisp/net/quickurl.el, for example, were added originally in 1999 by RMS himself.
— Reply to this email directly or view it on GitHub https://github.com/bbatsov/emacs-lisp-style-guide/pull/12#issuecomment-71371627 .
Best Regards, Bozhidar Batsov
So do I. A function is a function, whether in a key binding or not.
Me too. Despite my previous on-the-fence comment, I've since started using and recommending it unconditionally.
Guess @skeeto forgot about this PR, so one of us should probably commit the updated rule/examples.
Done, kinda.
I'm not sure what to write about macros: the cl-labels
example returns (:local :local)
in the current Emacs master. Maybe it was just a long-standing bug, but either way it's there in 24.4 and earlier.
Adds advice according to #7.