[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cc-mode fontification feels random
From: |
Alan Mackenzie |
Subject: |
Re: cc-mode fontification feels random |
Date: |
Sat, 19 Jun 2021 15:24:52 +0000 |
Hello again, Daniel.
On Sat, Jun 19, 2021 at 09:25:30 +0000, Alan Mackenzie wrote:
> On Wed, Jun 09, 2021 at 19:21:20 -0700, Daniel Colascione wrote:
> > On June 9, 2021 1:20:32 PM Alan Mackenzie <acm@muc.de> wrote:
> [ .... ]
> > > You could instead try to specify which tokens should get
> > > font-lock-type-face and which shouldn't, thus giving something
> > > concrete to discuss. I think this will be difficult to do well, and
> > > may lead to the result which I alluded to above.
> > Sure. To be more precise: what I propose is not applying
> > font-lock-type-face to symbols when we think that symbol is a type solely
> > because it's been entered into cc-mode's table of dynamically discovered
> > types for the current buffer.
> OK, I'll make a trial implementation of this, controlled by a user option
> to switch it on and off. Give me just a little time.
Would you please try the following, setting the new user option to nil,
and let me know how well it meets expectations. Thanks!
diff -r 92a4592886a1 cc-engine.el
--- a/cc-engine.el Sun Apr 25 17:26:38 2021 +0000
+++ b/cc-engine.el Sat Jun 19 15:15:37 2021 +0000
@@ -10441,6 +10441,8 @@
;; There seems no reason to exclude a token from
;; fontification just because it's "a known type that can't
;; be a name or other expression". 2013-09-18.
+ (or c-fontify-found-types
+ (not (eq at-type 'found)))
)
(let ((c-promote-possible-types t))
(save-excursion
diff -r 92a4592886a1 cc-vars.el
--- a/cc-vars.el Sun Apr 25 17:26:38 2021 +0000
+++ b/cc-vars.el Sat Jun 19 15:15:37 2021 +0000
@@ -1639,6 +1639,15 @@
:type 'c-extra-types-widget
:group 'c)
+(defcustom c-fontify-found-types t
+ "If this variable is non-nil \"found types\" will be fontified as types.
+A \"found type\" is a symbol which is identified as a type by its
+context in the source code. `c-fontify-found-types' non-nil then
+causes the same symbol to be fontified elsewhere as a type even
+where its context is ambiguous."
+ :type 'boolean
+ :group 'c)
+
(defcustom c-asymmetry-fontification-flag t
"Whether to fontify certain ambiguous constructs by white space asymmetry.
--
Alan Mackenzie (Nuremberg, Germany).
- Re: cc-mode fontification feels random, (continued)
- Re: cc-mode fontification feels random, tomas, 2021/06/12
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/12
- Re: cc-mode fontification feels random, Daniel Colascione, 2021/06/09
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/09
- Re: cc-mode fontification feels random, Alan Mackenzie, 2021/06/09
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/09
- Re: cc-mode fontification feels random, Daniel Colascione, 2021/06/10
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/10
- Re: cc-mode fontification feels random, Daniel Colascione, 2021/06/09
- Re: cc-mode fontification feels random, Alan Mackenzie, 2021/06/19
- Re: cc-mode fontification feels random,
Alan Mackenzie <=
- Re: cc-mode fontification feels random, Eli Zaretskii, 2021/06/08
- Re: cc-mode fontification feels random, Stefan Monnier, 2021/06/08
- Re: cc-mode fontification feels random, Richard Stallman, 2021/06/08
- Re: cc-mode fontification feels random, martin rudalics, 2021/06/09
- `open-paren-in-column-0-is-defun-start` (was: cc-mode fontification feels random), Stefan Monnier, 2021/06/09
- Re: `open-paren-in-column-0-is-defun-start` (was: cc-mode fontification feels random), Yuri Khan, 2021/06/09
- Re: `open-paren-in-column-0-is-defun-start` (was: cc-mode fontification feels random), Yuri Khan, 2021/06/09
- Re: cc-mode fontification feels random, João Távora, 2021/06/12
- Re: cc-mode fontification feels random, martin rudalics, 2021/06/13
- Re: cc-mode fontification feels random, João Távora, 2021/06/13