[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: displaying one character per line.
From: |
Floyd Davidson |
Subject: |
Re: displaying one character per line. |
Date: |
Mon, 23 Feb 2004 00:40:47 -0900 |
User-agent: |
gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0 |
Joe Corneli <jcorneli@math.utexas.edu> wrote:
>What to do to get this to look like this:
>
>W
>h
>a
...
>I don't mean just the search-and-replace solution: I am thinking
>that the buffer should have the same content as it does normally,
>just shown in this weird display mode. I'd also like to be able to
>do a word-based version of the same thing:
>
>What
>to
If you replace each character in the current-display-table with
a string that is the same character plus a newline, you'll get
the first display. The second is much shorter, as all that
needs replacing are spaces and tabs, each with a newline.
There's a slight difference between GNU Emacs and the latest
versions of XEmacs for setting the display table.
This function doesn't do what you are asking about, but it does
the same thing with other characters (extended ascii characters
that the fonts I use have no characters for). You can pretty
much tell from this example how to do what you want.
;;;
;;; Display various extended ascii characters
;;;
(defvar bdt (make-display-table))
(defun fld-fix-current-display-table ()
"Change current-display-table to print various high bit
extended ASCII characters as regular ascii characters
or a string.
\\200 --> EUR \\214 --> OE \\227 --> ---
\\202 --> , \\221 --> \` \\226 --> --
\\203 --> f \\222 --> \' \\230 --> ~
\\204 --> ,, \\223 --> \" \\231 --> (TM)
\\205 --> ... \\224 --> \" \\233 --> >
\\213 --> < \\225 --> * \\234 --> oe"
(interactive)
(setq bdt (make-display-table))
(aset bdt ?\200 [?E ?U ?R]) ;\200 = EUR
(aset bdt ?\202 [?,]) ;\202 = ,
(aset bdt ?\203 [?f]) ;\203 = f
(aset bdt ?\204 [?, ?,]) ;\204 = ,,
(aset bdt ?\205 [?. ?. ?.]) ;\205 = ...
(aset bdt ?\213 [?<]) ;\213 = <
(aset bdt ?\214 [?O ?E]) ;\214 = OE
(aset bdt ?\221 [?`]) ;\221 = `
(aset bdt ?\222 [?']) ;\222 = '
(aset bdt ?\223 [?\"]) ;\223 = "
(aset bdt ?\224 [?\"]) ;\224 = "
(aset bdt ?\225 [?*]) ;\225 = *
(aset bdt ?\226 [?- ?-]) ;\226 = --
(aset bdt ?\227 [?- ?- ?-]) ;\227 = ---
(aset bdt ?\230 [?~]) ;\230 = ~
(aset bdt ?\231 [?( ?T ?m ?)]) ;\231 = (Tm)
(aset bdt ?\233 [?>]) ;\233 = >
(aset bdt ?\234 [?o ?e]) ;\230 = oe
;; comment out this line for use with GNU Emacs
(set-specifier current-display-table bdt))
(setq buffer-display-table current-display-table))
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com