Gnus development mailing list
 help / color / mirror / Atom feed
* A useful washing function
@ 1998-08-14 18:11 Michael Welsh Duggan
  1998-08-14 18:33 ` Michael Welsh Duggan
  1998-08-14 19:10 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Welsh Duggan @ 1998-08-14 18:11 UTC (permalink / raw)



I don't know who else this would be of use to, but I find it extremely
useful when looking at some of the crufty messages I see people send
out full of system-dependent control characters and such.

(defun gnus-summary-modify-display-table (char string)
  "Changes the display table of the article buffer.
This function takes CHAR and modifies the display table in the article
buffer such that instances of the character show up as STRING."
  (interactive (list (string-to-char (read-string "Char: "))
                     (read-string "Replacement: ")))
  (gnus-eval-in-buffer-window gnus-article-buffer
    (let ((bdt (or buffer-display-table (make-display-table))))
      (aset bdt char (vconcat string))
      (setq buffer-display-table bdt))))

It might be nice to have this or something like this as an article
washing function in gnus.  Of course, to be useful you also have to
have a function in the gnus-article-diplay-hook which resets the
buffer-display-table to some default.

-- 
Michael Duggan
(md5i@cs.cmu.edu)

.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A useful washing function
  1998-08-14 18:11 A useful washing function Michael Welsh Duggan
@ 1998-08-14 18:33 ` Michael Welsh Duggan
  1998-08-14 19:10 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Welsh Duggan @ 1998-08-14 18:33 UTC (permalink / raw)



Michael Welsh Duggan <md5i@cs.cmu.edu> writes:

> (defun gnus-summary-modify-display-table (char string)
>   "Changes the display table of the article buffer.
> This function takes CHAR and modifies the display table in the article
> buffer such that instances of the character show up as STRING."

Actually, this version might be better:

(defun gnus-summary-modify-display-table (chars string)
  "Changes the display table of the article buffer.
This function takes CHARS and modifies the display table in the article
buffer such that instances of those characters show up as STRING."
  (interactive (list (read-string "Char: ")
                     (read-string "Replacement: ")))
  (gnus-eval-in-buffer-window gnus-article-buffer
    (let ((bdt (or buffer-display-table (make-display-table))))
      (mapcar chars (lambda (char) (aset bdt char (vconcat string))))
      (setq buffer-display-table bdt))))

-- 
Michael Duggan
(md5i@cs.cmu.edu)
.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A useful washing function
  1998-08-14 18:11 A useful washing function Michael Welsh Duggan
  1998-08-14 18:33 ` Michael Welsh Duggan
@ 1998-08-14 19:10 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-08-14 19:10 UTC (permalink / raw)


Michael Welsh Duggan <md5i@cs.cmu.edu> writes:

> I don't know who else this would be of use to, but I find it extremely
> useful when looking at some of the crufty messages I see people send
> out full of system-dependent control characters and such.

[...]

> It might be nice to have this or something like this as an article
> washing function in gnus.  Of course, to be useful you also have to
> have a function in the gnus-article-diplay-hook which resets the
> buffer-display-table to some default.

I don't think fiddling with the display table is the right thing to
do.  Instead, it should translate the text into what you are using, so
that you can follow up to articles without propagating the breakage.

The `article-translate-characters' function is a framework for
character translation.  There is currently only one command that uses
it -- the command to translate dumbquotes into Latin-1.

I think someone should write a slew of commands to translate from
various buggy charsets, and we could put that on the `W C' keymap.
There should also be a command to guess what the articles charset is,
and then apply the required translation.

I have little use for this, but if anyone wants to write this, I'll
apply the patches.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-08-14 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-14 18:11 A useful washing function Michael Welsh Duggan
1998-08-14 18:33 ` Michael Welsh Duggan
1998-08-14 19:10 ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).