From c370a0ba8206dddcc23c5fabae3cf93708671279 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 16 Apr 2021 12:30:49 -0400 Subject: [PATCH] Bump :lang scheme emacs-geiser/geiser@aa26163 -> emacs-geiser/geiser@c5a9aae With emacs-geiser/geiser@c5a9aae, geiser-impl--add-to-alist is now autoloaded. This fixes #4863 by preventing void-function errors at startup or 'doom sync'-time. But this presents a new problem: geiser-impl is guaranteed to be needlessly loaded at startup, the first time geiser-impl--add-to-list is called among, say, geiser-chez's package autoloads. To get around this I forcibly redefine it as an inline-able function (with defsubst) and shove this new definition into Doom's autoloads file (where it will appear before package autoloads). Since Doom byte-compiles its autoloads file (containing concatenated autoloads from all doom modules and packages), geiser-impl--add-to-alist calls (and geiser-activate-implementation calls too, which is already inline-able) will be inlined, fixing the issue. Fixes #4863 --- modules/lang/scheme/autoload.el | 19 ++++++++++++------- modules/lang/scheme/packages.el | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/lang/scheme/autoload.el b/modules/lang/scheme/autoload.el index 2e7b17c76..2b0ddc602 100644 --- a/modules/lang/scheme/autoload.el +++ b/modules/lang/scheme/autoload.el @@ -3,17 +3,22 @@ ;; HACK geiser-* plugins will try to add to these two variables, so it must be ;; defined before their autoloads are evaluated. Fortunately, Doom modules' ;; autoloads run earlier than package autoloads. +;; TODO PR this upstream ;;;###autoload (defvar geiser-active-implementations ()) ;;;###autoload (defvar geiser-implementations-alist ()) -;; HACK `geiser-impl--add-to-alist' isn't autoloaded or inlined, so you get -;; void-function errors when it is called in the autoloads files of other -;; geiser-* packages. -;;;###autoload (defun geiser-impl--add-to-alist (kind what impl &optional append) (add-to-list 'geiser-implementations-alist (list (list kind what) impl) append)) +;; 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) - ;; Adapted from https://github.com/alezost/emacs-config/blob/master/utils/al-scheme.el#L76-L123 ;;;###autoload (defun +scheme-scheme-indent-function-a (indent-point state) @@ -36,9 +41,9 @@ lists properly and names starting with 'default'." (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)) (backward-prefix-chars) (current-column)) + ;; NOTE let -> let* & moved `method' def into let bindings (let* ((function (buffer-substring (point) (progn (forward-sexp 1) (point)))) - ;; NOTE let -> let* & moved `method' def into let bindings (method (or (get (intern-soft function) 'scheme-indent-function) (get (intern-soft function) 'scheme-indent-hook)))) (cond ((or (eq method 'defun) @@ -46,7 +51,7 @@ lists properly and names starting with 'default'." (> (length function) 3) ;; NOTE string-match -> string-match-p ;; NOTE The original regexp is "\\`def" but it will mess - ;; indentation with such names as 'default-...'. + ;; up indentation with such names as 'default-...'. (string-match-p "\\`def" function))) (lisp-indent-defform state indent-point)) ;; NOTE Added this clause to handle alignment of keyword symbols diff --git a/modules/lang/scheme/packages.el b/modules/lang/scheme/packages.el index 11f162659..70887c517 100644 --- a/modules/lang/scheme/packages.el +++ b/modules/lang/scheme/packages.el @@ -1,7 +1,7 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/scheme/packages.el -(when (package! geiser :pin "aa26163aa81b5af3bc5bbf23bec8b5776de3a8bc") +(when (package! geiser :pin "c5a9aae4d30ea6dbf2d8af4dd1cc35a839686a00") (package! macrostep-geiser :pin "8600fca05fd12a2e0ffe63238ddbfcb37c285dac") (when (featurep! +chez) (package! geiser-chez :pin "4cb7f2667ea1c53da53f0144910fbbd67bccbf4d"))