Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:04:46+00:00 2026-05-28T07:04:46+00:00

In emacs (23.3.1, GNU) i have set a theme (doesn’t matter which i use

  • 0

In emacs (23.3.1, GNU) i have set a theme (doesn’t matter which i use this issue persists). While in C++ mode when i declare a variable the variable is highlighted (this case white) but upon calling that variable again in my program it will not be highlighted white as it was upon declaration. Any ideas why this happens and how to fix it? Thanks in advance. Here is an example although there is obviously no color:

int num; <------- would be white

 cout << "The number is: " << num << endl; <-------- here it would not be white, 

 just regular foreground color?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:04:47+00:00Added an answer on May 28, 2026 at 7:04 am

    That is because it is quite difficult for Emacs to tell that the num in the second statement is a variable without doing a full syntactic parse of the buffer. In theory, Emacs is capable of doing that (see e.g. here), but most modes use regular expressions for keyword highlighting. That implies some limitations on what can be achieved, but is often preferred by mode programmers for its simplicity (oh, well, all is relative).

    You may consider this a weakness of the general purpose text editor that Emacs is, when compared to more specialized IDEs that often do full parsing to provide intelligent error messages, support flexible code browsing and suggest quick fixes for bugs.

    If you want to dive deeper into Emacs syntax highlighting, check out Font Lock and in particular font-lock-keywords, but be warned that it is a complex matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using GNU emacs 23.1.1 on Fedora 12 I have this in my
I want globally enable whitespace-mode. I have tried this in my .emacs: (require 'whitespace)
I'm using GNU Emacs 22.2.1 and cperl 5.23. I have perl code like this:
given all the possible solutions to have a template system with GNU Emacs, what
GNU Emacs 23.1.1 Fedora 13 I can select the colour theme by M-x color-theme-select
I have been using emacs for a while for mainly python programming, and have
I have GNU Emacs 23.4 installed (or, rather, unzipped) into C:\Program Files (x86)\emacs-23.4 on
gcc 4.6.0 GNU Emacs 23.2.1 I have some c code and at some point
I'm using GNU Emacs 22.2.1. I usually use a different editor, but am learning
I put this in my .emacs file: (custom-set-variables '(gud-gdb-command-name gdb --annotate=1) '(large-file-warning-threshold nil) '(menu-bar-mode

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.