2017-01-30 Current Emacs version

Edit: the code below is buggy, see here for the corrected version.

When mailing to the Emacs devs about bugs, you should obviously mention the version of Emacs you are using. This is usually done with M-x emacs-version, which displays the version info in the minibuffer (or inserts it at point when invoked with a prefix argument). However, if you happen to use a development version of Emacs, compiled from source, this is not very meaningful – it does not contain any information about the actual commit hash. I asked about it on the mailing list, and learned about the emacs-repository-get-version funtion (which is not interactive, btw), which returns the VCS’s idea of the “current version” (nowadays it is just Git’s commit hash).

In fact, since I happen to report Emacs bugs once in a while, I have this in my init.el:

(defun insert-debug-version-info ()
  "Insert version of Emacs and 7 characters of the commit hash."
  (interactive)
  (insert
   (format "GNU Emacs %s (commit %s)"
	   emacs-version
	   (substring (emacs-repository-get-version) 0 7))))

CategoryEnglish, CategoryBlog, CategoryEmacs