From 0ebb5cf35db51d22850f884c94dc4d5c7db85fda Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 23 Jul 2020 17:47:49 -0400 Subject: [PATCH] docs/faq: add "Why sharp-quote functions" --- docs/faq.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/faq.org b/docs/faq.org index 6323ceac3..a909c9f6a 100644 --- a/docs/faq.org +++ b/docs/faq.org @@ -51,6 +51,8 @@ - [[#why-do-non-evil-users-get-expand-region-but-not-evil-users][Why do non-evil users get expand-region, but not evil users?]] - [[#why-not-use-exec-path-from-shell-instead-of-doom-env][Why not use exec-path-from-shell instead of ~doom env~?]] - [[#why-wsbutler-over-delete-trailing-whitespace-or-whitespace-cleanup][Why wsbutler over delete-trailing-whitespace or whitespace-cleanup?]] +- [[#emacs-lisp][Emacs Lisp]] + - [[#why-do-you-quote-some-symbols-with-symbol][Why do you quote some symbols with ~#'symbol~?]] - [[#common-issues][Common Issues]] - [[#i-get-the-vanilla-emacs-splash-screen-at-startup][I get the vanilla Emacs splash screen at startup]] - [[#i-see-a-blank-scratch-buffer-at-startup][I see a blank scratch buffer at startup]] @@ -989,6 +991,19 @@ cleanup work. In any case, if you had used =ws-butler= from the beginning, trailing whitespace and newlines would never be a problem! +* Emacs Lisp +** Why do you quote some symbols with ~#'symbol~? +~#'symbol~ is short for ~(function symbol)~, the same way ~'symbol~ is short for +~(quote symbol)~. + +In elisp there is no /functional/ difference between the two syntaxes, but the +sharp-quote does hint to the byte-compiler that "this symbol refers to a +function", which it can perform additional checks on when the code is +byte-compiled. + +My reason for using it is to make it explicit to readers how I intend (or +expect) the symbol to be used. No sharp-quote means I'm using the symbol as a +literal data value. * Common Issues ** I get the vanilla Emacs splash screen at startup