Crandel / tempel-collection

Collection tempel templates
GNU General Public License v3.0
71 stars 24 forks source link

Standards and conventions #43

Open ispringle opened 9 months ago

ispringle commented 9 months ago

First, thanks for starting this project. I am on the hunt for minimalist packages that still provide robust features but use emacs API when possible. To replace yas, Tempel seemed like a nature choice but it is lacking in templates. I wrote a number of mine own only to find your collection had a significant overlap and I've switched to your collection. I see that in the past a few people have brought up migration efforts to rewrite yas collection snippets for tempel. I've started some work on this myself and am at a point where I wanted to get some input.

Do you have any conventions or standards when it comes to writing completions? I'm asking broadly however I am thinking more specifically about the :post commands. For example in org templates I love templates that call out to open a new buffer in the specified mode. However I can also see that there will inevitably be people who use your collections that will not want this feature and prefer if the snippets merely expand.

Another thought I had was, would you be interested in including custom elements in this repo? I'm thinking like a set of useful elements that can then be used in both the tempel-collection snippets as well as being leveraged by users for their own custom snippets.

There are also a number of duplicate snippets, but with different triggers. I'm wondering if maybe there should just a single trigger word for each snippet or perhaps integrate a custom element that can expand the snippet, this way each snippet is only written in one place but can be "aliased". Thus lowering the duplication of code.

Third, this repo could use the love and attention, and with October around the corner it might be a good idea to set the GH repo tags/keywords to mark this project as accepting Hacktober contributions. The guidelines for maintainers are here. If tagging this repo does bring in an influx of PRs I'd be happy to assist in triage/review of those as well, I wouldn't want you to do this and then get stuck with a huge amount of extra work!

Crandel commented 9 months ago

Do you have any conventions or standards when it comes to writing completions?

I did it first time for my personal usage, so unless you want to change already existing templates, to which I already used, I have no issues.

I'm asking broadly however I am thinking more specifically about the :post commands.

I don't know such command. Is it from tempel?

Another thought I had was, would you be interested in including custom elements in this repo?

If they will produce the same output from already existing templates, I'm fine.

There are also a number of duplicate snippets, but with different triggers.

Would be nice to see some examples here and possible improvements.

GH repo tags/keywords to mark this project as accepting Hacktober contributions.

I had no idea about Hacktoberfest. As of contributions, I just opensorse my template collection I created long time ago, when I decided to switch from yas to tempel. I'm Go developer and using lisp only for configuring Emacs. It would be hard for me to actively develop this project, as I have not enough knowledge for this.

ispringle commented 9 months ago

I don't know such command. Is it from tempel?

Yes the :post is an optional part of a Tempel snippet that will run an emacs function after the snippet has been written. It's used in the orgmode snippets to open the source blocks in a new buffer to edit.

I asked Minad about options to disable the :post via a prefix (C-u) and he suggested either not using :post ever or just making two versions of each snippet. I'm going to work on a custom element for tempel to create aliases for a snippet, so that we can define say foo and then alias it to f or anything else. Should be able to use that alias function to also inject the optional :post onto the base snippet and maybe have a common snippet name for snippets which are more interactive.