unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Let flymake load all loaddefs and package autoloads
@ 2023-07-15 12:43 Ant
  0 siblings, 0 replies; 2+ messages in thread
From: Ant @ 2023-07-15 12:43 UTC (permalink / raw)
  To: help-gnu-emacs

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Let flymake load all loaddefs and package autoloads
@ 2023-07-16  0:42 Ant
  0 siblings, 0 replies; 2+ messages in thread
From: Ant @ 2023-07-16  0:42 UTC (permalink / raw)
  To: n58r; +Cc: help-gnu-emacs

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.







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-16  0:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-16  0:42 Let flymake load all loaddefs and package autoloads Ant
  -- strict thread matches above, loose matches on Subject: below --
2023-07-15 12:43 Ant

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).