emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch upstream Git for Elisp diff hunk headings


From: Protesilaos Stavrou
Subject: Patch upstream Git for Elisp diff hunk headings
Date: Thu, 11 Feb 2021 16:42:05 +0200

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]