all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Eli Zaretskii <eliz@gnu.org>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Enhancing (?) `emacs-version'
Date: Wed, 10 Feb 2016 17:30:06 -0500	[thread overview]
Message-ID: <CAFyQvY07Vd9oZyDmOfh4LKAkMby4O0thVM6tcH57BC4=1GeyPA@mail.gmail.com> (raw)
In-Reply-To: <87twlg70dm.fsf@mbork.pl>

[-- Attachment #1: Type: text/plain, Size: 1845 bytes --]

I use this function to get the emacs dev version.


(defun emacs-version-dev (here)
  "Display emacs build info and also save it to the kill-ring.
If HERE is non-nil, also insert the string at point."
  (interactive "P")
  (let ((emacs-build-info
         (concat "Emacs version: " (emacs-version) ","
                 " built using commit " emacs-repository-version ".\n\n"
                 "./configure options:\n  " system-configuration-options "\n\n"
                 "Features:\n  " system-configuration-features "\n")))
    (kill-new emacs-build-info)
    (message emacs-build-info)
    (when here
      (insert emacs-build-info))
    emacs-build-info))

AFAIK there is no definitive way to get the branch name because
branches are ephemeral. But the below hack works for me.

(defvar emacs-git-branch
  (when (and emacs-repository-version
             (file-exists-p source-directory))
    (let ((shell-return
           (replace-regexp-in-string
            "[\n)]" " " ; Replace newline and ) chars with spaces
            (shell-command-to-string
             (concat "cd " source-directory " && "
                     "git branch --contains "
                     emacs-repository-version)))))
      ;; Below regexp is tested for following "git branch --contains" values
      ;; Output for a commit in master branch too
      ;;   "* (HEAD detached at origin/emacs-25)
      ;;     master
      ;;   "
      ;; Output for a commit only in emacs-25 branch
      ;;   "* (HEAD detached at origin/emacs-25)
      ;;   "
      ;; (message "%S" shell-return)
      (string-match ".*[/ ]\\([^ ]+?\\)\\s-*$" shell-return)
      (match-string-no-properties 1 shell-return)))
  "Name of git branch from which the current emacs is built.")

https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-misc.el



-- 

--
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 16793 bytes --]

  reply	other threads:[~2016-02-10 22:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 19:01 Enhancing (?) `emacs-version' Marcin Borkowski
2016-02-10 19:18 ` Óscar Fuentes
2016-02-10 19:24 ` Eli Zaretskii
2016-02-10 20:27   ` Marcin Borkowski
2016-02-10 20:33     ` Eli Zaretskii
2016-02-10 20:53       ` Marcin Borkowski
2016-02-10 22:30         ` Kaushal Modi [this message]
2016-02-10 22:37           ` Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY07Vd9oZyDmOfh4LKAkMby4O0thVM6tcH57BC4=1GeyPA@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mbork@mbork.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.