gists/gists/store-configuration-revisio...

19 lines
689 B
EmacsLisp

;; Store the Git revision of your Emacs configuration at the moment
;; Emacs started.
(defconst my/has-git-p (if (executable-find "git") t nil)
"Indicates if git is in your PATH.")
(defun my/configuration-revision ()
"Retrieve the current Git revision of the Emacs configuration."
(when my/has-git-p
(with-temp-buffer
(cd user-emacs-directory)
(when (eql 0 (call-process "git" nil (current-buffer) nil
"describe" "--all" "--long" "--dirty"))
(string-trim (buffer-string))))))
(defconst my/configuration-revision
(my/configuration-revision)
"Contains the Git revision of the configuration at the moment Emacs started.")