bug#59051: CC Mode 5.35.1 (C/*l); "Window scroll_bar" fontified as type

Alan Mackenzie <[email protected]> Tue, 29 Nov 2022 20:32:54 +0000
Newsgroups gmane.emacs.cc-mode.general
Message-ID <Y4ZsdtWcneyaj1XR@ACM>
Hello, Po.

On Sat, Nov 19, 2022 at 08:19:02 +0800, Po Lu wrote:
> Alan Mackenzie <[email protected]> writes:

> > It's been some while since you submitted this bug report, but I now have
> > a patch for it.

> > On Sat, Nov 05, 2022 at 20:34:46 +0800, Po Lu via CC-Mode-help wrote:
> >> Package: cc-mode

> >> Go to src/xterm.c in the Emacs source code.  Then, type M-> and keep
> >> pressing M-v until the beginning of the buffer is reached.  Afterwards,
> >> go to line 14458, around which will be the following function
> >> definition:

> >> MAYBE_UNUSED static void
> >> xi_select_scroll_bar_events (struct x_display_info *dpyinfo,
> >> 			     Window scroll_bar)
> >> {
> >>   XIEventMask mask;
> >>   unsigned char *m;
> >>   ptrdiff_t length;

> >>   length = XIMaskLen (XI_LASTEVENT);
> >>   mask.mask = m = alloca (length);
> >>   memset (m, 0, length);
> >>   mask.mask_len = length;

> >> "scroll_bar" in "Window scroll_bar" will be fontified as a type!

> > What happens here is there's a macro invocation with the type "struct
> > scroll_bar" as one of the arguments.  This is in function
> > x_scroll_bar_create, and the code there looks like:

> >   struct scroll_bar *bar = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, prev,
> >                                                   PVEC_OTHER);

> > ..  This argument was enough to derail the fontification of scroll_bar
> > throughout the buffer.

> > Would you please do the usual with the attached patch, and let me know
> > whether there are still problems with this bug.  Thanks!

> This one seems to be gone now, but I haven't had a chance to thoroughly
> test yet.

I've convinced myself the patch is correct, so I've committed it and I'm
closing the bug.  If the bug isn't quite fixed, we can reopen it.

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).