Comments (13)
I can reproduce your issue with emacs -Q
:
If I erase '>' and write it again the font lock (from c++-mode
) gets refreshed and displays it nicely:
However, modern-cpp-font-lock aims to highlight C++ keywords (int
, auto
, nullptr
, etc.). The code parsing, and extra font lock is done by c++-mode
. If you want to see only the effect of modern-cpp-font-lock, use M-x text-mode
and M-x modern-c++-font-lock-mode
:
The best solution, is to fix the issue in the right place which is c++-mode
. If you wish, I can report for you this issue to the maintainer?
from modern-cpp-font-lock.
Ah, gotcha. Thanks for investigating this! If you wouldn't mind submittng a report that'd be great. I've never submitted an official bug report, so might be nice to see what it looks like. Could you place the link to the bug report submission in this thread for reference? That way I can follow the status of it.
(Also, I did find something else that does seem to be a modern-cpp-font-lock
issue. It's a separate thing so I'll make another post.)
from modern-cpp-font-lock.
Link to the cc-mode issue. Feel free to jump in the thread.
from modern-cpp-font-lock.
This is great. I really appreciate you taking the time to do that. I read through the post and will be curious to see what the maintainer has to say!
from modern-cpp-font-lock.
FYI, reply from Alan Mackenzie: https://sourceforge.net/p/cc-mode/mailman/message/35750252/
from modern-cpp-font-lock.
from modern-cpp-font-lock.
A patch from Alan Mackenzie is available for your issue: https://sourceforge.net/p/cc-mode/mailman/message/35771591/
I will do some tests. That would be great if you can do some on your side as well.
from modern-cpp-font-lock.
from modern-cpp-font-lock.
Test it on the code where you saw the error. For example, the snippet in your first post. Ii understand it is manual tests - I am not aware of testing framework in the cc-mode
.
I will do some checks as well. Do you agree with the Fix of Alan?
from modern-cpp-font-lock.
I tried to apply the patch using the apply
utility, but it rejected 2/3 of the chunks. I tried to figure out the discrepancy by hand. It seemed to work (i.e., compile and run).
I checked any files I can remember where I ran into this issue and it seems to be fixed. I did send Alan a PM to see which version of cc-mode
the patch should be applied to as it didn't apply directly, so I'm assuming hes testing a different version.
from modern-cpp-font-lock.
from modern-cpp-font-lock.
To apply the patch I did patch -p1 < filename.diff
and I get the output:
patching file cc-engine.el
Hunk #1 succeeded at 6005 with fuzz 2.
Hunk #2 FAILED at 6972.
Hunk #3 FAILED at 6988.
2 out of 3 hunks FAILED -- saving rejects to file cc-engine.el.rej
patching file cc-mode.el
The file cc-engine.el.rej
looks like:
***************
*** 6965,6970 ****
;; This function might do hidden buffer changes.
(let ((start (point))
;; If `c-record-type-identifiers' is set then activate
;; recording of any found types that constitute an argument in
;; the arglist.
--- 6972,6978 ----
;; This function might do hidden buffer changes.
(let ((start (point))
+ (old-found-types (c-copy-found-types))
;; If `c-record-type-identifiers' is set then activate
;; recording of any found types that constitute an argument in
;; the arglist.
***************
*** 6980,6985 ****
(nconc c-record-found-types c-record-type-identifiers)))
t)
(goto-char start)
nil)))
--- 6988,6994 ----
(nconc c-record-found-types c-record-type-identifiers)))
t)
+ (setq c-found-types old-found-types)
(goto-char start)
nil)))
I'm pretty sure I was able to figure out which lines needed to be edited to apply the patch. Though I figured it would be best to test the version he is working on.
from modern-cpp-font-lock.
Hello @nickjmeyer
I will close this issue as it is not related to this project. Alan, commited a partial fix. If you use GNU Emacs 26, you'll get a better highlight. I thank you for your bug report. If you see another issue, do not hesitate to raise a bug here or directly to cc-mode.
from modern-cpp-font-lock.
Related Issues (20)
- Integration with RTags HOT 3
- Modern C++ indentation? HOT 3
- Raw strings do not work HOT 3
- String literals isn't showing correctly when there are quotes HOT 3
- Raw string literal isn't handled correctly. HOT 2
- Integer literal font lock HOT 3
- second function argument type is rendered as a variable HOT 4
- clash between modern-c++-font-lock-mode and built-in c++-mode HOT 3
- string literal isn't rendered at all. HOT 2
- Inclusion in Emacs core HOT 4
- if constexpr indent HOT 2
- expected to work with GNU Emacs 25.2.2? HOT 2
- trouble with string literals HOT 2
- Trouble with attributes HOT 1
- operator""() wrecks font-lock HOT 2
- Font lock for function calls HOT 2
- Hexadecimal digits prefix highlights as keyword HOT 3
- Variable "Is_PragmaLexer" isn't correctly highlighted
- Does this package support C++20 features? HOT 2
- `concept` keyword HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modern-cpp-font-lock.