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

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

Let flymake load all loaddefs and package autoloads


From: Ant
Subject: Let flymake load all loaddefs and package autoloads
Date: Sat, 15 Jul 2023 12:43:51 +0000

A few days ago, I posted a question on Reddit /r/emacs ( 
https://www.reddit.com/r/emacs/comments/14y127r/let_byte_compiler_flymake_detect_autoloaded/
 
) 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:

|(setopt elisp-flymake-byte-compile-load-path load-path) ; Configure 
flymake ;; [...] ||||(global-set-key (kbd "C-.") #'embark-act) ; <--- warning: 
||the function "embark-act" might not be defined at runtime.||(global-set-key 
(kbd "M-.") #'embark-dwim); <--- ||warning: ||the function "embark-dwim" might 
not be defined at runtime.|||

|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]