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