dotfiles

🎜 Clone'em, tweak'em, stick'em in your $HOME 🎝
git clone https://git.kevinlegouguec.net/dotfiles
Log | Files | Refs | README

commit b35cd48cd4051a0d7f41aaae15b53208a8caf66a
parent 92b4f8edb2e26f0e38bf664504d8ea773faffae9
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Thu,  9 Jan 2020 15:01:13 +0100

Add a function to create action stamp from Magit buffer

Diffstat:
M.emacs | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/.emacs b/.emacs @@ -195,6 +195,25 @@ ;; in stone, and I would miss out on future updates by Magit. (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell) +(defun my/action-stamp-at-point () + (interactive) + (when-let ((rev (cond + ;; TODO: add vc support. + ((derived-mode-p 'magit-mode) + (magit-branch-or-commit-at-point))))) + (let* ((cmd "git show --no-patch --date=unix --format='%ad!%ae'") + (git-info (shell-command-to-string (format "%s %s" cmd rev)))) + (pcase git-info + ((rx (let timestamp-str (+ digit)) + "!" + (let mail (+ anychar)) + "\n") + (let* ((timestamp (string-to-number timestamp-str)) + (date (format-time-string "%FT%TZ" timestamp t)) + (action-stamp (format "%s!%s" date mail))) + (kill-new action-stamp) + (message action-stamp))))))) + ;; rg re-binds C-n and C-p. I loathe arrow keys for regular movement, ;; and n and p are laggy because they visit the matched files. ;; Since I can't blame anyone for telling me "It's 2019; use the arrow