1
0
Fork 0

[oni-core] Require ‘consult’ when byte-compiling ‘oni-core’

When everything is interpreted it all works fine because ‘consult’ is loaded
before the ‘with-eval-after-load’ part is run, but when byte compiling the byte
compiler doesn't know that ‘consult-customize’ is a macro unless ‘consult’ is
loaded, which it isn't when Guix compiles it.

When it's byte-compiled as if it's a function ‘consult-buffer’ is assumed to be
a variable that's passed in, so I'm guessing it's trying to dereference it first
before passing it on to a non-existent function? But of course ‘consult-buffer’
is only a function (Emacs Lisp is a Lisp-2 after all), so it fails, but only
when byte compiled (and even only when byte-compiled in a clean environment
where there are no packages loaded that aren't explicity said to be).

Hopefully this fixes my issue with being unable to switch buffers until I
explicitly load ‘consult’.
This commit is contained in:
Tom Willemse 2023-05-25 15:29:42 -07:00
parent 23ee5ed080
commit 09615b953a

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2023.0524.235720 ;; Version: 2023.0525.151855
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame) ;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -450,14 +450,14 @@ _s_: String list"
:enabled buffer-file-name :enabled buffer-file-name
:action find-file)) :action find-file))
(defun oni-core-remove-consult-buffer-preview () (eval-when-compile
(consult-customize consult-buffer :preview-key nil)) (require 'consult))
(with-eval-after-load 'consult (with-eval-after-load 'consult
(with-eval-after-load 'related-files (with-eval-after-load 'related-files
(add-to-list 'consult-buffer-sources 'oni-core-related-places-source)) (add-to-list 'consult-buffer-sources 'oni-core-related-places-source))
(oni-core-remove-consult-buffer-preview)) (consult-customize consult-buffer :preview-key nil))
;;; Embark ;;; Embark