[vim/vim] Add checkgroups Makefile target to check default hl group links. (PR #16678)

30 views
Skip to first unread message

cvwillegen

unread,
Feb 20, 2025, 5:00:56 AM2/20/25
to vim/vim, Subscribed

When adding highlight groups, you may need to add a "default link NewHlGroup ExistingHlGroup" in highlight.c code, so that when resetting a color scheme an old color will not be left behind.

Added a Makefile target in the 'runtime/doc' directory that checks if hl- groups that were added to the documentation are either reflected in the source code, or belong to a list of 'known to be ignored' highlight groups.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/16678

Commit Summary

  • 9bbd445 Add checkgroups Makefile target to check default hl group links.

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678@github.com>

cvwillegen

unread,
Feb 20, 2025, 5:04:01 AM2/20/25
to vim/vim, Push

@cvwillegen pushed 1 commit.

  • 72173ed Add 'known good' hl groups file to Filelist.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/9bbd44576c44bec67ffe889969e8c0dbe0304f40/after/72173ed7bba7c550e46565c6c9389dca999a2af2@github.com>

cvwillegen

unread,
Feb 20, 2025, 8:19:44 AM2/20/25
to vim/vim, Push

@cvwillegen pushed 1 commit.

  • 9f1450d Check if removing "default link" breaks the build.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/72173ed7bba7c550e46565c6c9389dca999a2af2/after/9f1450d5586d1f1018fb87a25a7c1684ce580721@github.com>

cvwillegen

unread,
Feb 20, 2025, 1:52:50 PM2/20/25
to vim/vim, Push

@cvwillegen pushed 2 commits.

  • 5788af7 (Try to) make hlgroups check into ci check.
  • bb80445 Make the test the default target.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/9f1450d5586d1f1018fb87a25a7c1684ce580721/after/bb80445c0134f7e3ef7c8f1e9b5ecf0583ac8a67@github.com>

Christ van Willegen

unread,
Feb 20, 2025, 1:56:08 PM2/20/25
to vim...@googlegroups.com, nor...@github.com, vim/vim, Push
Hi,

Op do 20 feb 2025 14:19 schreef cvwillegen <vim-dev...@256bit.org>:

@cvwillegen pushed 1 commit.

  • 9f1450d Check if removing "default link" breaks the build.

The build broke, but not for the correct reason... Trying again! 

Christ van Willegen

Christian Brabandt

unread,
Feb 20, 2025, 3:45:59 PM2/20/25
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In ci/hlgroups.make:

> @@ -0,0 +1,18 @@
+# vim: ft=make
+SHELL = /bin/bash
+
+# Default target to actually run the comparison:
+.PHONY: check
+.INTERMEDIATE: hlgroups deflinks hlgroups.stripped
+
+check: hlgroups.stripped deflinks
+	diff hlgroups.stripped deflinks
+
+hlgroups:
+	grep '\*hl-' ../runtime/doc/*txt | sed -E 's/.*:<?\s*//' | sed 's/ /\n/g' | sed 's/hl-//' | sed 's/\*//g' | sort > hlgroups

This seems a bit ugly. Perhaps use a separate sed script like this:

#!/bin/sh

sed -ne '/\*hl-/{
s/^<\?\s*//
s/\*//g
s/hl-//g
s/ /\n/
p
}' ../runtime/doc/*.txt |sort

or put all the sed invocations into a single command using several -e args.


In src/highlight.c:

> @@ -261,7 +261,6 @@ static char *(highlight_init_both[]) = {
     "default link PmenuMatch Pmenu",
     "default link PmenuMatchSel PmenuSel",
     "default link PmenuExtra Pmenu",
-    "default link PmenuExtraSel PmenuSel",

I don't understand that. Why do we need to remove the default link for PmenuExtraSel?


In ci/hlgroups.make:

> @@ -0,0 +1,18 @@
+# vim: ft=make
+SHELL = /bin/bash
+
+# Default target to actually run the comparison:
+.PHONY: check
+.INTERMEDIATE: hlgroups deflinks hlgroups.stripped
+
+check: hlgroups.stripped deflinks
+	diff hlgroups.stripped deflinks
+
+hlgroups:
+	grep '\*hl-' ../runtime/doc/*txt | sed -E 's/.*:<?\s*//' | sed 's/ /\n/g' | sed 's/hl-//' | sed 's/\*//g' | sort > hlgroups

Do we need a clean rule?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/review/2631105499@github.com>

Christian Brabandt

unread,
Feb 20, 2025, 3:48:27 PM2/20/25
to vim/vim, Subscribed

shouldn't we call this script in https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the vimtags target?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672644843@github.com>

chrisbrachrisbra left a comment (vim/vim#16678)

shouldn't we call this script in https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the vimtags target?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672644843@github.com>

Christ van Willegen

unread,
Feb 20, 2025, 3:53:24 PM2/20/25
to vim...@googlegroups.com, reply+ACY5DGE2UVF2UCDCRP...@reply.github.com, vim/vim, Subscribed
Hi, 


Op do 20 feb 2025 21:48 schreef Christian Brabandt <vim-dev...@256bit.org>:

shouldn't we call this script in https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the vimtags target?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672644843@github.com>

chrisbrachrisbra left a comment (vim/vim#16678)

shouldn't we call this script in https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the vimtags target?


Yes, I'm trying to get this in CI.

The reason I (temporarily) removed the "default link" in ``highlight.c`` was because I was trying to fall CI in the "intended" way: that it needed to be specified. 

I should probably change this to a WIP for now... I'll let you know when this is done.

Christ van Willegen

vim-dev ML

unread,
Feb 20, 2025, 3:53:51 PM2/20/25
to vim/vim, vim-dev ML, Your activity
Hi, <br> <br> <br> Op do 20 feb 2025 21:48 schreef Christian Brabandt &lt; <br> ***@***.***&gt;: <br> <br> &gt; shouldn&#39;t we call this script in <br> &gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt; vimtags target? <br> &gt; <br> &gt; — <br> &gt; Reply to this email directly, view it on GitHub <br> &gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt;, or <br> &gt; unsubscribe <br> &gt; &lt;https://github.com/notifications/unsubscribe-auth/ACY5DGDFWTB55QV4I2RC7H32QY5RDAVCNFSM6AAAAABXQKOREWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY2DIOBUGM&gt; <br> &gt; . <br> &gt; You are receiving this because you are subscribed to this thread.Message <br> &gt; ID: ***@***.***&gt; <br> &gt; [image: chrisbra]*chrisbra* left a comment (vim/vim#16678) <br> &gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt; <br> &gt; <br> &gt; shouldn&#39;t we call this script in <br> &gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt; vimtags target? <br> &gt; <br> <br> Yes, I&#39;m trying to get this in CI. <br> <br> The reason I (temporarily) removed the &quot;default link&quot; in ``highlight.c`` <br> was because I was trying to fall CI in the &quot;intended&quot; way: that it needed <br> to be specified. <br> <br> I should probably change this to a WIP for now... I&#39;ll let you know when <br> this is done. <br> <br> Christ van Willegen <br> <br> &gt; <br>


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672655505@github.com>

vim-mlvim-ml left a comment (vim/vim#16678)
Hi, <br> <br> <br> Op do 20 feb 2025 21:48 schreef Christian Brabandt &lt; <br> ***@***.***&gt;: <br> <br> &gt; shouldn&#39;t we call this script in <br> &gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt; vimtags target? <br> &gt; <br> &gt; — <br> &gt; Reply to this email directly, view it on GitHub <br> &gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt;, or <br> &gt; unsubscribe <br> &gt; &lt;https://github.com/notifications/unsubscribe-auth/ACY5DGDFWTB55QV4I2RC7H32QY5RDAVCNFSM6AAAAABXQKOREWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY2DIOBUGM&gt; <br> &gt; . <br> &gt; You are receiving this because you are subscribed to this thread.Message <br> &gt; ID: ***@***.***&gt; <br> &gt; [image: chrisbra]*chrisbra* left a comment (vim/vim#16678) <br> &gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt; <br> &gt; <br> &gt; shouldn&#39;t we call this script in <br> &gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt; vimtags target? <br> &gt; <br> <br> Yes, I&#39;m trying to get this in CI. <br> <br> The reason I (temporarily) removed the &quot;default link&quot; in ``highlight.c`` <br> was because I was trying to fall CI in the &quot;intended&quot; way: that it needed <br> to be specified. <br> <br> I should probably change this to a WIP for now... I&#39;ll let you know when <br> this is done. <br> <br> Christ van Willegen <br> <br> &gt; <br>


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672655505@github.com>

Christ van Willegen

unread,
Feb 20, 2025, 3:57:41 PM2/20/25
to vim...@googlegroups.com, reply+ACY5DGE2UVF2UCDCRP...@reply.github.com
Hi, 

Op do 20 feb 2025 21:53 schreef Christ van Willegen <cvwil...@gmail.com>:

shouldn't we call this script in https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the vimtags target?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672644843@github.com>

chrisbra
Yes, I'm trying to get this in CI.

Ah, the reason I couldn't find where the Filelist is checked is that is in a hidden directory, so ``grep`` doesn't find it. Thanks for the pointer! 

Christ van Willegen

vim-dev ML

unread,
Feb 20, 2025, 3:58:09 PM2/20/25
to vim/vim, vim-dev ML, Your activity
Hi, <br> <br> Op do 20 feb 2025 21:53 schreef Christ van Willegen ***@***.***&gt;: <br> <br> &gt; <br> &gt; shouldn&#39;t we call this script in <br> &gt;&gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt;&gt; vimtags target? <br> &gt;&gt; <br> &gt;&gt; — <br> &gt;&gt; Reply to this email directly, view it on GitHub <br> &gt;&gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt;, or <br> &gt;&gt; unsubscribe <br> &gt;&gt; &lt;https://github.com/notifications/unsubscribe-auth/ACY5DGDFWTB55QV4I2RC7H32QY5RDAVCNFSM6AAAAABXQKOREWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY2DIOBUGM&gt; <br> &gt;&gt; . <br> &gt;&gt; You are receiving this because you are subscribed to this thread.Message <br> &gt;&gt; ID: ***@***.***&gt; <br> &gt;&gt; [image: chrisbra] <br> &gt;&gt; <br> &gt; Yes, I&#39;m trying to get this in CI. <br> &gt; <br> <br> Ah, the reason I couldn&#39;t find where the Filelist is checked is that is in <br> a hidden directory, so ``grep`` doesn&#39;t find it. Thanks for the pointer! <br> <br> Christ van Willegen <br> <br> &gt; <br>


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672663550@github.com>

vim-mlvim-ml left a comment (vim/vim#16678)
Hi, <br> <br> Op do 20 feb 2025 21:53 schreef Christ van Willegen ***@***.***&gt;: <br> <br> &gt; <br> &gt; shouldn&#39;t we call this script in <br> &gt;&gt; https://github.com/vim/vim/blob/master/.github/workflows/ci.yml like the <br> &gt;&gt; vimtags target? <br> &gt;&gt; <br> &gt;&gt; — <br> &gt;&gt; Reply to this email directly, view it on GitHub <br> &gt;&gt; &lt;https://github.com/vim/vim/pull/16678#issuecomment-2672644843&gt;, or <br> &gt;&gt; unsubscribe <br> &gt;&gt; &lt;https://github.com/notifications/unsubscribe-auth/ACY5DGDFWTB55QV4I2RC7H32QY5RDAVCNFSM6AAAAABXQKOREWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY2DIOBUGM&gt; <br> &gt;&gt; . <br> &gt;&gt; You are receiving this because you are subscribed to this thread.Message <br> &gt;&gt; ID: ***@***.***&gt; <br> &gt;&gt; [image: chrisbra] <br> &gt;&gt; <br> &gt; Yes, I&#39;m trying to get this in CI. <br> &gt; <br> <br> Ah, the reason I couldn&#39;t find where the Filelist is checked is that is in <br> a hidden directory, so ``grep`` doesn&#39;t find it. Thanks for the pointer! <br> <br> Christ van Willegen <br> <br> &gt; <br>


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/c2672663550@github.com>

Christian Brabandt

unread,
Feb 20, 2025, 5:19:17 PM2/20/25
to vim/vim, vim-dev ML, Comment

Closed #16678 via fbe2dd7.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/issue_event/16390023387@github.com>

zeertzjq

unread,
Feb 20, 2025, 6:36:46 PM2/20/25
to vim/vim, vim-dev ML, Comment

Reopened #16678.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/issue_event/16390858286@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:06:27 AM2/21/25
to vim/vim, vim-dev ML, Push

@cvwillegen pushed 2 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/bb80445c0134f7e3ef7c8f1e9b5ecf0583ac8a67/after/9f922643e6c14c0b853e738398b39cd68164f42c@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:10:59 AM2/21/25
to vim/vim, vim-dev ML, Push

@cvwillegen pushed 1 commit.

  • a62e6f3 Merge branch 'master' into check_highlight_groups

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/9f922643e6c14c0b853e738398b39cd68164f42c/after/a62e6f35a854b998f63525e1534212dc22a81c9b@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:16:48 AM2/21/25
to vim/vim, vim-dev ML, Push

@cvwillegen pushed 1 commit.

  • f00c6a8 Move checking hlgroups down in the ci workflow.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/a62e6f35a854b998f63525e1534212dc22a81c9b/after/f00c6a84079d622cee6bf0adde0691d851227c21@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:24:32 AM2/21/25
to vim/vim, vim-dev ML, Push

@cvwillegen pushed 1 commit.

  • 5e2ed81 Run the Makefile from the correct directory.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/f00c6a84079d622cee6bf0adde0691d851227c21/after/5e2ed815d1f65219d58903f91e6dbd25e479ddc7@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:28:28 AM2/21/25
to vim/vim, vim-dev ML, Push

@cvwillegen pushed 1 commit.

  • 507d8ba Re-add intentionally left out highlight group, stop ignoring handeled highlight groups.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/16678/before/5e2ed815d1f65219d58903f91e6dbd25e479ddc7/after/507d8ba5f17490d691b31d7d0130fc8affd3bb12@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:32:52 AM2/21/25
to vim/vim, vim-dev ML, Comment

@cvwillegen commented on this pull request.


In ci/hlgroups.make:

> @@ -0,0 +1,18 @@
+# vim: ft=make
+SHELL = /bin/bash
+
+# Default target to actually run the comparison:
+.PHONY: check
+.INTERMEDIATE: hlgroups deflinks hlgroups.stripped
+
+check: hlgroups.stripped deflinks
+	diff hlgroups.stripped deflinks
+
+hlgroups:
+	grep '\*hl-' ../runtime/doc/*txt | sed -E 's/.*:<?\s*//' | sed 's/ /\n/g' | sed 's/hl-//' | sed 's/\*//g' | sort > hlgroups

or put all the sed invocations into a single command using several -e args.

I ended up doing exactly that, thanks for the hint!


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/review/2632243356@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:33:25 AM2/21/25
to vim/vim, vim-dev ML, Comment

@cvwillegen commented on this pull request.


In ci/hlgroups.make:

> @@ -0,0 +1,18 @@
+# vim: ft=make
+SHELL = /bin/bash
+
+# Default target to actually run the comparison:
+.PHONY: check
+.INTERMEDIATE: hlgroups deflinks hlgroups.stripped
+
+check: hlgroups.stripped deflinks
+	diff hlgroups.stripped deflinks
+
+hlgroups:
+	grep '\*hl-' ../runtime/doc/*txt | sed -E 's/.*:<?\s*//' | sed 's/ /\n/g' | sed 's/hl-//' | sed 's/\*//g' | sort > hlgroups

Do we need a clean rule?

I added the intermediate files in the .INTERMEDIATE Makefile target, so a clean rule is not needed any more.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/review/2632244201@github.com>

cvwillegen

unread,
Feb 21, 2025, 2:57:49 AM2/21/25
to vim/vim, vim-dev ML, Comment

I think this is done now.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/16678/c2673837743@github.com>

cvwillegencvwillegen left a comment (vim/vim#16678)

I think this is done now.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/16678/c2673837743@github.com>

Christian Brabandt

unread,
Feb 21, 2025, 2:18:07 PM2/21/25
to vim/vim, vim-dev ML, Comment

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/c2675352647@github.com>

chrisbrachrisbra left a comment (vim/vim#16678)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/c2675352647@github.com>

Christian Brabandt

unread,
Feb 21, 2025, 2:29:11 PM2/21/25
to vim/vim, vim-dev ML, Comment

Closed #16678 via 6a15942.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/16678/issue_event/16405915417@github.com>

Reply all
Reply to author
Forward
0 new messages