From b6274a20e8e99fa6287264289da42ed364fc976c Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Tue, 30 Aug 2022 16:57:32 +0200 Subject: etc: Add tempel snippet move. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/snippets/tempel/text-mode (move\): New entry. Signed-off-by: Ludovic Courtès --- etc/snippets/tempel/text-mode | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'etc/snippets') diff --git a/etc/snippets/tempel/text-mode b/etc/snippets/tempel/text-mode index a1400aac69..8096d92e47 100644 --- a/etc/snippets/tempel/text-mode +++ b/etc/snippets/tempel/text-mode @@ -99,3 +99,20 @@ text-mode :when (and (fboundp 'git-commit-mode) (git-commit-mode)) ": 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) + +(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 " + (concat "(" + (string-replace "\.scm" "" + (string-replace "/" " " (car (magit-staged-files)))) + ").") n + n "* " (car (magit-staged-files)) " (" (s var) "): Move from here…" + n "* " (cadr (magit-staged-files)) " (" (s var) "): …to here.") -- cgit v1.2.3