GNU bug report logs - #53605
CC Mode 5.35.1 (C++//l); C++11 string literal operator mishighlighted

Previous Next

Package: cc-mode;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Fri, 28 Jan 2022 14:55:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


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

From: Richard Copley <rcopley <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 53605 <at> debbugs.gnu.org
Subject: Re: bug#53605: CC Mode 5.35.1 (C++//l);
 C++11 string literal operator mishighlighted
Date: Mon, 31 Jan 2022 14:37:12 +0000
Hi Alan,

On Sun, 30 Jan 2022 at 15:42, Alan Mackenzie <acm <at> muc.de> wrote:
>
> Hello again, Richard.
>
> Yes.  Please try out the following patch, and confirm that it has fixed
> the problem (or let me know what is still not right).  It's actually a
> small patch, just binding `case-fold-search' to nil in a function, but
> reindenting the entire function.

Works for me. Thank you!

> As I said earlier, the r""_opcode( was getting confused for R""_opcode(,
> which would be a valid raw string delimiter.
>
> Thanks!
>
>
> diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
> index 3a3413dc36..957a0b8a7c 100644
> --- a/lisp/progmodes/cc-mode.el
> +++ b/lisp/progmodes/cc-mode.el
> @@ -798,43 +798,44 @@ c-common-init
>  `c-basic-common-init' for details.  It's only optional to be
>  compatible with old code; callers should always specify it."
>
> -  (unless mode
> -    ;; Called from an old third party package.  The fallback is to
> -    ;; initialize for C.
> -    (c-init-language-vars-for 'c-mode))
> -
> -  (c-basic-common-init mode c-default-style)
> -  (when mode
> -    ;; Only initialize font locking if we aren't called from an old package.
> -    (c-font-lock-init))
> -
> -  ;; Starting a mode is a sort of "change".  So call the change functions...
> -  (save-restriction
> -    (widen)
> -    (setq c-new-BEG (point-min))
> -    (setq c-new-END (point-max))
> -    (save-excursion
> -      (let (before-change-functions after-change-functions)
> -       (mapc (lambda (fn)
> -               (funcall fn (point-min) (point-max)))
> -             c-get-state-before-change-functions)
> -       (mapc (lambda (fn)
> -               (funcall fn (point-min) (point-max)
> -                        (- (point-max) (point-min))))
> -             c-before-font-lock-functions))))
> -
> -  (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
> -  (set (make-local-variable 'outline-level) 'c-outline-level)
> -  (set (make-local-variable 'add-log-current-defun-function)
> -       (lambda ()
> -        (or (c-cpp-define-name) (car (c-defun-name-and-limits nil)))))
> -  (let ((rfn (assq mode c-require-final-newline)))
> -    (when rfn
> -      (if (boundp 'mode-require-final-newline)
> -          (and (cdr rfn)
> -               (set (make-local-variable 'require-final-newline)
> -                    mode-require-final-newline))
> -        (set (make-local-variable 'require-final-newline) (cdr rfn))))))
> +  (let (case-fold-search)
> +    (unless mode
> +      ;; Called from an old third party package.  The fallback is to
> +      ;; initialize for C.
> +      (c-init-language-vars-for 'c-mode))
> +
> +    (c-basic-common-init mode c-default-style)
> +    (when mode
> +      ;; Only initialize font locking if we aren't called from an old package.
> +      (c-font-lock-init))
> +
> +    ;; Starting a mode is a sort of "change".  So call the change functions...
> +    (save-restriction
> +      (widen)
> +      (setq c-new-BEG (point-min))
> +      (setq c-new-END (point-max))
> +      (save-excursion
> +       (let (before-change-functions after-change-functions)
> +         (mapc (lambda (fn)
> +                 (funcall fn (point-min) (point-max)))
> +               c-get-state-before-change-functions)
> +         (mapc (lambda (fn)
> +                 (funcall fn (point-min) (point-max)
> +                          (- (point-max) (point-min))))
> +               c-before-font-lock-functions))))
> +
> +    (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
> +    (set (make-local-variable 'outline-level) 'c-outline-level)
> +    (set (make-local-variable 'add-log-current-defun-function)
> +        (lambda ()
> +          (or (c-cpp-define-name) (car (c-defun-name-and-limits nil)))))
> +    (let ((rfn (assq mode c-require-final-newline)))
> +      (when rfn
> +       (if (boundp 'mode-require-final-newline)
> +            (and (cdr rfn)
> +                (set (make-local-variable 'require-final-newline)
> +                      mode-require-final-newline))
> +          (set (make-local-variable 'require-final-newline) (cdr rfn)))))))
>
>  (defun c-count-cfss (lv-alist)
>    ;; LV-ALIST is an alist like `file-local-variables-alist'.  Count how many
>
>
> [ .... ]
>
> --
> Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 3 years and 112 days ago.

Previous Next


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