about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-22 10:20:25 -0500
committerCase Duckworth2021-04-22 10:20:25 -0500
commit8e49378b47157357227ac8f06c9d0a0062a4220c (patch)
treeba140dc7fc81351ff79f98b0941eae7a112a6280
parentAlso load files in .emacs.d/lisp when running `refresh-emacs' (diff)
downloademacs-8e49378b47157357227ac8f06c9d0a0062a4220c.tar.gz
emacs-8e49378b47157357227ac8f06c9d0a0062a4220c.zip
Move lexical-binding setting into a hook
*scratch* still doesn't apply the (setq-default lexical-binding t) form, but
the advice I'd been giving `setup' broke the documentation generator function.
So I just added lexical-binding to a hook when opening an emacs-lisp-mode
buffer.

Will this bite me later?  Possibly.  But I'll deal with that then.  The worst
that could happen is that I'd write another function, `setup-test' or
something, that'd apply lexical-binding and then run `setup'.  Or I could just
set lexical-binding to t manually.  Whatever.
-rw-r--r--init.el16
1 files changed, 5 insertions, 11 deletions
diff --git a/init.el b/init.el index d2a8960..3e19ec0 100644 --- a/init.el +++ b/init.el
@@ -16,17 +16,6 @@
16 16
17;;; Code: 17;;; Code:
18 18
19;; Let's use lexical binding by default, shall we?
20(setq-default lexical-binding t)
21
22;; For some reason, the above setting doesn't translate to the *scratch*
23;; buffer, where I try out packages.
24(advice-add 'setup :around
25 (defun acdw/setup-lexical-advice (orig-fun &rest args)
26 "Wrap `setup' in a `lexical-binding' form."
27 (let ((lexical-binding t))
28 (apply orig-fun args))))
29
30 19
31;;; Necessary packages 20;;; Necessary packages
32 21
@@ -843,6 +832,11 @@ if ripgrep is installed, otherwise `consult-grep'."
843 eval-expression-print-level nil 832 eval-expression-print-level nil
844 lisp-indent-function #'lisp-indent-function) 833 lisp-indent-function #'lisp-indent-function)
845 834
835 (defun acdw/enforce-lexical-binding ()
836 (setq lexical-binding t))
837
838 (add-hook 'emacs-lisp-mode-hook #'acdw/enforce-lexical-binding)
839
846 (defun acdw/eval-region-or-buffer () 840 (defun acdw/eval-region-or-buffer ()
847 (interactive) 841 (interactive)
848 (if (region-active-p) 842 (if (region-active-p)