[Top][All Lists]

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

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

From: Alberto Luaces
Subject: Re: Modify text appearance (put spaces after commas just for display)
Date: Tue, 26 Sep 2017 13:05:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Yuri Khan writes:

> On Tue, Sep 26, 2017 at 4:12 PM, Alberto Luaces <> 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.

Nice solution, thanks!  The limitations are fine by me, since I do not
care about the comments, and having several spaces together does not
hinder my reading.

I like very much how emacs keeps considering the substituted character
as a whole block, so that eases the editing of the file since I know
which spaces are real and which ones are not.

> 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.

Nice to know.  Thanks again!


reply via email to

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