Mercurial > emacs
annotate lisp/international/swedish.el @ 89196:5dee2a648800
(Flanginfo): Fix typo.
author | Dave Love <fx@gnu.org> |
---|---|
date | Thu, 10 Oct 2002 23:03:13 +0000 |
parents | dc16da3f414d |
children | 2f877ed80fa6 |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
17916
diff
changeset
|
1 ;;; swedish.el --- miscellaneous functions for dealing with Swedish |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
2 |
841 | 3 ;; Copyright (C) 1988 Free Software Foundation, Inc. |
4 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Author: Howard Gayle |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
6 ;; Maintainer: FSF |
3012
d4b85bbedee8
Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents:
841
diff
changeset
|
7 ;; Keywords: i18n |
583 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
583 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
583 | 25 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
17916
diff
changeset
|
26 ;;; Commentary: |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
17916
diff
changeset
|
27 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
28 ;;; Code: |
583 | 29 |
89161 | 30 ;; Fixme: Is this actually used? if so, it should be in language, |
31 ;; possibly as a feature property of Swedish, probably defining a | |
32 ;; `swascii' coding system. | |
33 | |
583 | 34 ;; Written by Howard Gayle. See case-table.el for details. |
35 | |
36 ;; See iso-swed.el for a description of the character set. | |
37 | |
38 (defvar swedish-re | |
39 "[ \t\n]\\(och\\|att\\|en\\|{r\\|\\[R\\|p}\\|P\\]\\|som\\|det\\|av\\|den\\|f|r\\|F\\\\R\\)[ \t\n.,?!:;'\")}]" | |
40 "Regular expression for common Swedish words.") | |
41 | |
42 (defvar swascii-to-8859-trans | |
43 (let ((string (make-string 256 ? )) | |
44 (i 0)) | |
45 (while (< i 256) | |
46 (aset string i i) | |
47 (setq i (1+ i))) | |
48 (aset string ?\[ 196) | |
49 (aset string ?\] 197) | |
50 (aset string ?\\ 214) | |
51 (aset string ?^ 220) | |
52 (aset string ?\{ 228) | |
53 (aset string ?\} 229) | |
54 (aset string ?\` 233) | |
55 (aset string ?\| 246) | |
56 (aset string ?~ 252) | |
57 string) | |
58 "Trans table from SWASCII to 8859.") | |
59 | |
60 ; $ is not converted because it almost always means US | |
61 ; dollars, not general currency sign. @ is not converted | |
62 ; because it is more likely to be an at sign in a mail address | |
63 ; than an E with acute accent. | |
64 | |
65 (defun swascii-to-8859-buffer () | |
66 "Convert characters in buffer from Swedish/Finnish-ascii to ISO 8859/1. | |
67 Works even on read-only buffers. `$' and `@' are not converted." | |
68 (interactive) | |
69 (let ((buffer-read-only nil)) | |
70 (translate-region (point-min) (point-max) swascii-to-8859-trans))) | |
71 | |
72 (defun swascii-to-8859-buffer-maybe () | |
73 "Call swascii-to-8859-buffer if the buffer looks like Swedish-ascii. | |
74 Leaves point just after the word that looks Swedish." | |
75 (interactive) | |
76 (let ((case-fold-search t)) | |
77 (if (re-search-forward swedish-re nil t) | |
78 (swascii-to-8859-buffer)))) | |
79 | |
80 (setq rmail-show-message-hook 'swascii-to-8859-buffer-maybe) | |
81 | |
82 (or (boundp 'news-group-hook-alist) (setq news-group-hook-alist nil)) | |
83 (setq news-group-hook-alist | |
84 (append '(("^swnet." . swascii-to-8859-buffer-maybe)) | |
85 news-group-hook-alist)) | |
86 | |
87 (defvar 8859-to-swascii-trans | |
88 (let ((string (make-string 256 ? )) | |
89 (i 0)) | |
90 (while (< i 256) | |
91 (aset string i i) | |
92 (setq i (1+ i))) | |
93 (aset string 164 ?$) | |
94 (aset string 196 ?\[) | |
95 (aset string 197 ?\]) | |
96 (aset string 201 ?@) | |
97 (aset string 214 ?\\) | |
98 (aset string 220 ?^) | |
99 (aset string 228 ?\{) | |
100 (aset string 229 ?\}) | |
101 (aset string 233 ?\`) | |
102 (aset string 246 ?\|) | |
103 (aset string 252 ?~) | |
104 string) | |
105 "8859 to SWASCII trans table.") | |
106 | |
107 (defun 8859-to-swascii-buffer () | |
108 "Convert characters in buffer from ISO 8859/1 to Swedish/Finnish-ascii." | |
109 (interactive "*") | |
110 (translate-region (point-min) (point-max) 8859-to-swascii-trans)) | |
111 | |
112 (setq mail-send-hook '8859-to-swascii-buffer) | |
113 (setq news-inews-hook '8859-to-swascii-buffer) | |
114 | |
115 ;; It's not clear what purpose is served by a separate | |
116 ;; Swedish mode that differs from Text mode only in having | |
117 ;; a separate abbrev table. Nothing says that the abbrevs you | |
118 ;; define in Text mode have to be English! | |
119 | |
120 ;(defvar swedish-mode-abbrev-table nil | |
121 ; "Abbrev table used while in swedish mode.") | |
122 ;(define-abbrev-table 'swedish-mode-abbrev-table ()) | |
123 | |
124 ;(defun swedish-mode () | |
125 ; "Major mode for editing Swedish text intended for humans to | |
126 ;read. Special commands:\\{text-mode-map} | |
127 ;Turning on swedish-mode calls the value of the variable | |
128 ;text-mode-hook, if that value is non-nil." | |
129 ; (interactive) | |
130 ; (kill-all-local-variables) | |
131 ; (use-local-map text-mode-map) | |
132 ; (setq mode-name "Swedish") | |
133 ; (setq major-mode 'swedish-mode) | |
134 ; (setq local-abbrev-table swedish-mode-abbrev-table) | |
135 ; (set-syntax-table text-mode-syntax-table) | |
136 ; (run-hooks 'text-mode-hook)) | |
137 | |
138 ;(defun indented-swedish-mode () | |
139 ; "Major mode for editing indented Swedish text intended for | |
140 ;humans to read.\\{indented-text-mode-map} | |
141 ;Turning on indented-swedish-mode calls the value of the | |
142 ;variable text-mode-hook, if that value is non-nil." | |
143 ; (interactive) | |
144 ; (kill-all-local-variables) | |
145 ; (use-local-map text-mode-map) | |
146 ; (define-abbrev-table 'swedish-mode-abbrev-table ()) | |
147 ; (setq local-abbrev-table swedish-mode-abbrev-table) | |
148 ; (set-syntax-table text-mode-syntax-table) | |
149 ; (make-local-variable 'indent-line-function) | |
150 ; (setq indent-line-function 'indent-relative-maybe) | |
151 ; (use-local-map indented-text-mode-map) | |
152 ; (setq mode-name "Indented Swedish") | |
153 ; (setq major-mode 'indented-swedish-mode) | |
154 ; (run-hooks 'text-mode-hook)) | |
155 | |
156 (provide 'swedish) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
157 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
158 ;;; swedish.el ends here |