help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modify text appearance (put spaces after commas just for display)


From: Yuri Khan
Subject: Re: Modify text appearance (put spaces after commas just for display)
Date: Tue, 26 Sep 2017 17:00:27 +0700

On Tue, Sep 26, 2017 at 4:12 PM, Alberto Luaces <aluaces@udc.es> wrote:

> So, from the top of your head, what would be the less painful method to
> change every comma to a comma+space, or at least change the color of the
> commas to anything more distinguishable and attach it to the language
> mode hook?

One imperfect approximation would be to use prettify-symbols-mode.

    $ emacs -Q

    (add-to-list 'prettify-symbols-alist '("," . (?, (Br . Bl) ?\s)))

    M-x prettify-symbols-mode RET

Limitations:

* Does not act on commas in comments or string literals.
* If a comma is followed by a space, you will see two spaces.

If you want to overcome these, you will either want to write some
custom predicates for prettify-symbols-mode, or dive a layer down and
work with ‘font-lock-add-keywords’ directly.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]