[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should diff.elisp.xfuncname match cl-lib macros?
From: |
Basil L. Contovounesios |
Subject: |
Re: Should diff.elisp.xfuncname match cl-lib macros? |
Date: |
Mon, 13 May 2019 02:40:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Juri Linkov <address@hidden> writes:
> PS: Regarding the change in diff.elisp.xfuncname, can we also have
> an appropriate regexp for diff.c.xfuncname as well, to find
> DEFUN in C code?
I'm not sure we need to define a new pattern for C files distinct from
the built-in cpp pattern, but here's a patch extending the cpp and elisp
patterns:
diff --git a/autogen.sh b/autogen.sh
index 40d0c37b11..b5722bdb12 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -316,8 +316,16 @@ hooks=
# Configure 'git diff' hunk header format.
+# This xfuncname is based on Git's built-in 'cpp' pattern.
+# The first line rejects jump targets and access declarations.
+# The second line matches top-level functions and methods.
+# The third line matches preprocessor and DEFUN macros.
+git_config diff.cpp.xfuncname \
+'!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])
+^((::[[:space:]]*)?[A-Za-z_][A-Za-z_0-9]*[[:space:]]*\(.*)$
+^((#define[[:space:]]|DEFUN).*)$'
git_config diff.elisp.xfuncname \
- '^\(def[^[:space:]]+[[:space:]]+([^()[:space:]]+)'
+ '^\([^[:space:]]*def[^[:space:]]+[[:space:]]+([^()[:space:]]+)'
git_config 'diff.m4.xfuncname' '^((m4_)?define|A._DEFUN(_ONCE)?)\([^),]*'
git_config 'diff.make.xfuncname' \
'^([$.[:alnum:]_].*:|[[:alnum:]_]+[[:space:]]*([*:+]?[:?]?|!?)=|define .*)'
WDYT?
Thanks,
--
Basil
- Re: Should diff.elisp.xfuncname match cl-lib macros?,
Basil L. Contovounesios <=