Commit 434eeae3 authored by Johan Sundström's avatar Johan Sundström
Browse files

Texts imported to kom are rarely, if ever, in swascii; do not treat them as such.

parent 5ff963c6
2002-02-04 Johan Sundström <jhs@lysator.liu.se>
* view-text.el
(lyskom-view-text-convert-ISO-646-SE-to-ISO-8859-1):
Also, don't convert texts created by a mail importer. (The theory
here is that all ol'e farts writing swedish in swascii pursue this
practice only in kom, and that few people writing on mailing lists
imported to kom do.)
2002-01-30 Johan Sundström <jhs@lysator.liu.se> 2002-01-30 Johan Sundström <jhs@lysator.liu.se>
* view-text.el * view-text.el
......
...@@ -425,34 +425,36 @@ when put in your `lyskom-view-text-hook'." ...@@ -425,34 +425,36 @@ when put in your `lyskom-view-text-hook'."
;(add-hook 'lyskom-view-text-hook 'lyskom-filter-signature-hook) ;(add-hook 'lyskom-view-text-hook 'lyskom-filter-signature-hook)
(defun lyskom-view-text-convert-ISO-646-SE-to-ISO-8859-1 () (defun lyskom-view-text-convert-ISO-646-SE-to-ISO-8859-1 ()
"Display r{ksm|rg}s as räksmörgås (unless \"å o\"; converting "Display r{ksm|rg}s as räksmörgås unless the text is an imported mail
][\\}{| but not ^~@`. Yet another useful function to put in your or we are reviewing without conversion. In other words, the characters
`lyskom-view-text-hook'." ][\\}{| are converted, however ^~@` are not. Yet another useful function
;; First the hard part - should we patch the text to put in your `lyskom-view-text-hook'."
;; in the text object? ;; First the hard part - should we patch the text
(if (not (equal lyskom-current-command ;; in the text object?
'kom-review-noconversion)) (unless (or (equal lyskom-current-command
;; Yes, modify the text from the text-object (stored in mod) 'kom-review-noconversion)
(let* ((mod (aref (cdr lyskom-view-text-text) 1)) (lyskom-text-is-mail-p lyskom-view-text-text-stat))
(brk (string-match "\n" mod)) ;; Yes, modify the text from the text-object (stored in mod)
(sbj (if brk (substring mod 0 brk) mod)) (let* ((mod (aref (cdr lyskom-view-text-text) 1))
(txt (if brk (substring mod (1+ brk)) "")) (brk (string-match "\n" mod))
(tbl '((?\] . ?\305) ; Å (sbj (if brk (substring mod 0 brk) mod))
(?\[ . ?\304) ; Ä (txt (if brk (substring mod (1+ brk)) ""))
(?\\ . ?\326) ; Ö (tbl '((?\] . ?\305) ; Å
(?\} . ?\345) ; å (?\[ . ?\304) ; Ä
(?\{ . ?\344) ; ä (?\\ . ?\326) ; Ö
(?\| . ?\366)))) ; ö (?\} . ?\345) ; å
(when (and (not (string-match "[\200-\377]" txt)) (?\{ . ?\344) ; ä
(or (string-match "[A-Za-z][][\\}{|]" txt) (?\| . ?\366)))) ; ö
(string-match "[][\\}{|][A-Za-z]" txt) (when (and (not (string-match "[\200-\377]" txt))
(string-match "[A-Za-z] +[][\\}{|]" txt))) (or (string-match "[A-Za-z][][\\}{|]" txt)
(lyskom-signal-reformatted-text 'reformat-deswascii) (string-match "[][\\}{|][A-Za-z]" txt)
(while (string-match "\\([][\\}{|]\\)" txt) (string-match "[A-Za-z] +[][\\}{|]" txt)))
(let ((old-char (aref (match-string 1 txt) 0))) (lyskom-signal-reformatted-text 'reformat-deswascii)
(aset txt (match-beginning 1) (cdr (assoc old-char tbl))))) (while (string-match "\\([][\\}{|]\\)" txt)
(aset (cdr lyskom-view-text-text) 1 (let ((old-char (aref (match-string 1 txt) 0)))
(if brk (concat sbj "\n" txt) sbj)))))) (aset txt (match-beginning 1) (cdr (assoc old-char tbl)))))
(aset (cdr lyskom-view-text-text) 1
(if brk (concat sbj "\n" txt) sbj))))))
;(add-hook 'lyskom-view-text-hook 'lyskom-view-text-convert-ISO-646-SE-to-ISO-8859-1) ;(add-hook 'lyskom-view-text-hook 'lyskom-view-text-convert-ISO-646-SE-to-ISO-8859-1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment