From: Philipp Stephani <p.stephani2@gmail.com>
To: Ergus <spacibba@aol.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: package-installed-p issue.
Date: Sat, 9 Jan 2021 19:02:56 +0100 [thread overview]
Message-ID: <CAArVCkQjYCXEfNCOLyUAMyooNHfneQzZafwHxTdD+ZQj6eXqeg@mail.gmail.com> (raw)
In-Reply-To: <20210109024756.en34g7b7ol45qtqs@Ergus>
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.
prev parent reply other threads:[~2021-01-09 18:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210109024756.en34g7b7ol45qtqs.ref@Ergus>
2021-01-09 2:47 ` package-installed-p issue Ergus
2021-01-09 16:53 ` Stefan Monnier
2021-01-09 18:02 ` Philipp Stephani [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAArVCkQjYCXEfNCOLyUAMyooNHfneQzZafwHxTdD+ZQj6eXqeg@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=spacibba@aol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).