]> code.delx.au - gnu-emacs/commitdiff
Improve git diff hunk headers for .el, .texi
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Sep 2015 18:56:01 +0000 (11:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Sep 2015 18:56:50 +0000 (11:56 -0700)
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.

.gitattributes
autogen.sh

index 21af4e68770c8a595933eed068cc93ded8eee8ff..ac26a2bbcd2ecdfbc92826a41c62cbf54d2d73ea 100644 (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
index bc9c5a008e034479aa1c146332de6f0b318399c4..926915c1af1e985834a98b91c7eaf234994a56f8 100755 (executable)
@@ -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=