diff options
author | Nicolas Graves <[email protected]> | 2024-09-14 16:47:16 +0200 |
---|---|---|
committer | jgart <[email protected]> | 2024-09-21 11:05:36 -0500 |
commit | e602b799fb751ab74eb6fe6d395905a962785085 (patch) | |
tree | 1d239ce5e6b3aa5f33a63cd6330bb73b5fe439c1 /etc/snippets/tempel/text-mode.eld | |
parent | 730b1f0768884b0c4d2b53203b87d726d02d19da (diff) |
.dir-locals.el: Add tempel snippets.
Change-Id: Ic16f571f26fffee12e478e00c54be55e6eb90831
Signed-off-by: jgart <[email protected]>
Diffstat (limited to 'etc/snippets/tempel/text-mode.eld')
-rw-r--r-- | etc/snippets/tempel/text-mode.eld | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/etc/snippets/tempel/text-mode.eld b/etc/snippets/tempel/text-mode.eld new file mode 100644 index 0000000000..397221b846 --- /dev/null +++ b/etc/snippets/tempel/text-mode.eld @@ -0,0 +1,156 @@ +text-mode :when (bound-and-true-p 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 + "* " (p (or (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 + "* " (p (or (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 + "* " (p (or (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 + "* " (p (or (car (magit-staged-files)) "")) " (" (s var) "): " + "Update to " (s version) "." n + (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 + "* " (p (or (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 + "* " (p (or (car (magit-staged-files)) "")) + " (" (s var) ")[home-page]: Use HTTPS." + n + (mapconcat (lambda (file) (concat "* " file)) + (cdr (magit-staged-files)) + "\n")) + +(move\ "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) + ": Move to (" + (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (and + (re-search-forward "\\+(define-public \\(\\S-+\\)" + nil 'noerror) + (re-search-backward "modified[ ]*\\(\\S-+\\)" + nil 'noerror)) + (string-replace + "\.scm" "" + (string-replace "/" " " + (match-string-no-properties 1))))) + new-module) + ")." n + n + "* " (p (with-temp-buffer + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--staged") + (goto-char (point-min)) + (when (and + (re-search-forward "\\-(define-public \\(\\S-+\\)" + nil 'noerror) + (re-search-backward "modified[ ]*\\(\\S-+\\)" + nil 'noerror)) + (match-string-no-properties 1))) + source) + " (" (s var) "): Move from here…" n + "* " (concat (string-replace " " "/" new-module) ".scm") + " (" (s var) "): …to here.") |