Improve git diff hunk headers for .el, .texi

Problem reported by Alan Mackenzie in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00826.html
* .gitattributes (*.el, *.texi): New patterns.
* autogen.sh: Configure diff.elisp.xfuncname and
diff.texinfo.xfuncname if using Git.
This commit is contained in:
Paul Eggert 2015-09-21 11:56:01 -07:00
parent db828f62f6
commit e3a6246eff
2 changed files with 18 additions and 2 deletions

4
.gitattributes vendored
View file

@ -44,3 +44,7 @@ doc/misc/texinfo.tex -whitespace=blank-at-eol
*.sig binary
*.tiff binary
etc/e/eterm-color binary
# Hooks for non-default diff hunk headers; see autogen.sh.
*.el diff=elisp
*.texi diff=texinfo

View file

@ -216,8 +216,20 @@ autoreconf -fi -I m4 || exit $?
## cause 'make' to needlessly run 'autoheader'.
echo timestamp > src/stamp-h.in || exit
## Install Git hooks, if using Git.
if test -d .git/hooks; then
## Configure Git, if using Git.
if test -d .git; then
# Configure 'git diff' hunk header format.
git config 'diff.elisp.xfuncname' \
'^\(def[^[:space:]]+[[:space:]]+([^()[:space:]]+)' || exit
git config 'diff.texinfo.xfuncname' \
'^@node[[:space:]]+([^,[:space:]][^,]+)' || exit
# Install Git hooks.
tailored_hooks=
sample_hooks=