From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Snippets for working on Guix Date: Fri, 15 Dec 2017 00:48:14 +0100 Message-ID: <87lgi4vpkx.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePdTl-0008EP-0R for guix-devel@gnu.org; Thu, 14 Dec 2017 19:03:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePdTg-0002hX-2H for guix-devel@gnu.org; Thu, 14 Dec 2017 19:03:53 -0500 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ePdTf-0002aP-LQ for guix-devel@gnu.org; Thu, 14 Dec 2017 19:03:48 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 =E2=80=9Cscheme-mode=E2=80=9D directory are used to def= ine new packages. Enable yas-global-mode and type =E2=80=9Cpackage...=E2=80= =9D to get a package skeleton. Hit 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 =E2=80=9Corigin...=E2=80=9D; when you hit it wi= ll expand the =E2=80=9Cguix-origin=E2=80=9D snippet, which allows you to select a fet= ch method from a list. As the last step you end up at the =E2=80=9Curi=E2=80=9D fiel= d, which may be further expandable with =E2=80=9Cguix-git-reference=E2=80=9D, =E2=80=9Cg= uix-hg-reference=E2=80=9D, =E2=80=9Cguix-cvs-reference=E2=80=9D, or =E2=80=9Cguix-svn-reference=E2=80= =9D. The =E2=80=9Ctext-mode=E2=80=9D snippets are for commit messages. They use= magit to get the names of staged files. You can use =E2=80=9Cadd=E2=80=9D to c= reate a commit message for adding a package, or =E2=80=9Cupdate=E2=80=9D to cr= eate a message for updating a package. These commit message snippets aren=E2=80=99t very smart, because it isn=E2= =80=99t 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! --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-package # -*- mode: snippet -*- # name: guix-package # key: package... # -- (define-public $1 (package (name "$1") (version "$2") (source origin...$0) (build-system ${3:$$(yas-choose-value "ant-build-system" "asdf-build-system" "cargo-build-system" "cmake-build-system" "dub-build-system" "emacs-build-system" "font-build-system" "glib-or-gtk-build-system" "gnu-build-system" "go-build-system" "haskell-build-system" "meson-build-system" "minify-build-system" "ocaml-build-system" "perl-build-system" "python-build-system" "r-build-system" "ruby-build-system" "texlive-build-system" "trivial-build-system" "waf-build-system")}) (home-page "$4") (synopsis "$5") (description "$6") (license $7))) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-origin # -*- mode: snippet -*- # name: guix-origin # key: origin... # -- (origin (method ${1:$$(yas-choose-value "url-fetch" "url-fetch/tarbomb" "url-fetch/zipbomb" "cvs-fetch" "git-fetch" "hg-fetch" "svn-fetch")}) (uri ${1:$(cond ((equal yas-text "git-fetch") "git-reference...") ((equal yas-text "svn-fetch") "svn-reference...") ((equal yas-text "hg-fetch") "hg-reference...") ((equal yas-text "cvs-fetch") "cvs-reference...") (t "(string-append \\"https://\\" version \\".tar.gz\\")"))}$0) ${1:$(cond ((member yas-text '("git-fetch" "svn-fetch" "hg-fetch" "cvs-fetch")) "(file-name (string-append name \\"-\\" version \\"-checkout\\"))") (t ""))} (sha256 (base32 "$2"))) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-git-reference # -*- mode: snippet -*- # name: guix-git-reference # key: git-reference... # -- (git-reference (url "$1") (commit ${2:commit})) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-svn-reference # -*- mode: snippet -*- # name: guix-svn-reference # key: svn-reference... # -- (svn-reference (url "$1") (revision ${2:svn-revision})) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-hg-reference # -*- mode: snippet -*- # name: guix-hg-reference # key: hg-reference... # -- (hg-reference (url "$1") (changeset ${2:changeset})) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-cvs-reference # -*- mode: snippet -*- # name: guix-cvs-reference # key: cvs-reference... # -- (cvs-reference (root-directory "${1:root-directory}") (module "${2:module}") (revision "${3:revision}")) --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-commit-message-add-package # -*- mode: snippet -*- # name: guix-commit-message-add-package # key: add # condition: git-commit-mode # -- gnu: Add $1. * `(car (magit-staged-files))` ($1): New variable. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=guix-commit-message-update-package # -*- mode: snippet -*- # name: guix-commit-message-update-package # key: update # condition: git-commit-mode # -- gnu: $1: Update to $2. * `(car (magit-staged-files))` ($1): Update to $2.$0 `(mapconcat (lambda (file) (concat "* " file)) (cdr (magit-staged-files)) "\n")` --=-=-= Content-Type: text/plain -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net --=-=-=--