[Top][All Lists]

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

tty-format.el -- ANSI SGR and backspace overstriking

From: Kevin Ryde
Subject: tty-format.el -- ANSI SGR and backspace overstriking
Date: Fri, 11 May 2007 10:18:41 +1000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

This is another idea I've had bouncing around and hadn't until now
worked up properly.  I struck a few text files with backspace
overstriking (to make bold on a line printer) and some ANSI escapes
(likewise) and wanted a nice way to view them, so this is a couple of
format-alist entries to do that.

I know ansi-color.el can apply overlays, but I made text properties so
in theory you can cut and paste into another formatted document.
Dunno quite how often that would arise though.

The ansi would almost be a sensible format to save, perhaps with some
marker sequence at the start of the file, but I suspect its time has
passed.  You'd have thought backspace overstriking definitely would
have died with the printers it was for, yet it's still found in for
instance the current debian groff meintro.txt documentation.

The foo.txt below is a sample showing what happens on decode (if it
hasn't been mangled by the mail).

        M-x format-decode-buffer ansi-sgr
        M-x format-decode-buffer backspace-overstrike

The `tty-format-guess' function is my best idea to automate detection
of this sort of thing.  Far from ideal, but works ok in practice.

Attachment: tty-format.el
Description: application/emacs-lisp

Attachment: tty-format.el.asc.txt
Description: Text document

Attachment: foo.txt
Description: Text document

reply via email to

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