From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/3595 Path: news.gmane.org!not-for-mail From: floyd@barrow.com (Floyd L. Davidson) Newsgroups: gmane.emacs.gnus.user Subject: Re: dealing with windows \222 char Date: Sat, 06 Mar 2004 12:38:22 -0900 Organization: __________ Message-ID: <87u111irld.fld@barrow.com> References: <87znaunir7.fsf@oz.fapse.ulg.ac.be> <87smgmyn0v.fsf@oz.fapse.ulg.ac.be> <87k71x6ew6.fsf@oz.fapse.ulg.ac.be> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138669657 19530 80.91.229.2 (31 Jan 2006 01:07:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 01:07:37 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:32:27 2006 Original-Path: quimby.gnus.org!newsfeed1.e.nsc.no!nsc.no!nextra.com!uio.no!feed.news.tiscali.de!tiscali!newsfeed1.ip.tiscali.net!newshosting.com!nx01.iad01.newshosting.com!uunet!dca.uu.net!ash.uu.net!falcon.america.net!eagle.america.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.gnus User-Agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0 Cancel-Lock: sha1:Ky+zWu6TJebkec2xuwePQwPi/vc= Original-NNTP-Posting-Host: 209.124.156.200 Original-X-Trace: eagle.america.net 1078609161 209.124.156.200 (Sat, 06 Mar 2004 16:39:21 EST) Original-NNTP-Posting-Date: Sat, 06 Mar 2004 16:39:21 EST Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:3736 Original-Lines: 149 X-Gnus-Article-Number: 3736 Tue Jan 17 17:32:27 2006 Xref: news.gmane.org gmane.emacs.gnus.user:3595 Archived-At: Marcus Frings wrote: >* Arnaud Vandyck wrote: > >> Cookie is a great solution and it works really fine... > >Ah, great! > >> I suppose I have to use something like: >> (load-file "~/.gnus_dumbquotes.el") > >Exactly! That's the way how I do it. I have two functions in my init files for GNU Emacs and XEmacs, which affect the same problem. By putting them in the init files I have the functionality available when not running Gnus, as I occasionally find odd extended ascii characters when doing regular editing. One function changes the way the characters are displayed on the screen. The other function modifies the current buffer, making the changes permanent. I've added these to menubar menus, because I don't use them often enough to remember a key sequence. However, in my ~/.gnus file I do add the fld-fix-buffer function to the message-send-news-hook, so that every article I post to Usenet is "fixed" before being posted. That changes any of the specified characters in any quoted text, and it also does untabify on the entire buffer and deletes all trailing white space. There is also a variable to toggle it on or off, and I have a menubar menu item that does that in case I want to post an article that has not been adjusted. ;;; ;;; Display various extended ascii characters ;;; (defvar bdt (make-display-table)) (defun fld-buffer-display-table () "Change current-display-table to print various high bit extended ASCII characters as regular ascii characters or 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 (eval-when-compile (when (not (featurep 'xemacs)) (defun set-specifier (d1 d2) ()))) (when (featurep 'xemacs) (set-specifier current-display-table bdt)) (setq buffer-display-table current-display-table)) ;;; ;;; Untabify and replace various Extended ASCII characters ;;; (defvar fld-fix-buffer-status t) (defun fld-fix-buffer () "Fix a buffer: Trim trailing whitespace, replace tabs with spaces and change various high bit set Extended ASCII characters to seven-bit ASCII equivalents. Disabled when fld-fix-buffer-status is nil. Character replacements are: \\200 --> EUR \\214 --> OE \\227 --> --- \\202 --> , \\221 --> \` \\226 --> -- \\203 --> f \\222 --> \' \\230 --> ~ \\204 --> ,, \\223 --> \" \\231 --> (TM) \\205 --> ... \\224 --> \" \\233 --> > \\213 --> < \\225 --> * \\234 --> oe" (interactive) (if fld-fix-buffer-status (save-excursion (goto-char (point-min)) (replace-regexp "\\([\t ]\\)*$" "") ; trim trailing whitespace (mark-whole-buffer) (untabify (point) (mark)) ; untabify ;; replace various Extended ASCII characters (goto-char (point-min)) (replace-string "\234" "oe") (goto-char (point-min)) (replace-string "\233" ">") (goto-char (point-min)) (replace-string "\231" "(Tm)") (goto-char (point-min)) (replace-string "\230" "~") (goto-char (point-min)) (replace-string "\227" "---") (goto-char (point-min)) (replace-string "\226" "--") (goto-char (point-min)) (replace-string "\225" "*") (goto-char (point-min)) (replace-string "\224" "\"") (goto-char (point-min)) (replace-string "\223" "\"") (goto-char (point-min)) (replace-string "\222" "\'") (goto-char (point-min)) (replace-string "\221" "\`") (goto-char (point-min)) (replace-string "\214" "OE") (goto-char (point-min)) (replace-string "\213" "<") (goto-char (point-min)) (replace-string "\205" "...") (goto-char (point-min)) (replace-string "\204" ",,") (goto-char (point-min)) (replace-string "\203" "f") (goto-char (point-min)) (replace-string "\202" ",") (goto-char (point-min)) (replace-string "\200" "EUR") (goto-char (point-min)) (replace-string "\r\n" "\n") (set-mark nil) (when (featurep 'xemacs) (zmacs-deactivate-region)) ; clears highlighted region (message "Buffer fixed...")))) -- Floyd L. Davidson Ukpeagvik (Barrow, Alaska) floyd@barrow.com