git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
しらいしななこ <nanako3@bluebottle.com>
Date
Jul 7, 2007, 10:08 UTC
Message-ID
<200707071011.l67AB9rg005792@mi0.bluebottle.com>
In-Reply-To
<7v8x9tdlbv.fsf@assigned-by-dhcp.cox.net>
Quoting Junio C Hamano <gitster@pobox.com>:
Show 8 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 29 in “diff: add custom regular expressions for function names”
  1. 2/2 diff: add custom regular expressions for function namesJohannes Schindelin, Jul 4, 2007
  2. Linus TorvaldsJul 4, 2007
  3. Johannes SchindelinJul 4, 2007
  4. Junio C HamanoJul 4, 2007
  5. Johannes SchindelinJul 4, 2007
  6. Junio C HamanoJul 5, 2007
  7. 1/2 Future-proof source for changes in xdemitconf_tJunio C Hamano, Jul 5, 2007
  8. Johannes SchindelinJul 5, 2007
  9. 2/2 WIP per-path attribute based hunk header selection.Junio C Hamano, Jul 5, 2007
  10. Johannes SchindelinJul 5, 2007
  11. Junio C HamanoJul 5, 2007
  12. 1/3 Introduce diff_filespec_is_binary()Junio C Hamano, Jul 6, 2007
  13. Johannes SchindelinJul 6, 2007
  14. Per-path attribute based hunk header selection.Junio C Hamano, Jul 6, 2007
  15. Johannes SchindelinJul 6, 2007
  16. Linus TorvaldsJul 6, 2007
  17. Junio C HamanoJul 7, 2007
  18. しらいしななこJul 7, 2007
  19. Junio C HamanoJul 7, 2007
  20. Johannes SchindelinJul 7, 2007
  21. Junio C HamanoJul 7, 2007
  22. Junio C HamanoJul 8, 2007
  23. Johannes SchindelinJul 8, 2007
  24. Nicolas PitreJul 9, 2007
  25. Junio C HamanoJul 9, 2007
  26. Johannes SchindelinJul 9, 2007
  27. Fix configuration syntax to specify customized hunk header patterns.Junio C Hamano, Jul 7, 2007
  28. Florian WeimerJul 5, 2007
  29. Johannes SchindelinJul 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.