Discussion:
Snippets for working on Guix
(too old to reply)
Ricardo Wurmus
2017-12-14 23:48:14 UTC
Permalink
Raw Message
Hi Guix,

to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.

These snippets are available:

./scheme-mode/guix-package
./scheme-mode/guix-origin
./scheme-mode/guix-git-reference
./scheme-mode/guix-hg-reference
./scheme-mode/guix-cvs-reference
./scheme-mode/guix-svn-reference
./text-mode/guix-commit-message-add-package
./text-mode/guix-commit-message-update-package

The snippets in the “scheme-mode” directory are used to define new
packages. Enable yas-global-mode and type “package...<TAB>” to get a
package skeleton. Hit <TAB> to jump to the next field to complete it.
You can also select a build system from a list.

At last you end up at “origin...”; when you hit <TAB> it will expand
the “guix-origin” snippet, which allows you to select a fetch method
from a list. As the last step you end up at the “uri” field, which may
be further expandable with “guix-git-reference”, “guix-hg-reference”,
“guix-cvs-reference”, or “guix-svn-reference”.

The “text-mode” snippets are for commit messages. They use magit to
get the names of staged files. You can use “add<TAB>” to create a
commit message for adding a package, or “update<TAB>” to create a
message for updating a package.

These commit message snippets aren’t very smart, because it isn’t
trivial to reliably infer the kind of change from just the staged hunk.
With some more work one might be able to detect a version number change
and the name of the package that has been updated.

I hope this is useful for some of you!
Ludovic Courtès
2017-12-15 14:58:04 UTC
Permalink
Raw Message
Hi!
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
./scheme-mode/guix-package
./scheme-mode/guix-origin
./scheme-mode/guix-git-reference
./scheme-mode/guix-hg-reference
./scheme-mode/guix-cvs-reference
./scheme-mode/guix-svn-reference
./text-mode/guix-commit-message-add-package
./text-mode/guix-commit-message-update-package
That looks really useful!

Do you think we could add them under etc/emacs in the repo, and somehow
have them automatically available? Or should it be in Emacs-Guix?

Thanks,
Ludo’.
Ricardo Wurmus
2017-12-15 16:20:06 UTC
Permalink
Raw Message
Hi Ludo,
Post by Ludovic Courtès
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
./scheme-mode/guix-package
./scheme-mode/guix-origin
./scheme-mode/guix-git-reference
./scheme-mode/guix-hg-reference
./scheme-mode/guix-cvs-reference
./scheme-mode/guix-svn-reference
./text-mode/guix-commit-message-add-package
./text-mode/guix-commit-message-update-package
That looks really useful!
Do you think we could add them under etc/emacs in the repo, and somehow
have them automatically available? Or should it be in Emacs-Guix?
Sure. To use them you’d only have to add the directory to
“yas-snippets-dirs”. I’ll document this in contributing.texi.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
Arun Isaac
2017-12-16 06:14:45 UTC
Permalink
Raw Message
Post by Ludovic Courtès
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
./scheme-mode/guix-package
./scheme-mode/guix-origin
./scheme-mode/guix-git-reference
./scheme-mode/guix-hg-reference
./scheme-mode/guix-cvs-reference
./scheme-mode/guix-svn-reference
./text-mode/guix-commit-message-add-package
./text-mode/guix-commit-message-update-package
That looks really useful!
Indeed, this is very useful! :-)
Post by Ludovic Courtès
Do you think we could add them under etc/emacs in the repo, and somehow
have them automatically available? Or should it be in Emacs-Guix?
It would be nice if this was available automatically through emacs-guix.

Apart from the snippets, it would also be nice to somehow automatically
update a package definition -- that is, change the version number,
download the new source, and update the hash. I was trying to work this
out. I was able to get the Guix REPL to download the new source tarball,
but couldn't figure out how to retrieve the new hash from the Guix
REPL. Any pointers?
Ricardo Wurmus
2017-12-16 10:21:57 UTC
Permalink
Raw Message
Post by Arun Isaac
Post by Ludovic Courtès
Do you think we could add them under etc/emacs in the repo, and somehow
have them automatically available? Or should it be in Emacs-Guix?
It would be nice if this was available automatically through emacs-guix.
I think snippets should not be available automatically. Some really
hate snippets or prefer a different system over YASnippet. The setup is
*very* simple if you’re already using yasnippet anyway: just add the
directory to “yas-snippet-dirs” and you’re done.
Post by Arun Isaac
Apart from the snippets, it would also be nice to somehow automatically
update a package definition -- that is, change the version number,
download the new source, and update the hash.
This is implemented as “guix refresh -u foo”. It works for any package
that is covered by an updater.
--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
Arun Isaac
2017-12-16 15:58:09 UTC
Permalink
Raw Message
Post by Ricardo Wurmus
Post by Arun Isaac
Post by Ludovic Courtès
Do you think we could add them under etc/emacs in the repo, and somehow
have them automatically available? Or should it be in Emacs-Guix?
It would be nice if this was available automatically through emacs-guix.
I think snippets should not be available automatically. Some really
hate snippets or prefer a different system over YASnippet. The setup is
*very* simple if you’re already using yasnippet anyway: just add the
directory to “yas-snippet-dirs” and you’re done.
Ok, that makes sense.
Post by Ricardo Wurmus
Post by Arun Isaac
Apart from the snippets, it would also be nice to somehow automatically
update a package definition -- that is, change the version number,
download the new source, and update the hash.
This is implemented as “guix refresh -u foo”. It works for any package
that is covered by an updater.
Oh, I didn't know about this. This is very useful. Thanks!

Maxim Cournoyer
2017-12-16 03:17:07 UTC
Permalink
Raw Message
Hi Ricardo!
Post by Ricardo Wurmus
Hi Guix,
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
./scheme-mode/guix-package
./scheme-mode/guix-origin
./scheme-mode/guix-git-reference
./scheme-mode/guix-hg-reference
./scheme-mode/guix-cvs-reference
./scheme-mode/guix-svn-reference
./text-mode/guix-commit-message-add-package
./text-mode/guix-commit-message-update-package
This is pretty fun and useful too! It seems a cleaner approach to the
copy-pasting of previous packages I'm sure many of us are doing ;).

Thanks for sharing!

Maxim
Chris Marusich
2017-12-16 08:15:21 UTC
Permalink
Raw Message
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
Thank you very much!
Post by Ricardo Wurmus
I hope this is useful for some of you!
I am very interested in trying this out. However, as someone who has
never used yasnippet, I think it would be extremely helpful if you could
provide a simple example of what to do in the manual somewhere under the
"Contributing" section. And that way, it's more likely people will
discover and use these snippets.
--
Chris
Ricardo Wurmus
2017-12-16 08:59:09 UTC
Permalink
Raw Message
Post by Chris Marusich
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
Thank you very much!
Post by Ricardo Wurmus
I hope this is useful for some of you!
I am very interested in trying this out. However, as someone who has
never used yasnippet, I think it would be extremely helpful if you could
provide a simple example of what to do in the manual somewhere under the
"Contributing" section. And that way, it's more likely people will
discover and use these snippets.
It’s already there, but due to a bug, the manual won’t be rebuilt when
“contributing.texi” has changed. As a work-around just touch
“doc/guix.texi” and then run “make info”.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
Chris Marusich
2017-12-16 09:03:45 UTC
Permalink
Raw Message
Post by Chris Marusich
Post by Ricardo Wurmus
to avoid the need to type out boilerplate I wrote a couple of snippets
that can be used with yasnippet in Emacs, and I thought I should share
them with you.
Thank you very much!
Post by Ricardo Wurmus
I hope this is useful for some of you!
I am very interested in trying this out. However, as someone who has
never used yasnippet, I think it would be extremely helpful if you could
provide a simple example of what to do in the manual somewhere under the
"Contributing" section. And that way, it's more likely people will
discover and use these snippets.
It’s already there, but due to a bug, the manual won’t be rebuilt when
“contributing.texi” has changed. As a work-around just touch
“doc/guix.texi” and then run “make info”.
Oh, awesome! I will check it out.
--
Chris
Loading...