ZachMassia / PlatformIO-Mode

PlatformIO Integration for Emacs
GNU General Public License v3.0
68 stars 20 forks source link

doesn't play nice with `use-package` #6

Closed spott closed 7 years ago

spott commented 7 years ago

There are no ;;;#autoload markers for platformio-setup-compile-buffer and platformio-conditionally-enable

I'm not sure if they are necessary for platformio-build etc though.

Which makes it so the whole file must be loaded anyways.

ZachMassia commented 7 years ago

I'll look into ;;;#autoload and use-package this weekend to try and optimize things.

Thanks @spott.

spott commented 7 years ago

I think you can just put ;;;#autoload in front of the two functions you call lazily (the conditional load one and the compilation window one), The platformio-xxx functions (build,clean etc.) will be loaded when the keymap is loaded when the mode is turned on.

But I am far from an elisp master. I just figured this out while making a platformio layer for spacemacs. See here for my implementation of the layer. If you want to publish this in the git I can make a pull request.

On Oct 5 2016, at 2:41 pm, Zach Massia notifications@github.com wrote:

I'll look into ;;;#autoload and use-package this weekend to try and optimize things.

Thanks @spott.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

ZachMassia commented 7 years ago

Hey @spott,

Sorry for not getting back to you on this sooner.

I've actually had to somewhat declare .emacs.d bankruptcy. For some reason once I moved to Emacs 25 my setup with cask/pallet completely crapped out.

I've actually been working on re-writing my config using use-package.

I'm not opposed to adding the autoload comments, but I want to make sure they're actually needed.

I've currently got things working without them. Here is the C++/PlatformIO section from my config.

Since the call to (platformio-setup-compile-buffer) is called from the use-package :config section, the file has already been loaded.

Adding (platformio-conditionally-enable) to the :commands section will actually create an auto-load for it automatically. From what I've read on the use-package docs, any command that you may use as an entry-point should be added to that section.

As for your spacemacs layer, while I don't really know much about writing one, I think adding (platformio-conditionally-enable) to the :commands section should save you from having to redefine it (at least I think that's why you're doing that).

I think you can drop the (progn ...) as the :init and :config keywords accept one or more forms, up until the next keyword. Should save some indentation :)

spott commented 7 years ago

Thanks! I wasn't able to find info on the ":commands" section.

I'll look into changing that.

ZachMassia commented 7 years ago

No problem. It's kind of hidden under the key binding section.