diff options
author | Nicolas Graves <ngraves@ngraves.fr> | 2022-08-12 10:58:48 +0200 |
---|---|---|
committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2022-08-30 11:50:14 +0200 |
commit | c4acaf412064568a546034871a9e0d3888aa7937 (patch) | |
tree | 5e7bded5fd11b96dc65627b54942f6da5792abf8 /etc | |
parent | 6beadc82df204f315d06ea35f2e232bb32f8e440 (diff) | |
download | guix-c4acaf412064568a546034871a9e0d3888aa7937.tar guix-c4acaf412064568a546034871a9e0d3888aa7937.tar.gz |
etc: Add tempel snippets.
* etc/snippets/tempel/scheme-mode: New file.
* etc/snippets/tempel/text-mode: New file.
* etc/snippets/scheme-mode: Moved from here...
* etc/snippets/yas/scheme-mode: ... to here.
* etc/snippets/text-mode: Moved from here...
* etc/snippets/yas/text-mode: ... to here.
* doc/contributing.texi ("The Perfect Setup"): Adjust yasnippet setup
accordingly. Add tempel setup.
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/snippets/tempel/scheme-mode | 80 | ||||
-rw-r--r-- | etc/snippets/tempel/text-mode | 101 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-bzr-reference (renamed from etc/snippets/scheme-mode/guix-bzr-reference) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-cvs-reference (renamed from etc/snippets/scheme-mode/guix-cvs-reference) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-git-reference (renamed from etc/snippets/scheme-mode/guix-git-reference) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-hg-reference (renamed from etc/snippets/scheme-mode/guix-hg-reference) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-origin (renamed from etc/snippets/scheme-mode/guix-origin) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-package (renamed from etc/snippets/scheme-mode/guix-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/scheme-mode/guix-svn-reference (renamed from etc/snippets/scheme-mode/guix-svn-reference) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-add-cl-package (renamed from etc/snippets/text-mode/guix-commit-message-add-cl-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-add-package (renamed from etc/snippets/text-mode/guix-commit-message-add-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-remove-package (renamed from etc/snippets/text-mode/guix-commit-message-remove-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-rename-package (renamed from etc/snippets/text-mode/guix-commit-message-rename-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-update-package (renamed from etc/snippets/text-mode/guix-commit-message-update-package) | 0 | ||||
-rw-r--r-- | etc/snippets/yas/text-mode/guix-commit-message-use-https-home-page (renamed from etc/snippets/text-mode/guix-commit-message-use-https-home-page) | 0 |
15 files changed, 181 insertions, 0 deletions
diff --git a/etc/snippets/tempel/scheme-mode b/etc/snippets/tempel/scheme-mode new file mode 100644 index 0000000000..74157e098a --- /dev/null +++ b/etc/snippets/tempel/scheme-mode @@ -0,0 +1,80 @@ +-*- mode: lisp-data -*- + +scheme-mode + +(package... + "(define-public " (s name) + n> "(package" + n > "(name \"" (s name) "\")" + n > "(version \"" p "\")" + n > "(source origin...)" + n > "(build-system " (p "gnu") "-build-system)" + n > "(home-page \"" p "\")" + n > "(synopsis \"" p "\")" + n > "(description \"" p "\")" + n > "(license license:" (p "unknown") ")))" n) + +(origin... + "(origin" + n> "(method " (p "url-fetch" method) ")" + n> "(uri " (cl-case (and method (intern method)) + ('git-fetch "git-reference...") + ('svn-fetch "svn-reference...") + ('hg-fetch "hg-reference...") + ('cvs-fetch "cvs-reference...") + ('bzr-fetch "bzr-reference...") + (t "\"https://...\"")) + ")" + n> + (cl-case (and method (intern method)) + ('git-fetch + (insert "(file-name (git-file-name name version))") + (newline) + (indent-according-to-mode)) + ('hg-fetch + (insert "(file-name (hg-file-name name version))") + (newline) + (indent-according-to-mode)) + ('svn-fetch + (insert "(file-name (string-append name \"-\" version \"-checkout\"))") + (newline) + (indent-according-to-mode)) + ('cvs-fetch + (insert "(file-name (string-append name \"-\" version \"-checkout\"))") + (newline) + (indent-according-to-mode)) + ('bzr-fetch + (insert "(file-name (string-append name \"-\" version \"-checkout\"))") + (newline) + (indent-according-to-mode)) + (t "")) + > "(sha256" + n > "(base32 \"" + ;; hash of an empty directory + (p "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5") "\")))") + +(git-reference... + "(git-reference" + n> "(url \"" p "\")" + n> "(commit \"" p "\"))") + +(svn-reference... + "(svn-reference" + n> "(url \"" p "\")" + n> "(revision \"" p "\"))") + +(cvs-reference... + "(cvs-reference" + n> "(root-directory \"" p "\")" + n> "(module \"" p "\")" + n> "(revision \"" p "\"))") + +(hg-reference... + "(hg-reference" + n> "(url \"" p "\")" + n> "(changeset \"" p "\"))") + +(bzr-reference... + "(bzr-reference" + n> "(url \"" p "\")" + n> "(revision \"" p "\"))") diff --git a/etc/snippets/tempel/text-mode b/etc/snippets/tempel/text-mode new file mode 100644 index 0000000000..a1400aac69 --- /dev/null +++ b/etc/snippets/tempel/text-mode @@ -0,0 +1,101 @@ +-*- mode: lisp-data -*- + +text-mode :when (and (fboundp 'git-commit-mode) (git-commit-mode)) + +(add\ + "gnu: Add " + (p + (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (re-search-forward "\\+(define-public \\(\\S-+\\)" nil 'noerror) + (match-string-no-properties 1))) + var ) "." n n + "* " (car (magit-staged-files)) " (" (s var ) "): New variable.") + +(remove\ + "gnu: Remove " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (re-search-forward "\\-(define-public \\(\\S-+\\)" nil 'noerror) + (match-string-no-properties 1))) + var) "." n n + "* " (car (magit-staged-files)) " (" (s var) "): Delete variable.") + +(rename\ + "gnu: " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (beginning-of-buffer) + (when (search-forward "-(define-public " nil 'noerror) + (thing-at-point 'sexp 'no-properties))) + prev-var) + ": Rename package to " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (beginning-of-buffer) + (when (search-forward "+(define-public " nil 'noerror) + (thing-at-point 'sexp 'no-properties))) + new-var) "." n n + "* " (car (magit-staged-files)) " (" (s prev-var) "): Define in terms of" n + "'deprecated-package'." n + "(" (s new-var) "): New variable, formerly known as \"" (s prev-var) "\".") + +(update\ + "gnu: " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (re-search-forward "^[ ]*(define-public \\(\\S-+\\)" nil 'noerror) + (match-string-no-properties 1))) + var) + ": Update to " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (search-forward "name" nil 'noerror) + (search-forward "+" nil 'noerror) ; first change + (when (and (search-forward "version " nil 'noerror) + (looking-at-p "\"")) + (let ((end (save-excursion (search-forward "\")" nil 'noerror)))) + (when end + (forward-char) + (buffer-substring-no-properties (point) (- end 2)))))) + version) "." n n + "* " (car (magit-staged-files)) " (" (s var) "): Update to " (s version) "." + (mapconcat (lambda (file) (concat "* " file)) (cdr (magit-staged-files))) n) + +(addcl\ + "gnu: Add cl-" + (p (replace-regexp-in-string + "^cl-" "" (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (beginning-of-buffer) + (when (search-forward "+(define-public " nil 'noerror) + (replace-regexp-in-string + "^sbcl-" "" + (thing-at-point 'sexp 'no-properties))))) + var) "." n n + "* " (car (magit-staged-files)) + " (cl-" (s var) ", ecl-" (s var) ", sbcl-" (s var) "): New variables.") + +(https\ + "gnu: " + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (re-search-forward "^[ ]*(define-public \\(\\S-+\\)" nil 'noerror) + (match-string-no-properties 1))) + var) + ": Use HTTPS home page." n n + "* " (car (magit-staged-files)) " (" (s var) ")[home-page]: Use HTTPS." n + (mapconcat (lambda (file) (concat "* " file)) (cdr (magit-staged-files))) n) diff --git a/etc/snippets/scheme-mode/guix-bzr-reference b/etc/snippets/yas/scheme-mode/guix-bzr-reference index a801cc36f2..a801cc36f2 100644 --- a/etc/snippets/scheme-mode/guix-bzr-reference +++ b/etc/snippets/yas/scheme-mode/guix-bzr-reference diff --git a/etc/snippets/scheme-mode/guix-cvs-reference b/etc/snippets/yas/scheme-mode/guix-cvs-reference index fbc5034b66..fbc5034b66 100644 --- a/etc/snippets/scheme-mode/guix-cvs-reference +++ b/etc/snippets/yas/scheme-mode/guix-cvs-reference diff --git a/etc/snippets/scheme-mode/guix-git-reference b/etc/snippets/yas/scheme-mode/guix-git-reference index 29ca6a9c54..29ca6a9c54 100644 --- a/etc/snippets/scheme-mode/guix-git-reference +++ b/etc/snippets/yas/scheme-mode/guix-git-reference diff --git a/etc/snippets/scheme-mode/guix-hg-reference b/etc/snippets/yas/scheme-mode/guix-hg-reference index 95de16daae..95de16daae 100644 --- a/etc/snippets/scheme-mode/guix-hg-reference +++ b/etc/snippets/yas/scheme-mode/guix-hg-reference diff --git a/etc/snippets/scheme-mode/guix-origin b/etc/snippets/yas/scheme-mode/guix-origin index eb0cdc8242..eb0cdc8242 100644 --- a/etc/snippets/scheme-mode/guix-origin +++ b/etc/snippets/yas/scheme-mode/guix-origin diff --git a/etc/snippets/scheme-mode/guix-package b/etc/snippets/yas/scheme-mode/guix-package index 9ff6f997d1..9ff6f997d1 100644 --- a/etc/snippets/scheme-mode/guix-package +++ b/etc/snippets/yas/scheme-mode/guix-package diff --git a/etc/snippets/scheme-mode/guix-svn-reference b/etc/snippets/yas/scheme-mode/guix-svn-reference index 7d897dc690..7d897dc690 100644 --- a/etc/snippets/scheme-mode/guix-svn-reference +++ b/etc/snippets/yas/scheme-mode/guix-svn-reference diff --git a/etc/snippets/text-mode/guix-commit-message-add-cl-package b/etc/snippets/yas/text-mode/guix-commit-message-add-cl-package index e255736b05..e255736b05 100644 --- a/etc/snippets/text-mode/guix-commit-message-add-cl-package +++ b/etc/snippets/yas/text-mode/guix-commit-message-add-cl-package diff --git a/etc/snippets/text-mode/guix-commit-message-add-package b/etc/snippets/yas/text-mode/guix-commit-message-add-package index 7cebd4023a..7cebd4023a 100644 --- a/etc/snippets/text-mode/guix-commit-message-add-package +++ b/etc/snippets/yas/text-mode/guix-commit-message-add-package diff --git a/etc/snippets/text-mode/guix-commit-message-remove-package b/etc/snippets/yas/text-mode/guix-commit-message-remove-package index 0c1050f4fe..0c1050f4fe 100644 --- a/etc/snippets/text-mode/guix-commit-message-remove-package +++ b/etc/snippets/yas/text-mode/guix-commit-message-remove-package diff --git a/etc/snippets/text-mode/guix-commit-message-rename-package b/etc/snippets/yas/text-mode/guix-commit-message-rename-package index 9695ca1b3d..9695ca1b3d 100644 --- a/etc/snippets/text-mode/guix-commit-message-rename-package +++ b/etc/snippets/yas/text-mode/guix-commit-message-rename-package diff --git a/etc/snippets/text-mode/guix-commit-message-update-package b/etc/snippets/yas/text-mode/guix-commit-message-update-package index b08df74a0b..b08df74a0b 100644 --- a/etc/snippets/text-mode/guix-commit-message-update-package +++ b/etc/snippets/yas/text-mode/guix-commit-message-update-package diff --git a/etc/snippets/text-mode/guix-commit-message-use-https-home-page b/etc/snippets/yas/text-mode/guix-commit-message-use-https-home-page index df20d31a80..df20d31a80 100644 --- a/etc/snippets/text-mode/guix-commit-message-use-https-home-page +++ b/etc/snippets/yas/text-mode/guix-commit-message-use-https-home-page |