summaryrefslogtreecommitdiff
path: root/itches/emacs/development.org
blob: ce9b58907f4a5fd39d074e18175094ffd905a985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Stuff that could make work on Emacs itself more smooth.

* Changelog
** Action stamps
I don't know any function to

1. generate them from a Git commit, a *vc-change-log* buffer…
2. convert them back to a Git commit, a *vc-diff* buffer…

They can almost be generated with:

#+BEGIN_SRC sh
git show --no-patch              \
         --date=format:"%FT%T%z" \
         --format=format:"%ad!%ae"
#+END_SRC

Except that [[https://tools.ietf.org/html/rfc3339][RFC3339]] says:

#+BEGIN_QUOTE
   time-numoffset  = ("+" / "-") time-hour ":" time-minute
#+END_QUOTE

While ~%z~ yields "+hhmm" or "-hhmm".  Also [[http://esr.ibiblio.org/?p=3872][ESR wants Zulu time]].

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
their own thread/process to wait & process the server's response,
instead of forcing me to twiddle my thumbs for minutes.
* Mailing lists
** Message IDs
*** Summary buffer → Message-ID
#+begin_src elisp
(kill-new (mail-header-message-id (gnus-summary-article-header)))
#+end_src
*** TODO Message-ID → HTTP archive
- <https://lists.gnu.org>:
  #+begin_example
  https://lists.gnu.org/archive/cgi-bin/namazu.cgi
      ?query=%2Bmessage-id:<$MESSAGE_ID>
      &submit=Search!
      &idxname=$LIST
  #+end_example
- public-inbox: trivial
*** TODO HTTP archive → Message-ID
- <https://lists.gnu.org>: cf. =X-Message-Id= comment in HTML
- public-inbox: cf. URL