bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs-21.1: cwarn-mode doesn't highlight shift assignments >>=, <<=


From: Kevin Broadey
Subject: Emacs-21.1: cwarn-mode doesn't highlight shift assignments >>=, <<=
Date: Tue, 4 Dec 2001 10:19:13 GMT

In GNU Emacs 21.1.4 (sparc-sun-solaris2.7, Motif Version 2.1.0)
 of 2001-11-30 on bah128
configured using `configure  --prefix=/org/users/kevinbr/gnu/emacs-21.1 
--exec-prefix=/org/users/kevinbr/gnu/emacs-21.1/SunOS --with-x-toolkit=motif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: nil

cwarn-mode looks like a great idea.  I used to have this in my
.emacs to guard against the same problem:-

(let ((c-font-lock-extras
       '(
         ;; assignment operators:
         ("[-+*/%&^|]=" . font-lock-warning-face)       ; -= += *= %= &= ^= |=
         ("\\(>>\\|<<\\)=" . font-lock-warning-face)    ; <<= >>=
         ("[<>!=]=" . 'default)                         ; <= >= != ==
         ("=\\|\\+\\+\\|--" . font-lock-warning-face)   ; = ++ --
         )))
  (font-lock-add-keywords 'c-mode c-font-lock-extras)
  (font-lock-add-keywords 'c++-mode c-font-lock-extras))

but cwarn is better as it only highlights the suspicious ones.

Unfortunately cwarn doesn't highlight the assigning shift operators
"<<=" and ">>=".  Not a major problem, but it should do for
completeness.  I guess it's difficult as you need to ignore "<=" and
">=".

One other suggestion - can you get it to highlight the whole of the
operator rather than just the "="?

-- 
Kevin Broadey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]