I would like to autoload the command f-join
from f.el
using use-package
. Note that the package f.el
depends on the packages dash.el
and s.el
. Here is a minimal example:
(setq debug-on-error t)
(let ((default-directory "~/test/emacs")
(packages (list "dash.el" "f.el" "s.el" "use-package")))
(dolist (package packages)
(add-to-list 'load-path (expand-file-name package))))
(eval-when-compile
(require 'use-package))
(use-package dash
:defer t)
(use-package f
:after (s dash) ;; make loading order-independent
:commands f-join ;; add autoload for f-join
:defer t)
(use-package s
:defer t)
(f-join "a" "b")
(message-box "Everything ok")
Running this with emacs -Q -l
gives error:
Debugger entered--Lisp error: (void-function f-join)
Changing :defer
to :demand
on the dependent packages dash.el
and s.el
eliminates the error message, but now the packages are no longer autoloaded, which is what I wanted to avoid.
f-join
is not a command, it's a function. – Stefan Nov 7 '18 at 23:10f-join
autoloaded? – Stefan Nov 7 '18 at 23:12f.el
in case I did not usef-join
? – Håkon Hægland Nov 8 '18 at 5:23(f-join A B)
you can use(expand-file-name B A)
without needing any extra library.f-join
here only saves you a few keystrokes, and costs you extra processing. ] – Stefan Nov 8 '18 at 14:04