Basically, when should I use Emacs Lisp's function procedure? I haven't found any examples in which there's a difference in behavior if you pass functions as arguments 'like-this or #'like-this. In fact, if I evaluate (eq 'goto-char #'goto-char) it returns t.
The Emacs Lisp code that I've come across rarely uses function/#'; the authors just quote/' everything.
Example: (add-hook 'emacs-lisp-hook 'turn-on-eldoc-mode)
However, I can find a few counterexamples. Here's one from the source code of Emacs 24.3's electric.el:
(add-hook 'post-self-insert-hook
#'electric-indent-post-self-insert-function
'append)
Guesses and further questions:
- Is it just a Lisp-2 stylistic convention?
- Does it have to do with byte-compilation?
- Does it only matter for library writers? Like, if you intend for your code to be run under a huge number of environments and Emacs versions? (The corollary would be if you're just "dotfile-tinkering" then you don't need to worry about all this.)
- When should I quote lambda-expressions? When can I leave them unquoted?
E.g.,(do-something '(lambda …
versus(do-something (lambda … - Was there some limitation in an earlier version of Emacs that gave rise to these facets of elisp? Like, can I mostly ignore the difference between
'and#'as long as I'm using a version of Emacs more recent than X?