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

  • SEARCH
  • Home
  • 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 8253739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:58:39+00:00 2026-06-08T00:58:39+00:00

Inspired by ia Writer’s focus mode, I’m interested in using font + background colors

  • 0

Inspired by ia Writer’s focus mode, I’m interested in using font + background colors in emacs to accentuate the function the cursor is in and visually cue the rest of the code as the background (I use C++, but it would be nice if this worked regardless of the programming language).

Ideally the font color of code outside the function would be dimmed (this is how focus mode works). A simpler solution probably be to change the background color slightly for the function that the cursor is currently in. How can this be done?

  • 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-06-08T00:58:41+00:00Added an answer on June 8, 2026 at 12:58 am

    Nothing like this exists AFAIK. If you want it to write it yourself, here is a sketch:

    1. Write a routine that determines the boundaries of the current function. The easiest way to do this is with (bounds-of-thing-at-point 'defun).

    2. Write a routine that, when given the bounds of a region, gets the background face property of the region of the region, darkens it, and applies the new face to the region.

    3. Override font-lock-fontify-region-function (see here) with a routine that calls the original value of this variable, differences the region given with the region of the current defun (using #1), and then applies routine #2 to the remaining region.

    I would prefer overriding font lock to, say, using jit-lock-register because you need to control the order of fontification.

    HTH!

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

Sidebar

Related Questions

Inspired by Stack Overflow question Idomatic batch processing of text in Emacs? I tried out
Inspired by Muhammad Alkarouri answer in What are good uses for Python3's "Function Annotations"
I was inspired by another question to write a script (or rather a one-liner)
Inspired by a now-deleted question; given a regex with named groups, is there a
Inspired by the XKCD geohashing comic (http://imgs.xkcd.com/comics/geohashing.png), I thought I'd have a go at
Inspired by this question , I'd like to know whether there is any trick
Inspired by the discussion in this question . We have all been taught that
Inspired by how Log4j reload its configuration files everytime I change it, I wrote
Inspired by How can I marshal a hash with arrays? I wonder what's the
Inspired by Chromium's sha1 class , I am thinking to store incrementally downloaded data

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.