[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modify text appearance (put spaces after commas just for display)
From: |
Nick Helm |
Subject: |
Re: Modify text appearance (put spaces after commas just for display) |
Date: |
Wed, 27 Sep 2017 02:26:04 +1300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) |
Alberto Luaces <aluaces@udc.es> writes:
> Hello, I have some inherited code where the style used was to squeeze
> every single non-required white-space. There are long lists of
> comma-separated values with any spaces on them, rendering the code very
> difficult to read.
>
> 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?
Another option is to alter the buffer's display table by repurposing
whitespace-mode. For example:
(add-hook 'text-mode-hook (lambda ()
(set (make-local-variable 'whitespace-style) '(space-mark))
(set (make-local-variable 'whitespace-display-mappings)
'((space-mark 44 [44 32])))
(whitespace-mode)))
Change the hook to the language mode you're using. M-x whitespace-mode
toggles the effect off and on, as usual.
--
Nick
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),
Nick Helm <=
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