Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH] Per-path attribute based hunk header selection.

From: しらいしななこ <hidden>
Date: 2016-06-15 22:43:20
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Quoting Junio C Hamano [off-list ref]:
Yeah, I'd be lying if I said that this did not cross my mind
when I saw existing diff.*.command handling.

About the comment from Johannes regarding hunk_header vs
funcname, I would actually prefer hunk_header, since that is
what this is about ("funcname" and "find_func" were misnomer
from the beginning), but I'd rename hunk_header to funcname for
the sake of consistency and minimizing the diff.
I would love to see "diff=tex" attribute to work on my manuscripts, but I
do not write C and do not understand the long length of backslashes very
well.  I guessed in the source file a backslash needs to be doubled, and
what I want to match is "\section{", "\subsection{", and "\subsubsection{"
at the beginning of lines, and attempted to do it like the patch at the
end.

It does not work well, however.  It shows only part of lines.

	@@ -8,7 +8,8 @@ \section{
	@@ -224,7 +225,7 @@ sub
	@@ -240,7 +241,7 @@ subsub

I have no idea what am I doing wrong (truthfully, I do not know what I am
doing, period).

diff --git a/diff.c b/diff.c
index 04e7e91..57f91b0 100644
--- a/diff.c
+++ b/diff.c
@@ -1226,6 +1226,8 @@ static const char *diff_hunk_header_regexp(struct diff_filespec *one)
 			"^[ 	]*\\(\\([ 	]*"
 			"[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
 			"[ 	]*([^;]*$\\)";
+	if (!strcmp(ident, "tex"))
+		return "^\\\\\\(sub\\)*section{";
 
 	return NULL;
 }

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Finally - A spam blocker that actually works.
http://www.bluebottle.com/tag/4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help