GNU bug report logs - #59953
28.2; c type modifiers only work as prefixes for font-lock, cc-mode

Previous Next

Package: emacs;

Reported by: Chris Hecker <checker <at> d6.com>

Date: Sat, 10 Dec 2022 22:32:02 UTC

Severity: normal

Found in version 28.2

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59953 in the body.
You can then email your comments to 59953 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59953; Package emacs. (Sat, 10 Dec 2022 22:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Hecker <checker <at> d6.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 10 Dec 2022 22:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Chris Hecker" <checker <at> d6.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 28.2; c type modifiers only work as prefixes for font-lock, cc-mode
Date: Sat, 10 Dec 2022 22:31:18 +0000
[Message part 1 (text/plain, inline)]
cc-mode doesn't seem to recognize that c type specifiers can come in any 
order (and I prefer them after so they're modifying the base type), so 
the highlighting doesn't work right for the variable name.  Here's an 
example in a struct, works the same way in a function:

struct foo {
  unsigned int One;
  int unsigned Two;
};

emacs -Q results:

I couldn't see an easy way of fixing this (besides just adding all the 
combos to *-font-lock-extra-types).  Seems like there needs to be a 
c-primitive-type-postfix-kwds variable to do this right?

Thanks,
Chris





In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
 of 2022-09-13 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Home (v10.0.2009.19044.2251)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation
 --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: ELisp/l

Minor modes in effect:
  hexl-follow-ascii: t
  minibuffer-depth-indicate-mode: t
  icicle-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  winner-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t

Load-path shadows:
~/emacs/lisp/json hides 
c:/apps/emacs/emacs-28.2/share/emacs/28.2/lisp/json
~/emacs/lisp/css-mode hides 
c:/apps/emacs/emacs-28.2/share/emacs/28.2/lisp/textmodes/css-mode

Features:
(shadow sort emacsbug make-mode js align goto-addr nroff-mode lpr
realgud-gdb realgud:gdb-track-mode realgud:gdb-init realgud-track-mode
realgud-backtrace-mode realgud:gdb-core realgud:run realgud-track
realgud-shortkey realgud-menu realgud-eval realgud-init realgud-file
esh-mode realgud-cmds realgud-core realgud-reset realgud-bp
realgud-bp-image-data realgud-lang realgud-send realgud-window
realgud-buffer-helper realgud-buffer-breakpoint realgud-buffer-backtrace
realgud-locals realgud-buffer-locals realgud-buffer-command
realgud-buffer-info realgud-regexp realgud-lochist realgud-loc
realgud-buffer-source realgud-key realgud-custom key realgud-follow
loc-changes org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex ol org-keys oc org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs realgud-fringe realgud-helper realgud-utils eshell
esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups
esh-util load-relative cl-print eieio-opt speedbar ezimage dframe
shortdoc help-fns nhexl-mode noutline outline pcase find-func autoload
radix-tree lisp-mnt mm-archive gnutls network-stream url-http url-gw nsm
url-cache url-auth ruler-mode hl-line mule-util hexl bat-mode mail-extr
meson-mode smie conf-mode find-file dabbrev calc-arith calccomp calc-bin
calc-alg calc-menu misearch multi-isearch add-log vc-bzr cap-words
superword subword face-remap etags-select etags fileloop generator xref
project mb-depth two-column bookmark icicles icicles-mode comp comp-cstr
cl-extra icicles-cmd2 icicles-cmd1 warnings icicles-mcmd doremi
icicles-fn icicles-var icicles-opt edmacro ffap kmacro cus-theme
thingatpt icicles-face hexrgb calc-vec calc-forms calc-misc calc-aent
calc-prog calc-ext calc calc-loaddefs rect calc-macs vcl-mode cc-langs
mel-mode prop-mode pfx-mode message rmc puny help-mode easy-mmode dired+
image-dired image-mode exif image-file image-converter dired-aux dired-x
dired dired-loaddefs rfc822 mml mml-sec epa epg rfc6068 epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader smtpmail sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils ibuffer
ibuffer-loaddefs caml-font 7z-arc-mode cperl-mode rx facemenu fakecygpty
matlab derived tempo which-func cus-edit pp wid-edit grep cus-load
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs compile text-property-search vc vc-dispatcher imenu
browse-kill-ring view ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util checker-allout checker-outline hex-util
hmac-sha1 tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete comint ansi-color parse-time iso8601
time-date format-spec web-mode advice tex-site server info winner ring
yaml-mode ispell finder-inf realgud-recursive-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads w32notify
w32 lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 2583460 283035)
 (symbols 48 48033 35)
 (strings 32 332543 29010)
 (string-bytes 1 11657043)
 (vectors 16 124331)
 (vector-slots 8 2675678 261302)
 (floats 8 559 942)
 (intervals 56 280393 2040)
 (buffers 992 101))
[Message part 2 (text/html, inline)]
[lg3yhp5z.png (image/png, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59953; Package emacs. (Sat, 14 Oct 2023 15:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 59953 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Chris Hecker <checker <at> d6.com>
Cc: 59953 <at> debbugs.gnu.org, acm <at> muc.de
Subject: Re: bug#59953: 28.2; c type modifiers only work as prefixes for
 font-lock, cc-mode
Date: Sat, 14 Oct 2023 15:52:34 +0000
[Message part 1 (text/plain, inline)]
Hello, Chris.

Thanks for taking the trouble to file this bug, but sorry it's been such
a long time without a response.

I've now looked at the bug and it wasn't that difficult to patch.  If you
don't mind too much, I'll put your test file into the CC Mode test suite,
having added one line ("long int unsigned Three;") to it.

Would you please now apply the attached patch to your current Emacs (the
file cc-engine.el is in lisp/progmodes), byte compile cc-engine.el (or
just the whole of CC Mode), load the result into your Emacs and try it
out on your real source code.  Then please confirm to me that the bug is
fixed, or tell me what's still not right.  Thanks!  (If you want any help
in the patching of byte compilation, feel free to send me private email.)

On Sat, Dec 10, 2022 at 22:31:18 +0000, Chris Hecker wrote:
>    cc-mode doesn't seem to recognize that c type specifiers can come in
>    any order (and I prefer them after so they're modifying the base type),
>    so the highlighting doesn't work right for the variable name.  Here's
>    an example in a struct, works the same way in a function:

>    struct foo {
>      unsigned int One;
>     int unsigned Two;
>    };

>    emacs -Q results:

>    [cid:emf20eaa32-35e0-4df0-a1fb-4e6ad9397939 <at> checker-blade15]

>    I couldn't see an easy way of fixing this (besides just adding all the
>    combos to *-font-lock-extra-types).  Seems like there needs to be a
>    c-primitive-type-postfix-kwds variable to do this right?

>    Thanks,

>    Chris

>    In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
>    Â of 2022-09-13 built on AVALON

>    Windowing system distributor 'Microsoft Corp.', version 10.0.19044
>    System Description: Microsoft Windows 10 Home (v10.0.2009.19044.2251)
>    Configured using:
>    Â 'configure --with-modules --without-dbus --with-native-compilation
>    Â --without-compress-install CFLAGS=-O2'
>    Configured features:

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).

[diff.20231014.diff (text/plain, attachment)]

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Fri, 24 Nov 2023 12:31:01 GMT) Full text and rfc822 format available.

Notification sent to Chris Hecker <checker <at> d6.com>:
bug acknowledged by developer. (Fri, 24 Nov 2023 12:31:02 GMT) Full text and rfc822 format available.

Message #13 received at 59953-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Chris Hecker <checker <at> d6.com>
Cc: 59953-done <at> debbugs.gnu.org, acm <at> muc.de
Subject: Re: bug#59953: 28.2; c type modifiers only work as prefixes for
 font-lock, cc-mode
Date: Fri, 24 Nov 2023 12:29:46 +0000
Hello, Chris.

I've committed the patch, and I'm closing the bug with this post.

On Sat, Oct 14, 2023 at 15:52:34 +0000, Alan Mackenzie wrote:
> Thanks for taking the trouble to file this bug, but sorry it's been such
> a long time without a response.

> I've now looked at the bug and it wasn't that difficult to patch.  If you
> don't mind too much, I'll put your test file into the CC Mode test suite,
> having added one line ("long int unsigned Three;") to it.

> Would you please now apply the attached patch to your current Emacs (the
> file cc-engine.el is in lisp/progmodes), byte compile cc-engine.el (or
> just the whole of CC Mode), load the result into your Emacs and try it
> out on your real source code.  Then please confirm to me that the bug is
> fixed, or tell me what's still not right.  Thanks!  (If you want any help
> in the patching of byte compilation, feel free to send me private email.)

> On Sat, Dec 10, 2022 at 22:31:18 +0000, Chris Hecker wrote:
> >    cc-mode doesn't seem to recognize that c type specifiers can come in
> >    any order (and I prefer them after so they're modifying the base type),
> >    so the highlighting doesn't work right for the variable name.  Here's
> >    an example in a struct, works the same way in a function:

> >    struct foo {
> >      unsigned int One;
> >     int unsigned Two;
> >    };

> >    emacs -Q results:

> >    [cid:emf20eaa32-35e0-4df0-a1fb-4e6ad9397939 <at> checker-blade15]

> >    I couldn't see an easy way of fixing this (besides just adding all the
> >    combos to *-font-lock-extra-types).  Seems like there needs to be a
> >    c-primitive-type-postfix-kwds variable to do this right?

> >    Thanks,

> >    Chris

> >    In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
> >    Â of 2022-09-13 built on AVALON

> >    Windowing system distributor 'Microsoft Corp.', version 10.0.19044
> >    System Description: Microsoft Windows 10 Home (v10.0.2009.19044.2251)
> >    Configured using:
> >    Â 'configure --with-modules --without-dbus --with-native-compilation
> >    Â --without-compress-install CFLAGS=-O2'
> >    Configured features:

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Dec 2023 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.