[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 <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.
>
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!
--
Alberto
- Re: Modify text appearance (put spaces after commas just for display), (continued)
- Re: Modify text appearance (put spaces after commas just for display), tomas, 2017/09/28
- Re: Modify text appearance (put spaces after commas just for display), Emanuel Berg, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), tomas, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), Emanuel Berg, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), tomas, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), Emanuel Berg, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), Kendall Shaw, 2017/09/28
- Re: Modify text appearance (put spaces after commas just for display), Emanuel Berg, 2017/09/29
- Re: Modify text appearance (put spaces after commas just for display), Emanuel Berg, 2017/09/28
Re: Modify text appearance (put spaces after commas just for display), Yuri Khan, 2017/09/26
- Re: Modify text appearance (put spaces after commas just for display),
Alberto Luaces <=
Re: Modify text appearance (put spaces after commas just for display), Nick Helm, 2017/09/26
Re: Modify text appearance (put spaces after commas just for display), Sivaram Neelakantan, 2017/09/26
Re: Modify text appearance (put spaces after commas just for display), Eli Zaretskii, 2017/09/29