Mercurial > emacs
annotate lisp/international/swedish.el @ 35329:ae7ded32b733
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 16 Jan 2001 11:17:38 +0000 |
parents | 2cfc28884664 |
children | 253f761ad37b |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
1 ;;; swedish.el --- miscellaneous functions for dealing with Swedish. |
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 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
26 ;;; Code: |
583 | 27 |
28 ;; Written by Howard Gayle. See case-table.el for details. | |
29 | |
30 ;; See iso-swed.el for a description of the character set. | |
31 | |
17916
2cfc28884664
iso-syntax.el renamed to latin-1.el.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
32 (require 'latin-1) |
583 | 33 |
34 (defvar swedish-re | |
35 "[ \t\n]\\(och\\|att\\|en\\|{r\\|\\[R\\|p}\\|P\\]\\|som\\|det\\|av\\|den\\|f|r\\|F\\\\R\\)[ \t\n.,?!:;'\")}]" | |
36 "Regular expression for common Swedish words.") | |
37 | |
38 (defvar swascii-to-8859-trans | |
39 (let ((string (make-string 256 ? )) | |
40 (i 0)) | |
41 (while (< i 256) | |
42 (aset string i i) | |
43 (setq i (1+ i))) | |
44 (aset string ?\[ 196) | |
45 (aset string ?\] 197) | |
46 (aset string ?\\ 214) | |
47 (aset string ?^ 220) | |
48 (aset string ?\{ 228) | |
49 (aset string ?\} 229) | |
50 (aset string ?\` 233) | |
51 (aset string ?\| 246) | |
52 (aset string ?~ 252) | |
53 string) | |
54 "Trans table from SWASCII to 8859.") | |
55 | |
56 ; $ is not converted because it almost always means US | |
57 ; dollars, not general currency sign. @ is not converted | |
58 ; because it is more likely to be an at sign in a mail address | |
59 ; than an E with acute accent. | |
60 | |
61 (defun swascii-to-8859-buffer () | |
62 "Convert characters in buffer from Swedish/Finnish-ascii to ISO 8859/1. | |
63 Works even on read-only buffers. `$' and `@' are not converted." | |
64 (interactive) | |
65 (let ((buffer-read-only nil)) | |
66 (translate-region (point-min) (point-max) swascii-to-8859-trans))) | |
67 | |
68 (defun swascii-to-8859-buffer-maybe () | |
69 "Call swascii-to-8859-buffer if the buffer looks like Swedish-ascii. | |
70 Leaves point just after the word that looks Swedish." | |
71 (interactive) | |
72 (let ((case-fold-search t)) | |
73 (if (re-search-forward swedish-re nil t) | |
74 (swascii-to-8859-buffer)))) | |
75 | |
76 (setq rmail-show-message-hook 'swascii-to-8859-buffer-maybe) | |
77 | |
78 (or (boundp 'news-group-hook-alist) (setq news-group-hook-alist nil)) | |
79 (setq news-group-hook-alist | |
80 (append '(("^swnet." . swascii-to-8859-buffer-maybe)) | |
81 news-group-hook-alist)) | |
82 | |
83 (defvar 8859-to-swascii-trans | |
84 (let ((string (make-string 256 ? )) | |
85 (i 0)) | |
86 (while (< i 256) | |
87 (aset string i i) | |
88 (setq i (1+ i))) | |
89 (aset string 164 ?$) | |
90 (aset string 196 ?\[) | |
91 (aset string 197 ?\]) | |
92 (aset string 201 ?@) | |
93 (aset string 214 ?\\) | |
94 (aset string 220 ?^) | |
95 (aset string 228 ?\{) | |
96 (aset string 229 ?\}) | |
97 (aset string 233 ?\`) | |
98 (aset string 246 ?\|) | |
99 (aset string 252 ?~) | |
100 string) | |
101 "8859 to SWASCII trans table.") | |
102 | |
103 (defun 8859-to-swascii-buffer () | |
104 "Convert characters in buffer from ISO 8859/1 to Swedish/Finnish-ascii." | |
105 (interactive "*") | |
106 (translate-region (point-min) (point-max) 8859-to-swascii-trans)) | |
107 | |
108 (setq mail-send-hook '8859-to-swascii-buffer) | |
109 (setq news-inews-hook '8859-to-swascii-buffer) | |
110 | |
111 ;; It's not clear what purpose is served by a separate | |
112 ;; Swedish mode that differs from Text mode only in having | |
113 ;; a separate abbrev table. Nothing says that the abbrevs you | |
114 ;; define in Text mode have to be English! | |
115 | |
116 ;(defvar swedish-mode-abbrev-table nil | |
117 ; "Abbrev table used while in swedish mode.") | |
118 ;(define-abbrev-table 'swedish-mode-abbrev-table ()) | |
119 | |
120 ;(defun swedish-mode () | |
121 ; "Major mode for editing Swedish text intended for humans to | |
122 ;read. Special commands:\\{text-mode-map} | |
123 ;Turning on swedish-mode calls the value of the variable | |
124 ;text-mode-hook, if that value is non-nil." | |
125 ; (interactive) | |
126 ; (kill-all-local-variables) | |
127 ; (use-local-map text-mode-map) | |
128 ; (setq mode-name "Swedish") | |
129 ; (setq major-mode 'swedish-mode) | |
130 ; (setq local-abbrev-table swedish-mode-abbrev-table) | |
131 ; (set-syntax-table text-mode-syntax-table) | |
132 ; (run-hooks 'text-mode-hook)) | |
133 | |
134 ;(defun indented-swedish-mode () | |
135 ; "Major mode for editing indented Swedish text intended for | |
136 ;humans to read.\\{indented-text-mode-map} | |
137 ;Turning on indented-swedish-mode calls the value of the | |
138 ;variable text-mode-hook, if that value is non-nil." | |
139 ; (interactive) | |
140 ; (kill-all-local-variables) | |
141 ; (use-local-map text-mode-map) | |
142 ; (define-abbrev-table 'swedish-mode-abbrev-table ()) | |
143 ; (setq local-abbrev-table swedish-mode-abbrev-table) | |
144 ; (set-syntax-table text-mode-syntax-table) | |
145 ; (make-local-variable 'indent-line-function) | |
146 ; (setq indent-line-function 'indent-relative-maybe) | |
147 ; (use-local-map indented-text-mode-map) | |
148 ; (setq mode-name "Indented Swedish") | |
149 ; (setq major-mode 'indented-swedish-mode) | |
150 ; (run-hooks 'text-mode-hook)) | |
151 | |
152 (provide 'swedish) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
153 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
154 ;;; swedish.el ends here |