help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package-installed-p issue.


From: Philipp Stephani
Subject: Re: package-installed-p issue.
Date: Sat, 9 Jan 2021 19:02:56 +0100

Am Sa., 9. Jan. 2021 um 03:48 Uhr schrieb Ergus <spacibba@aol.com>:
>
> Hi I'm trying to simplify some of my code in the init file and
> something like:
>
> (package-installed-p 'use-package)
>
> Triggers an error so I need to do something like:
>
> (unless (fboundp 'package-installed-p)
>      (require 'package))
>
> (unless (package-installed-p 'use-package)
>    ...
> )
>
> My question is: Shouldn't package-installed-p be an autoload?
>
> Is there a reason why it is not an autoload?
>

Most functions should not be autoloaded. Autoloads are useful for
high-level interactive commands in optional libraries, so that e.g.
users can start ERT with `M-x ert' without having to load `ert'
explicitly. In code (including ~/.emacs), just use `require' to load
the required library. There's no need to surround it with `unless' -
`require' is idempotent.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]