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

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

Re: Let flymake load all loaddefs and package autoloads


From: Ant
Subject: Re: Let flymake load all loaddefs and package autoloads
Date: Sun, 16 Jul 2023 00:42:51 +0000

I screwed up the formatting, so here is the previous message

A few days ago, I posted a question on Reddit /r/emacs
(https://redd.it/14y127r) asking if it was possible for flymake to
detect autoloaded functions when linting my init file. I got some
solutions to the problem, but also more questions came to my mind. I
hope cross posting is not frowned upon.

An example of what I want to achieve is given by the following code:


;; Set load path for byte compiler
(setopt elisp-flymake-byte-compile-load-path load-path)
;; [...]
;; Warning: function "embark-act" might not be defined at runtime
(global-set-key (kbd "C-.") #'embark-act)
;; Warning: function "embark-dwim" might not be defined at runtime
(global-set-key (kbd "M-.") #'embark-dwim)

The linter gives me two warnings, but starting Emacs does not give me
any error like this, since the functions are autoloaded.

If we exclude warning suppression as a solution, there are 2 ways
(AFAIK) to remove these warnings:

1. (require 'embark).

I'd like, however, to keep it lazy loaded

2. (require 'embark-autoloads).

This has been suggested by a kind user in the Reddit thread. The problem
with the latter approach is that I'd have to manually require every
*-autoloads and *loaddefs file.

Isn't there a way for flymake/the byte compiler to include all autoloads 
that
are regularly loaded in Emacs during the normal interactive startup
process? I understand that such an option would not be suitable for
package development, but when writing a personal configuration it would
be nice to consider autoloaded functions.

Alternatively I could settle with the option 2, but I'd need a way to
get a list of all autoloads features to require. That's a problem
especially for the package.el autoloads, since those are a lot.

Thank you in advance for your help.







reply via email to

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