add yas-oneshot for quick snippet creation #350

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@lewang

I had this laying around in my personal config for a long time, thought others might find it useful.

Documentation included. This does something similar to #309, but allows for the possibility of adding placeholders.

@joaotavora
Owner

This is very interesting after playing around with it. I would like to see this integrated in yasnippet.el.

  • I like a lot that yas-oneshot varies behaviour depending on whether there is a region selected or not. Also like the name 👍

  • it is missing more documentation. It should pass the M-x checkdoc command.

  • Need some unit tests for the basic cases. See yasnippet-tests.el

  • invoking yas-oneshot should highlight the symbols selected for placeholders in the active region. If this is difficult to implement, don't worry a lot about it.

  • There should be a yas-offer-to-save-one-shots customization variable (and this would mean integration with #309). When set to t and when the user is done, it should pop to a new-snippet buffer, with the snippet neatly setup and ready to press C-c C-c for loading the snippet into whichever mode the user chooses.

  • Also the messages presented to the user should be a little clearer and be preceded by "[yas]". It should be clearer that inputting nothing means "I'm done"

  • Discovered that there was a serious bug in yas-reload-all, where it reset yas-minor-mode-map.I fixed this is 1ef0091, so now you can use eval-after-load. However, if this is to be integrated in yasnippet.el it is not needed.

@lewang

Thanks for checking it out. Yous points all seem valid, I'll make the changes soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment