Conversation
|
I am not sure if depending on |
|
Wow, I like the possibilities very much. code:
I tried quickly:
more feedback:
definitely IMO. (cl-template has 0 dependencies) |
I think the next thing I will make will be a snippets system, which hopefully will cover most of the other features you want. |
|
Oh, I found the interactive command useful. I think it just needed one or two checks and "message"s more. (yes no need to pull an arrow macro dependency; maybe not use |
|
Okay, I have added the option to use named templates, if there are multiple templates registered for a pattern, it prompts the user to choose one, otherwise it automatically uses the only one there is. (lem-template:register-templates
(:pattern ".*\.asd"
:name "Basic ASD"
:file (merge-pathnames "templates/asd.clt" (lem-home)))
(:pattern ".*\.asd"
:name "Test ASD"
:file (merge-pathnames "templates/test.asd.clt" (lem-home)))
(:pattern ".*\.lisp"
:file (merge-pathnames "templates/lisp.clt" (lem-home))))Here there are two named options for Screencast.from.2024-01-29.18-27-33.webmI will spend some time cleaning up and testing more today. |
|
Added You can use a file, like with templates, or just a string if its small. (register-snippets
(:mode 'lem-lisp-mode:lisp-mode
:name "test"
:string "(message \"testing\")")
(:mode 'lem-lisp-mode:lisp-mode
:name "hi"
:string "(message \"hi\")")
(:mode 'lem-go-mode:go-mode
:name "loop"
:file (merge-pathnames "snippets/loop.go.clt" (lem-home)))
(:mode 'lem-go-mode:go-mode
:name "err"
:file (merge-pathnames "snippets/if-err.go.clt" (lem-home))))snippets.webm |
|
Awesome. minor:
|
|
This is very interesting. I'd like to see this getting merged to lem main branch someday. |
|
What prevents this from being merged? Are you still planning to work on this @garlic0x1 ? And if not, what would be required for this to be of mergable quality? |
|
I use Emacs these days and will not be working on this PR. Anyone else is free to take over. |
|
I'm happy to take this over. Possibly easier if I create a new pull request. Let me know @vindarel |
|
This pull request has been inactive for {days} days. If there is no activity within the next 7 days, it will be automatically closed. Please comment or push new commits to keep it open. |
lem-template
A templating extension to generate boilerplate in new files.
Usage
Here is an example template file that generates a simple
.asdto help get you started.Assuming this file exists in
~/.config/lem/templates/asd.clt, you can register it like this:You can create any kind of template you want in the cl-template format,
bufferandpathare passed to the template and you can read it with(@ buffer)etc.Examples
See my templates for more examples, I used the plural
register-templatesto register them like this: