abo-abo / auto-yasnippet

quickly create disposable yasnippets
246 stars 15 forks source link

Add snippet persistence for an auto-yasnippet #6

Closed jasonm23 closed 9 years ago

jasonm23 commented 9 years ago

Also reformatted README (also added notes on auto snippet persistence)

abo-abo commented 9 years ago

Thanks! I had to gut your code slightly to make it more stylish. You can review the changes and ask me questions if there are any.

jasonm23 commented 9 years ago

Did you start a new branch/pr to make the changes?

jasonm23 commented 9 years ago

I specifically wrote this feature to avoid an unwanted buffer. It's trivial to have it persist and be loaded automatically, ie. thru a wrapper function. eg. aya-persist-and-activate.

I'd much rather be given feedback on how you want it to work and make that happen for you while retaining the functionality as I wrote it.

jasonm23 commented 9 years ago

Similarly editing an existing snippet (or the newly created one) would be better done by a different feature.

The purpose of this is to stay out of the way and let you get on with the next snippet with minimal interruption.

abo-abo commented 9 years ago

Similarly editing an existing snippet (or the newly created one) would be better done by a different feature.

The purpose of this is to stay out of the way and let you get on with the next snippet with minimal interruption.

I like this approach. Yasnippet's C-c C-c will load the snippet and kill the buffer.

There's too much magic in your approach, it's not apparent what has been done. Doing it my way, nothing is done until user does C-x C-s C-c C-c.

abo-abo commented 9 years ago

You can customize aya-insert-snippet-function as you like. If you want, I'll merge modifications to aya-insert-snippet-function-extra. aya-insert-snippet-function-default will remain the default behavior.

jasonm23 commented 9 years ago

Sounds like a plan.

jasonm23 commented 9 years ago

I've had a think and I feel that these to methods of yasnippet creation are both valid, and useful within the same workflow.

For myself, often I will just want to create the new yasnippet without interruption, and on occasion I'd need to make some edits.

As such, having to re-configure the function used for a single command, totally derails such a workflow. Obviously what we want in a package is reduction of tedium and disruption, so I've made these features separate commands.

I'll create a new PR shortly.