unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Alberto Luaces <aluaces@udc.es>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Modify text appearance (put spaces after commas just for display)
Date: Tue, 26 Sep 2017 17:00:27 +0700	[thread overview]
Message-ID: <CAP_d_8VEHKfwnxn2wssxoR6AY09F9E3j+KWU4nPYaCvR-PjHsQ@mail.gmail.com> (raw)
In-Reply-To: <87tvzpx1qo.fsf@eps142.cdf.udc.es>

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.



  parent reply	other threads:[~2017-09-26 10:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  9:12 Modify text appearance (put spaces after commas just for display) Alberto Luaces
2017-09-26  9:28 ` Emanuel Berg
2017-09-26  9:31   ` Alberto Luaces
2017-09-26  9:32   ` tomas
2017-09-26 10:14     ` Emanuel Berg
2017-09-26 10:30       ` tomas
2017-09-26 11:08         ` Alberto Luaces
2017-09-26 21:29         ` Emanuel Berg
2017-09-27  6:23           ` Marcin Borkowski
2017-09-27  8:20             ` Emanuel Berg
2017-09-27 12:07             ` tomas
2017-09-27 21:40               ` Emanuel Berg
2017-09-28  6:55                 ` tomas
     [not found]             ` <mailman.229.1506975352.27995.help-gnu-emacs@gnu.org>
2017-10-03  1:57               ` James K. Lowden
2017-10-03  2:49                 ` Emanuel Berg
2017-09-27 12:00           ` tomas
2017-09-27 21:30             ` Emanuel Berg
2017-09-28  8:40       ` Kendall Shaw
2017-09-28 11:27         ` Alberto Luaces
2017-09-28 12:09           ` tomas
2017-09-28 16:42             ` Emanuel Berg
2017-09-28 17:18               ` tomas
2017-09-29  6:42                 ` Emanuel Berg
2017-09-29  7:19                   ` tomas
2017-09-29 10:16                     ` Emanuel Berg
2017-09-29 10:34                       ` tomas
2017-09-29 11:40                         ` Emanuel Berg
2017-09-29  2:02               ` Kendall Shaw
2017-09-29  6:45                 ` Emanuel Berg
2017-09-28 16:54         ` Emanuel Berg
2017-09-26 10:00 ` Yuri Khan [this message]
2017-09-26 11:05   ` Alberto Luaces
2017-09-26 13:11     ` Marcin Borkowski
2017-09-26 16:36       ` Alberto Luaces
2017-09-26 13:26 ` Nick Helm
2017-09-26 16:34   ` Alberto Luaces
2017-09-26 14:15 ` Sivaram Neelakantan
2017-09-26 16:39   ` Alberto Luaces
2017-09-29 12:12 ` Eli Zaretskii
2017-09-29 13:59   ` Alberto Luaces

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8VEHKfwnxn2wssxoR6AY09F9E3j+KWU4nPYaCvR-PjHsQ@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=aluaces@udc.es \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).