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 8278965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:10:52+00:00 2026-06-08T09:10:52+00:00

EDIT I think pretty-mode is conceptually closer to what I want than the various

  • 0

EDIT I think pretty-mode is conceptually closer to what I want than the various folding mode, but I’d need to be able to replace strings with other strings, instead of a single character. As far as I can tell pretty-mode only allows to replace a string with a unique character.

I’m looking to do something very specific in Emacs and it’s a kind of code folding. I’ve read this:
Code folding in Emacs

which has been closed as a dupe of this:

How to achieve code folding effects in Emacs?

However I’m trying to do something a bit particular in that I don’t want to fold functions lines: I do want to fold characters, on a single line.

I’m also not at all into navigation: it’s not to facilitate navigation. It’s just to de-clutter the screen a bit.

For example if I have this:

super verbose syntax my_bar = 42;
hyper long syntax my_foo = 84;

I’d like to have it appear, inside Emacs, as this:

svs my_bar = 42;
hls my_foo = 84;

Because I’ve not only read a million time “super verbose syntax” / “hyper long syntax” and because since ten years when I type ‘svs’ it’s automatically expanded to “super verbose syntax” and ‘hls’ automatically expanding to “hyper long syntax”, there’s no chance I’d ever use “svs” as a real identifier and there’s no chance I’d not instantly recognize what’s going on. Of course the file/buffer should still contain the awfully verbose syntax.

I purely want a “characters folding on one line”.

So, in short, when I type “super verbose syntax” I’d like it to fold on screen automatically to ‘svs’ (when I enter ‘svs’ TAB it expands to “super verbose syntax”, but that is something else… In my case typing svs TAB would expand to “super verbose syntax” which then should be folded directly to ‘svs’ on screen).

This would save a lot of screen real estate and help me focus on more important things.

(as a cool side effect it would also line up vertically reserved keywords that do not have the same length, making the code even more readable to me)

How can I achieve this under Emacs? Is there a minor-mode already doing this?

  • 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-08T09:10:55+00:00Added an answer on June 8, 2026 at 9:10 am

    Try adding these two expressions to your mode-hook:

    (font-lock-add-keywords
     nil
     '(("super verbose syntax" (0 '(face default display "svs") append))
       ("hyper long syntax" (0 '(face default display "hls") append)))
     t)
    (push 'display font-lock-extra-managed-props)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This question was initially too general, I think. So What I really need
I think my question is pretty stupid, but here it goes: I am using
Edit I think there is some confusion, I am not using both of the
Edit: I think I've figured out how to do the binary data part. Double
EDIT: I have fixed all but two warnings now, so thank you all for
I think the question itself is pretty self-explanatory. The code is given below -
This should be pretty simple, but I can't seem to get it. I have
I finally got back to fleshing out a GitCommit message mode that I want
This is a problem (or design pattern?) which I would think is pretty common,
I searched...can't find any good references. I have what I think is a pretty

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.