summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-03-12 22:31:41 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-03-12 22:32:42 +0100
commitd1ae8a072d5de600d24409ed1c02c6fdf95b566c (patch)
tree32222ebc4ce2794e8c8a41c6758d96cbc58a1421
parent96fc760e1361cd90b627dc67a35296851bc07bd1 (diff)
downloadmemory-leaks-d1ae8a072d5de600d24409ed1c02c6fdf95b566c.tar.xz
Add notes about "action stamps"
-rw-r--r--itches/emacs/development.org50
1 files changed, 48 insertions, 2 deletions
diff --git a/itches/emacs/development.org b/itches/emacs/development.org
index b151179..91a0109 100644
--- a/itches/emacs/development.org
+++ b/itches/emacs/development.org
@@ -1,7 +1,7 @@
Stuff that could make work on Emacs itself more smooth.
* Changelog
-** action-stamps
+** Action stamps
I don't know any function to
1. generate them from a Git commit, a *vc-change-log* buffer…
@@ -23,8 +23,54 @@ Except that [[https://tools.ietf.org/html/rfc3339][RFC3339]] says:
While ~%z~ yields "+hhmm" or "-hhmm". Also [[http://esr.ibiblio.org/?p=3872][ESR wants Zulu time]].
-See bug#20609.
+See also
+- bug#20609
+- https://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00252.html
+This monstrosity does the job:
+#+begin_src elisp
+(defun my/revision-at-point ()
+ (cond
+ ;; TODO: add vc support.
+ ((derived-mode-p 'magit-mode)
+ (magit-branch-or-commit-at-point))))
+
+(eval-when-compile
+ ;; Load rx's pcase pattern.
+ (require 'rx))
+
+(defun my/action-stamp-at-point (rev)
+ (interactive
+ (list
+ (let* ((rev (my/revision-at-point))
+ (prompt (if rev (format "Revision? (%s) " rev) "Revision? ")))
+ (read-string prompt nil nil rev))))
+ (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))))))
+#+end_src
+
+ESR's =git stamp= alias in [[https://gitlab.com/esr/reposurgeon/-/blob/4.5/reposurgeon-git-aliases][reposurgeon]]:
+#+begin_src conf
+ # git stamp <commit-ish> - print a reposurgeon-style action stamp
+ # This always goes to the committer. It would be better to look at thwe author
+ # timestamp first and fall back to commmitter, because the author stamp because
+ # doesn't change when patches are replayed onto a repository, while the commit
+ # stamp will.
+ stamp = show -s --format='%cI!%ce'
+#+end_src
+This alias seems to confirm my feeling that Zulu time is not worth
+bothering with: ISO 8601 is just as machine-parseable, and the
+timezone bit actually conveys meaning to a human reader.
* Bug tracker
** Asynchronous client
It would be wonderful if ~debbugs-gnu~ and ~debbugs-gnu-search~ used