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.
This commit is contained in:
parent
87ffff0ac0
commit
8e49378b47
16
init.el
16
init.el
|
@ -16,17 +16,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
;; Let's use lexical binding by default, shall we?
|
||||
(setq-default lexical-binding t)
|
||||
|
||||
;; For some reason, the above setting doesn't translate to the *scratch*
|
||||
;; buffer, where I try out packages.
|
||||
(advice-add 'setup :around
|
||||
(defun acdw/setup-lexical-advice (orig-fun &rest args)
|
||||
"Wrap `setup' in a `lexical-binding' form."
|
||||
(let ((lexical-binding t))
|
||||
(apply orig-fun args))))
|
||||
|
||||
|
||||
;;; Necessary packages
|
||||
|
||||
|
@ -843,6 +832,11 @@ if ripgrep is installed, otherwise `consult-grep'."
|
|||
eval-expression-print-level nil
|
||||
lisp-indent-function #'lisp-indent-function)
|
||||
|
||||
(defun acdw/enforce-lexical-binding ()
|
||||
(setq lexical-binding t))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook #'acdw/enforce-lexical-binding)
|
||||
|
||||
(defun acdw/eval-region-or-buffer ()
|
||||
(interactive)
|
||||
(if (region-active-p)
|
||||
|
|
Loading…
Reference in New Issue