Code Monkey home page Code Monkey logo

Comments (13)

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

I can reproduce your issue with emacs -Q:

tmp11

If I erase '>' and write it again the font lock (from c++-mode) gets refreshed and displays it nicely:

tmp12

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:

tmp13

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.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

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.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

Link to the cc-mode issue. Feel free to jump in the thread.

from modern-cpp-font-lock.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

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.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

FYI, reply from Alan Mackenzie: https://sourceforge.net/p/cc-mode/mailman/message/35750252/

from modern-cpp-font-lock.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

from modern-cpp-font-lock.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

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.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

from modern-cpp-font-lock.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

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.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

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.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

from modern-cpp-font-lock.

nickjmeyer avatar nickjmeyer commented on August 17, 2024

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.

ludwigpacifici avatar ludwigpacifici commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.