From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Enhancing (?) `emacs-version' Date: Wed, 10 Feb 2016 17:30:06 -0500 Message-ID: References: <87wpqc75ju.fsf@mbork.pl> <83egck9xmk.fsf@gnu.org> <87vb5w71l1.fsf@mbork.pl> <83a8n89ufo.fsf@gnu.org> <87twlg70dm.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c30c2cdb7699052b71f912 X-Trace: ger.gmane.org 1455143443 2884 80.91.229.3 (10 Feb 2016 22:30:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Feb 2016 22:30:43 +0000 (UTC) Cc: Eli Zaretskii , "emacs-devel@gnu.org" To: Marcin Borkowski Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 10 23:30:31 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aTdHK-0008Cr-Sm for ged-emacs-devel@m.gmane.org; Wed, 10 Feb 2016 23:30:31 +0100 Original-Received: from localhost ([::1]:43760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTdHK-0005a3-6M for ged-emacs-devel@m.gmane.org; Wed, 10 Feb 2016 17:30:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTdH1-0005ZY-5D for emacs-devel@gnu.org; Wed, 10 Feb 2016 17:30:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTdGz-0006Zq-RV for emacs-devel@gnu.org; Wed, 10 Feb 2016 17:30:11 -0500 Original-Received: from mail-ob0-x236.google.com ([2607:f8b0:4003:c01::236]:34719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTdGx-0006WX-ND; Wed, 10 Feb 2016 17:30:07 -0500 Original-Received: by mail-ob0-x236.google.com with SMTP id wb13so50118426obb.1; Wed, 10 Feb 2016 14:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rHQXwidZMNZNiLM8UF8OCYJngxGmHRdymfDSG8PXWRQ=; b=rUZNdVPj4X4BvhToqEq+SfcHsefUlKASgKchvDkXuNmP8IldIg4K8droJff/BLuejz zRB+wSTgOjnl0pV03BGHEZTidgcP8BQ1XBX7CTfHPs55SQPPggzyfCNxm20Z5uAJHoGD JeN7dWNR7/SH1yXj+R7dJPkMbcu5vewzoKZ0nkTPUfZdMf+1sKsjZCMnXSLrs/Sf90Fh kDHfWZf8YC2HBjD8TbE79Vu1eNN/qr1FWh3YsUo4lentsP7I5q3c1IDIdIMwoZ2Ikfks yeDvmhYexzpakgKvB7ed3uGzrYtbntUXOBEMTnSI3/kbvR+bMts4opwlJhChq8Q8zeyV MiJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=rHQXwidZMNZNiLM8UF8OCYJngxGmHRdymfDSG8PXWRQ=; b=bETPH+ZKE7j+SID9fzPTNKHJQI4KL/zzyePDYRU4lXu8KpYIn8SRAtcw3BTmw4vM1t DJrG8RtMdtlns5fbfI1bMpvAQe0jBarh3pJeDG5Va/l1joYVfi/HrQ4msMxF606941/J jkVR1/aNTQ6m/6bF1ElUK+qQ4HDzbQWwmp3ysxUj+tTUzXcUFmLYXCJs7vuciMkg/w/q MLO4ESqb/5PvFs21aH9AoLe9XlX2Cjye3d9tClnSjBtNdwhAR0BLkw1sNHhXqi6R7RFy RncyzckihpYqDoiU20stiWwvsg5ZZUvC/0Au8sL3AsbhV6yEUxrUMWQIqw79eydEdKSi 8R8A== X-Gm-Message-State: AG10YOQ0fTNpFofSwJYJrv30HODwtg3Myp7Oq/se69SBksU2SexNSaHLL4C1iCH9UYWY4UXIS+hcu5PTFE3XDA== X-Received: by 10.182.165.8 with SMTP id yu8mr7825917obb.63.1455143406758; Wed, 10 Feb 2016 14:30:06 -0800 (PST) Original-Received: by 10.202.201.73 with HTTP; Wed, 10 Feb 2016 14:30:06 -0800 (PST) In-Reply-To: <87twlg70dm.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c01::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199730 Archived-At: --001a11c30c2cdb7699052b71f912 Content-Type: text/plain; charset=UTF-8 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 --001a11c30c2cdb7699052b71f912 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I use this function to get the emacs dev version.=C2=A0

(defun emacs-version-dev (here)
= =C2=A0=C2=A0"Display emacs= build info and also save it to the kill-ring.
If HERE is non-nil, also insert the string at point."=C2=A0=C2=A0(= interactive "P")<= /font>
=C2=A0=C2=A0(let= ((emacs-build-info
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0(concat "Emacs version: &q= uot; (emacs-version) &qu= ot;,"<= /span>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0" built using commit " emacs-repository-version = ".\n\n"
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0"./configure o= ptions:\n = " system-configuration-options "= \n\n= "
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0"Features:\n " system-configuration-features "\n= ")))
=C2=A0=C2=A0=C2=A0=C2=A0(kill-new emacs-b= uild-info)
=C2=A0=C2=A0=C2=A0=C2=A0(message emacs-build-info)
=C2=A0=C2=A0=C2=A0=C2=A0(when here
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (insert emacs-build-info))
=C2=A0=C2=A0=C2=A0=C2=A0emacs-build-in= fo))

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

(defvar emacs-git= -branch
=C2=A0=C2=A0(when (and emacs-repository-version
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(file-exists-p source= -directory))
=C2=A0=C2=A0=C2=A0=C2=A0(let ((shell-return
<= div class=3D"line js-file-line" id=3D"LC165" style=3D"padding:0px 15px">=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(replace-regexp-in= -string
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0"[\n)]" " " ; Replace newline and ) chars with spaces
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0(shell-command-to-string
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(concat "cd " source-directory " && "
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0"git branch --contains "
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0emacs-repository-version)))))
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0;; Below regexp is tested for following "git branch --contains" = values
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0;; Output for a commit in master br= anch too
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0;; "* (HEAD detached at = origin/emacs-25)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0;; master
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0;; "
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0;; Outpu= t for a commit only in emacs-25 branch
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0;; "* (HEAD detached at origin/emacs-25)
=
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0;; "
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0;; (message "%S&qu= ot; shell-return)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(str= ing-match ".*[/ ]\\([^ ]+?\\)\\s-*$" shell-return)<= /font>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(match-string-no-properties 1 shell-return)))
=C2=A0=C2=A0"Name= of git branch from which the current emacs is built.")
<= font face=3D"Helvetica Neue, Helvetica, Arial, sans-serif" size=3D"3">

<= br>--

--
Kaushal Modi

--001a11c30c2cdb7699052b71f912--