use-package icon indicating copy to clipboard operation
use-package copied to clipboard

compile-defun support?

Open alphapapa opened this issue 7 years ago • 1 comments

Hi,

Forgive me if this is covered elsewhere, but I couldn't find any reference to it in the docs or old issues.

Would it be possible to add compile-defun support to use-package? For example, if I have several top-level use-package forms in my init file, and I want to byte-compile all the functions defined in one form's :config, it would be nice to be able to do this with compile-defun. The alternatives are, IIUC:

a. Copy the individual functions to top-level in a buffer and compile them individually. b. Byte-compile and load the entire file. c. Move the use-package form into its own file and byte-compile and load it.

Thanks.

alphapapa avatar Jan 22 '18 03:01 alphapapa

How do you imagine that this would work? Should there be a new command that also byte-compiles everything in, say, :config, :preface, etc. in the use-package declaration? Or should it just compile the defun at point, nested inside a use-package declaration?

In terms of implementation, could we perhaps get away with narrowing, and then call compile-defun directly?

skangas avatar Nov 30 '22 16:11 skangas