[Top][All Lists]

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

Re: Hiding ^M

From: Juanma Barranquero
Subject: Re: Hiding ^M
Date: Mon, 22 Feb 2010 22:35:57 +0100

> For buffers with certain major mode, I'll like to hide ^M characters. It
> is not possible to remove them and adjusting the eol settings of the
> buffer is not an option either (the lines that ends with ^M are mixed
> with "normal" lines).
> Setting the `escape-glyph' face to white foreground would do. Setting
> the specific face of the ^M character would be okay too. But that should
> only apply to buffers with an specific major mode.

You can try this

(define-minor-mode hide-^M-mode
    "Minor mode to hide ^M."
  :init-value nil
  :lighter "hide^M"
  (setq buffer-display-table
        (and hide-^M-mode
             (or (get 'hide-^M-mode :table)
                 (let ((table (or (copy-sequence standard-display-table)
                   (aset table ?\^M [?\u00A0])
                   (aset table ?\^I (vector (make-glyph-code ?\^I 'underline)))
                   (put 'hide-^M-mode :table table))))

and then setting hide-^M-mode in the mode hooks.


reply via email to

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