Henrik Lissner 2021-04-20 22:11:19 -04:00
parent 1d155d0c2f
commit cb4782b190
3 changed files with 24 additions and 25 deletions

View file

@ -1,31 +1,30 @@
;;; lang/scheme/autoload.el -*- lexical-binding: t; -*- ;;; lang/scheme/autoload.el -*- lexical-binding: t; -*-
;; HACK geiser-* plugins will try to add to these two variables, so it must be ;; HACK `geiser' has poor autoload ettiquette. It calls
;; defined before their autoloads are evaluated. Fortunately, Doom modules' ;; `geiser-activate-implementation' and `geiser-implementation-extension'
;; autoloads run earlier than package autoloads. ;; in their autoloads files. Sure, these functions are autoloaded, but this
;; TODO PR this upstream ;; needlessly (and unavoidably) pulls in the `geiser-impl' package (et co)
;; when geiser-X's autoloads are read (i.e. at startup).
;;
;; I rectify this by inlining calls to these two functions (and the
;; `geiser-impl--add-to-alist' sub-call in
;; `geiser-implementation-extension'), and autoloading the two variables
;; they operate on. I do this from our autoloads file (which is read right
;; before package autoloads are).
;; TODO At some point, PR this behavior upstream (but not verbatim!)
;;;###autoload (defvar geiser-active-implementations ()) ;;;###autoload (defvar geiser-active-implementations ())
;;;###autoload (defvar geiser-implementations-alist ()) ;;;###autoload (defvar geiser-implementations-alist ())
;;;###autoload (eval-and-compile (dolist (sym '(geiser-impl--add-to-alist geiser-activate-implementation geiser-implementation-extension)) (put sym 'byte-optimizer 'byte-compile-inline-expand)))
;; HACK `geiser-impl--add-to-alist' is autoloaded, but not inlined. This means
;; `geiser-impl' is needlessly pulled in immediately at startup when
;; geiser-X's autoloads are loaded. Since Doom byte-compiles its autoloads
;; file we can avoid this by forcibly inlining the function (by redefining
;; it with `defsubst').
;; TODO PR this upstream
;;;###autoload
(defsubst geiser-impl--add-to-alist (kind what impl &optional append)
(add-to-list 'geiser-implementations-alist (list (list kind what) impl) append))
(defvar calculate-lisp-indent-last-sexp) (defvar calculate-lisp-indent-last-sexp)
;; Adapted from https://github.com/alezost/emacs-config/blob/master/utils/al-scheme.el#L76-L123 ;; Adapted from https://github.com/alezost/emacs-config/blob/master/utils/al-scheme.el#L76-L123
;;;###autoload ;;;###autoload
(defun +scheme-scheme-indent-function-a (indent-point state) (defun +scheme-indent-function-a (indent-point state)
"Advice to replace `scheme-indent-function'. "Advice to replace `scheme-indent-function'.
This function is the same as `scheme-indent-function' except it indents property This function is the same as `scheme-indent-function' except it properly indents
lists properly and names starting with 'default'." property lists and names starting with 'default'."
(let ((normal-indent (current-column))) (let ((normal-indent (current-column)))
(goto-char (1+ (elt state 1))) (goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)

View file

@ -2,7 +2,7 @@
(use-package! scheme (use-package! scheme
:hook (scheme-mode . rainbow-delimiters-mode) :hook (scheme-mode . rainbow-delimiters-mode)
:config (advice-add #'scheme-indent-function :override #'+scheme-scheme-indent-function-a)) :config (advice-add #'scheme-indent-function :override #'+scheme-indent-function-a))
(use-package! geiser (use-package! geiser

View file

@ -1,20 +1,20 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/scheme/packages.el ;;; lang/scheme/packages.el
(when (package! geiser :pin "c5a9aae4d30ea6dbf2d8af4dd1cc35a839686a00") (when (package! geiser :pin "2b45bd368b4acbcef53c3c761725241fb6846102")
(package! macrostep-geiser :pin "8600fca05fd12a2e0ffe63238ddbfcb37c285dac") (package! macrostep-geiser :pin "8600fca05fd12a2e0ffe63238ddbfcb37c285dac")
(when (featurep! +chez) (when (featurep! +chez)
(package! geiser-chez :pin "4cb7f2667ea1c53da53f0144910fbbd67bccbf4d")) (package! geiser-chez :pin "03da1c17253856d8713bc5a25140cb5002c9c188"))
(when (featurep! +chibi) (when (featurep! +chibi)
(package! geiser-chibi :pin "54e7f384618c73d8fb675b5289d443a8ee3e4dc8")) (package! geiser-chibi :pin "6f59291d8d1dc92ffd3f53f919d8cab4bf50b7d3"))
(when (featurep! +chicken) (when (featurep! +chicken)
(package! geiser-chicken :pin "47be5b43b35d3bf35b0f668b4c08715ea41fb97d")) (package! geiser-chicken :pin "ceab39c89607f55cba88e5606ba5eb37c7df5260"))
(when (featurep! +gambit) (when (featurep! +gambit)
(package! geiser-gambit :pin "0ee4156640988497779345452c3aa0417356e606")) (package! geiser-gambit :pin "3294c944d1c3b79db44ed14b133129fec454bd60"))
(when (featurep! +gauche) (when (featurep! +gauche)
(package! geiser-gauche :pin "66e51430bded0f0e2037f474818a7bbaafb2906c")) (package! geiser-gauche :pin "66e51430bded0f0e2037f474818a7bbaafb2906c"))
(when (featurep! +guile) (when (featurep! +guile)
(package! geiser-guile :pin "93ef7101fdfcc7eac6f465b4b9788c384a323c14") (package! geiser-guile :pin "700ac985c1c729ba1005a0a076c683e9f781526f")
(when (featurep! :checkers syntax) (when (featurep! :checkers syntax)
(package! flycheck-guile (package! flycheck-guile
:recipe (:host github :repo "flatwhatson/flycheck-guile") :recipe (:host github :repo "flatwhatson/flycheck-guile")
@ -24,4 +24,4 @@
(when (featurep! +mit) (when (featurep! +mit)
(package! geiser-mit :pin "d17394f577aaa2854a74a1a0039cb8f73378b400")) (package! geiser-mit :pin "d17394f577aaa2854a74a1a0039cb8f73378b400"))
(when (featurep! +racket) (when (featurep! +racket)
(package! geiser-racket :pin "a87fd449cc6c7b0b17a0b08268e78d3f038f3351"))) (package! geiser-racket :pin "22e56ce80389544d3872cf4beb4008fb514b2218")))