Function: eca--client-version

eca--client-version is a natively compiled function defined in eca.el.

Signature

(eca--client-version)

Documentation

Return the eca-emacs client version string.

Tries git info first, then package.el version, then file modification date.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca.el
(defun eca--client-version ()
  "Return the eca-emacs client version string.
Tries git info first, then package.el version, then file modification date."
  (let ((lib-file (or load-file-name (locate-library "eca"))))
    (when lib-file
      (let ((lib-dir (file-name-directory lib-file)))
        (or
         ;; Try git: SHA + date
         (when-let* ((git-dir (locate-dominating-file lib-dir ".git"))
                     (default-directory git-dir)
                     (sha (ignore-errors
                            (string-trim
                             (shell-command-to-string "git rev-parse --short HEAD 2>/dev/null"))))
                     (date (ignore-errors
                             (string-trim
                              (shell-command-to-string "git log -1 --format=%cd --date=short 2>/dev/null")))))
           (when (and (not (string-empty-p sha))
                      (not (string-empty-p date))
                      (not (string-match-p "fatal" sha)))
             (format "%s (%s)" sha date)))
         ;; Try package.el version
         (when (bound-and-true-p package-alist)
           (when-let* ((pkg-desc (cadr (assq 'eca package-alist))))
             (package-version-join (package-desc-version pkg-desc))))
         ;; Fallback: file modification date
         (when-let* ((attrs (file-attributes lib-file))
                     (mtime (file-attribute-modification-time attrs)))
           (format "unknown (modified %s)" (format-time-string "%Y-%m-%d" mtime))))))))