From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.devel Subject: Patch upstream Git for Elisp diff hunk headings Date: Thu, 11 Feb 2021 16:42:05 +0200 Message-ID: <87czx68y4i.fsf@protesilaos.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2205"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Adam Spiers To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 11 15:43:32 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lADBn-0000Hm-RG for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Feb 2021 15:43:27 +0100 Original-Received: from localhost ([::1]:53964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lADBm-0003Rb-SF for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Feb 2021 09:43:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lADAe-0002VP-JB for emacs-devel@gnu.org; Thu, 11 Feb 2021 09:42:16 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:56219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lADAb-00027I-RA for emacs-devel@gnu.org; Thu, 11 Feb 2021 09:42:16 -0500 Original-Received: from kronos (unknown [94.46.225.161]) (Authenticated sender: public@protesilaos.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 9BA70240007; Thu, 11 Feb 2021 14:42:07 +0000 (UTC) Received-SPF: none client-ip=217.70.178.230; envelope-from=info@protesilaos.com; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264385 Archived-At: Dear members, Myself and Adam Spiers (in cc) have been discussing the possibility of patching Git so that it can handle Emacs Lisp diff hunk headings natively. Those headings consist of the text that follows the line ranges that diff outputs. So this: @@ -389,7 +390,7 @@ HEADING HERE Git produces those headings using language-specific regular expressions. Elisp is not covered. Users must thus define their own Git attributes. Not doing so results in practically useless text for the heading; text that does not provide an accurate sense of context. I have noticed that Emacs' git repo includes the file ".gitattributes" which instructs diffs inside of that repo to use an Elisp-aware regexp present in "autogen.sh": git_config diff.elisp.xfuncname \ '^\([^[:space:]]*def[^[:space:]]+[[:space:]]+([^()[:space:]]+)' This is an improvement over the out-of-the-box Git experience. Now the questions to this list: 1. What do you think about only targeting top-level forms? 2. How about the comments that are interpreted by outline-minor-mode as headings? So the three or more ";;;" at the beginning of a line. Would it not be right to match those as well, since they are supposed to be 'headings' in Elisp source code? Thank you in advance! Protesilaos or "Prot" -- Protesilaos Stavrou protesilaos.com