annotate lisp/international/ogonek.el @ 21374:456146137d23

(Fstring_as_unibyte): Set size_byte field to -1.
author Kenichi Handa <handa@m17n.org>
date Mon, 06 Apr 1998 05:06:12 +0000
parents 31e4a16368c9
children ec243644b3fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; ogonek.el --- basic editing commands for Emacs
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: W{\l}odek Bzyl, Ryszard Kubiak
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Maintainer: rysiek@ipipan.gda.pl (Ryszard Kubiak)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: i18n
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; To use this library load it using
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; M-x load-library [enter] ogonek
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Then, you may get a short info by calling one of
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; M-x ogonek-jak -- in Polish
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; M-x ogonek-how -- in English "
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (defconst ogonek-name-encoding-alist
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 '(("ascii" . (?A ?C ?E ?L ?N ?O ?S ?Z ?Z
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ?a ?c ?e ?l ?n ?o ?s ?z ?z))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ("iso8859-2" . (161 198 202 163 209 211 166 172 175
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 177 230 234 179 241 243 182 188 191))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ("mazovia" . (143 149 144 156 165 163 152 160 161
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 134 141 145 146 164 162 158 166 167))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ("windows-EE" . (165 198 202 163 209 211 140 143 175
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 185 230 234 179 241 243 156 159 191))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ("windows-PL" . (165 198 202 163 209 211 140 143 175
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 185 230 234 179 241 243 156 159 191))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ("latin-2" . (164 143 168 157 227 224 151 141 189
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 165 134 169 136 228 162 152 171 190))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ("CP852" . (164 143 168 157 227 224 151 141 189
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 165 134 169 136 228 162 152 171 190))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ("MeX" . (129 130 134 138 139 211 145 153 155
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 161 162 166 170 171 243 177 185 187))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ("CorelDraw" . (197 242 201 163 209 211 255 225 237
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 229 236 230 198 241 243 165 170 186))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ("Amiga" . (194 202 203 206 207 211 212 218 219
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 226 234 235 238 239 243 244 250 251))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ("Mac" . (132 140 162 252 193 238 229 143 251
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 136 141 171 184 196 151 230 144 253))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 )
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 "The constant `ogonek-name-encoding-alist' is a list of (NAME.LIST) pairs.
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
59 Each LIST contains codes for 18 Polish diacritic characters. The codes
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
60 are given in the following order:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 Aogonek Cacute Eogonek Lslash Nacute Oacute Sacute Zacute Zdotaccent
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 aogonek cacute eogonek lslash nacute oacute sacute zacute zdotaccent.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
64 ;; ------ A Little Info in Polish ---------------
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (defconst ogonek-informacja
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
67 " FUNKCJE INTERAKCYJNE UDOST/EPNIANE PRZEZ BIBLIOTEK/E `ogonek'.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
69 Je/sli czytasz ten tekst, to albo przegl/adasz plik /xr/od/lowy
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 biblioteki `ogonek.el', albo wywo/la/le/s polecenie `ogonek-jak'.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 W drugim przypadku mo/zesz usun/a/c tekst z ekranu, stosuj/ac
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 polecenie `M-x kill-buffer'.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
74 Niniejsza biblioteka dostarcza funkcji do zmiany kodowania polskich
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 znak/ow diakrytycznych. Funkcje te mo/zna pogrupowa/c nast/epuj/aco.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
77 1. `ogonek-recode-region' oraz `ogonek-recode-buffer'
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
78 przekodowuj/a zaznaczony fragment wzgl/ednie ca/ly buffor.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 Po wywo/laniu interakcyjnym funkcji zadawane s/a
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
80 pytania o parametry przekodowania: nazw/e kodowania
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
81 w tek/scie /xr/od/lowym i nazw/e kodowania docelowego.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
82 Poni/zsze przyk/lady powinny wyja/sni/c, jakich parametr/ow
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 oczekuj/a wymienione funkcje:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
85 (ogonek-recode-region (poczatek-fragmentu) (koniec-fragmentu)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 nazwa-kodowania-w-tekscie-zrodlowym nazwa-kodowania-docelowa)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (ogonek-recode-buffer
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 nazwa-kodowania-w-tekscie-zrodlowym nazwa-kodowania-docelowa)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
90 2. `ogonek-prefixify-region' oraz `ogonek-prefixify-buffer'
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
91 s/lu/z/a do wprowadzania notacji prefiksowej.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
93 (ogonek-prefixify-region (poczatek-fragmentu) (koniec-fragmentu)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 nazwa-kodowania-w-tekscie-zrodlowym znak-prefiksu)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (ogonek-prefixify-buffer
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 nazwa-kodowania-w-tekscie-zrodlowym znak-prefiksu)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
98 3. `ogonek-deprefixify-region' oraz `ogonek-deprefixify-buffer'
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
99 s/lu/z/a do usuwania notacji prefiksowej.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
101 (ogonek-deprefixify-region (poczatek-fragmentu) (koniec-fragmentu)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 znak-prefiksu nazwa-kodowania-docelowa)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (ogonek-prefixify-buffer
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 znak-prefiksu nazwa-kodowania-docelowa)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 U/zycie klawisza TAB w trybie interakcyjnym powoduje wy/swietlenie
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
107 listy dopuszczalnych nazw kod/ow, pami/etanych w sta/lej
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 `ogonek-name-encoding-alist'.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 Funkcje biblioteki odwo/luj/a si/e do pi/eciu zmiennych, kt/ore
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 przechowuj/a podpowiedzi do zadawanych pyta/n. Nazwy tych zmiennych
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 oraz ich warto/sci domy/slne s/a nast/epuj/ace:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ogonek-from-encoding iso8859-2
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
115 ogonek-to-encoding ascii
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ogonek-prefix-char /
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ogonek-prefix-from-encoding iso8859-2
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ogonek-prefix-to-encoding iso8859-2
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 Powy/zsze warto/sci domy/slne mo/zna zmieni/c przez umieszczenie w pliku
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 konfiguracyjnym `~/.emacs' odpowiednich przypisa/n, na przyk/lad:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
123 (setq ogonek-prefix-char ?/)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
124 (setq ogonek-prefix-to-encoding \"iso8859-2\")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 Zamiast wczytywania ca/lej biblioteki `ogonek.el' mo/zna w pliku
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
127 `~/.emacs' za/z/ada/c wczytania wybranych funkcji, na dodatek dopiero
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
128 w chwili ich rzeczywistego u/zycia:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
130 (autoload 'ogonek-jak \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
131 (autoload 'ogonek-recode-region \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
132 (autoload 'ogonek-prefixify-region \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
133 (autoload 'ogonek-deprefixify-region \"ogonek\")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 Cz/esto wyst/epuj/ace kombinacje wywo/la/n funkcji mo/zna dla wygody
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 skr/oci/c i przypisa/c klawiszom. Oto praktyczne przyk/lady:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
138 (defun deprefixify-iso8859-2-region (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
139 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
140 (ogonek-deprefixify-region start end ?/ \"iso8859-2\"))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
141 (global-set-key \"\\C-cd\" 'deprefixify-iso8859-2-region) ; ctrl-c d
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
143 (defun mazovia-to-iso8859-2 (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
144 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
145 (ogonek-recode-region start end \"mazovia\" \"iso8859-2\"))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
146 (global-set-key \"\\C-cr\" 'mazovia-to-iso8859-2) ; ctrl-c r
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
148 (defun prefixify-iso8859-2-region (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
149 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
150 (ogonek-prefixify-region start end \"iso8859-2\" ?/))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
151 (global-set-key \"\\C-cp\" 'prefixify-iso8859-2-region) ; ctrl-c p
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 Ka/zd/a operacj/e przekodowania mo/zna w ca/lo/sci odwo/la/c
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 przez wykonanie polecenia `undo'.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (defun ogonek-jak ()
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
157 "Display `ogonek-informacja' in an auxiliary *ogonek-jak* buffer."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (interactive)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (set-buffer (get-buffer-create " *ogonek-jak*"))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (insert ogonek-informacja)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (switch-to-buffer " *ogonek-jak*")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (beginning-of-buffer))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
164 ;; ------ A Little Info in English --------
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (defconst ogonek-information
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
167 " THE INTERACTIVE FUNCTIONS PROVIDED BY THE LIBRARY `ogonek'.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 If you read this text then you are either looking at the library's
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
170 source text or you have called the `ogonek-how' command. In the
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 latter case you may remove this text using `M-x kill-buffer'.
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 The library provides functions for changing the encoding of Polish
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 diacritic characters, the ones with an `ogonek' below or above them.
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
175 The functions come in the following groups.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
177 1. `ogonek-recode-region' and `ogonek-recode-buffer' to change
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
178 between one-character encodings, such as `iso-8859-2', `mazovia',
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
179 plain `ascii' or `TeX'. As the names suggest you may recode
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
180 either the entire current buffer or just a marked region
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
181 in it. You may use the functions interactively as commands.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
182 Once you call a command you will be asked about the code
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
183 currently used in your text and the target encoding, the one
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
184 you want to get. The following example shows a non-interactive
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
185 use of the functions in a program. This also illustrates what
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
186 type of parameters the functions expect to be called with:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
188 (ogonek-recode-region
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
189 (region-beginning) (region-end) from-code-name to-code-name)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (ogonek-recode-buffer from-code-name to-code-name)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
192 2. `ogonek-prefixify-region' and `ogonek-prefixify-buffer' for
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
193 introducing prefix notation:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
195 (ogonek-prefixify-region
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
196 (region-beginning) (region-end) from-code-name prefix-char)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (ogonek-prefixify-buffer from-code-name prefix-char)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
199 3. `ogonek-deprefixify-region' and `ogonek-deprefixify-buffer' for
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
200 removing prefix notation:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
202 (ogonek-deprefixify-region
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
203 (region-beginning) (region-end) prefix-char to-code-name)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (ogonek-prefixify-buffer prefix-char to-code-name)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
206 The TAB character used in interactive mode makes `emacs'
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
207 display the list of encodings recognized by the library. The list
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
208 is stored in the constant `ogonek-name-encoding-alist'.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
210 The `ogonek' functions refer to five variables in which the suggested
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
211 answers to dialogue questions are stored. The variables and their
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
212 default values are:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ogonek-from-encoding iso8859-2
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
215 ogonek-to-encoding ascii
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
216 ogonek-prefix-char /
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 ogonek-prefix-from-encoding iso8859-2
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ogonek-prefix-to-encoding iso8859-2
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 The above default values can be changed by placing appropriate settings
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 in the '~/.emacs' file:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
223 (setq ogonek-prefix-char ?/)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
224 (setq ogonek-prefix-to-encoding \"iso8859-2\")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
226 Instead of loading the whole library `ogonek' it may be better to
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
227 autoload the needed functions, for example by placing in `~/.emacs':
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
229 (autoload 'ogonek-how \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
230 (autoload 'ogonek-recode-region \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
231 (autoload 'ogonek-prefixify-region \"ogonek\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
232 (autoload 'ogonek-deprefixify-region \"ogonek\")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 The most frequent function calls can be abbreviated and assigned to
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 keyboard keys. Here are a few practical examples:
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
237 (defun deprefixify-iso8859-2-region (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
238 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
239 (ogonek-deprefixify-region start end ?/ \"iso8859-2\"))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
240 (global-set-key \"\\C-cd\" 'deprefixify-iso8859-2-region) ; ctrl-c d
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
242 (defun mazovia-to-iso8859-2 (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
243 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
244 (ogonek-recode-region start end \"mazovia\" \"iso8859-2\"))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
245 (global-set-key \"\\C-cr\" 'mazovia-to-iso8859-2) ; ctrl-c r
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
247 (defun prefixify-iso8859-2-region (start end)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
248 (interactive \"*r\")
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
249 (ogonek-prefixify-region start end \"iso8859-2\" ?/))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
250 (global-set-key \"\\C-cp\" 'prefixify-iso8859-2-region) ; ctrl-c p
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
252 Each recoding operation can be called off using the `undo' command.")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 (defun ogonek-how ()
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
255 "Display `ogonek-information' in an auxiliary *recode-how* buffer."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 (interactive "*")
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
257 (set-buffer (get-buffer-create " *ogonek-how*"))
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (insert ogonek-information)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
259 (switch-to-buffer " *ogonek-how*")
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 (beginning-of-buffer))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
262 ;; ---- Variables keeping the suggested answers to dialogue questions -----
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (defvar ogonek-from-encoding "iso8859-2"
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 "*Encoding in the source file of recoding.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (defvar ogonek-to-encoding "ascii"
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 "*Encoding in the target file of recoding.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 (defvar ogonek-prefix-char ?/
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 "*Prefix character for prefix encodings.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (defvar ogonek-prefix-from-encoding "iso8859-2"
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 "*Encoding in the source file subject to prefixifation.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (defvar ogonek-prefix-to-encoding "iso8859-2"
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 "*Encoding in the target file subject to deprefixifation.")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
275 ;; ---- Auxiliary functions for reading parameters in interactive mode ----
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (defun ogonek-read-encoding (prompt default-name-var)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
278 "Read encoding name with completion based on `ogonek-name-encoding-alist'.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
279 Store the name in the the parameter-variable DEFAULT-NAME-VAR.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
280 PROMPT is a string to be shown when the user is asked for a name."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (let ((encoding
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (completing-read
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (format "%s (default %s): " prompt (eval default-name-var))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 ogonek-name-encoding-alist nil t)))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
285 ;; change the default name to the one just read
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
286 (set default-name-var
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
287 (if (string= encoding "") (eval default-name-var) encoding))
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
288 ;; return the new default as the name you read
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (eval default-name-var)))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (defun ogonek-read-prefix (prompt default-prefix-var)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
292 "Read a prefix character for prefix notation.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
293 The result is stored in the variable DEFAULT-PREFIX-VAR.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
294 PROMPT is a string to be shown when the user is asked for a new prefix."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (let ((prefix-string
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (read-string
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (format "%s (default %s): " prompt
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (char-to-string (eval default-prefix-var))))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (if (> (length prefix-string) 1)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (error "! Only one character expected.")
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
301 ;; set the default prefix character to the one just read
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (set default-prefix-var
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (if (string= prefix-string "")
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (eval default-prefix-var)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (string-to-char prefix-string)))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
306 ;; the new default prefix is the function's result:
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (eval default-prefix-var))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (defun ogonek-lookup-encoding (encoding)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
310 "Pick up an association for ENCODING in `ogonek-name-encoding-alist'.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
311 Before returning a result test whether the string ENCODING is in
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
312 the list `ogonek-name-encoding-alist'"
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (let ((code-list (assoc encoding ogonek-name-encoding-alist)))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (if (null code-list)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (error "! Name `%s' not known in `ogonek-name-encoding-alist'."
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (cdr code-list))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
319 ;; ---- An auxiliary function for zipping two lists of equal length ----
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (defun ogonek-zip-lists (xs ys)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
322 "Build a list of pairs from lists XS and YS of the same length."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (let ((pairs nil))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 (while xs
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (setq pairs (cons (cons (car xs) (car ys)) pairs))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (setq xs (cdr xs))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (setq ys (cdr ys)))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
328 ;; `pairs' are the function's result
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 pairs))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
331 ;; ---- An auxiliary function building a one-to-one recoding table -----
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 (defun ogonek-build-table (recoding-pairs)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
334 "Build a table required by Emacs's `translate-region' function.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
335 RECODING-PAIRS is a list of character pairs for which recoding
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
336 is not an identity.
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 By using the built-in `translate-region' function
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 we gain better performance compared to converting characters
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 by a hand-written routine as it is done for prefix encodings."
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (let ((table (make-string 256 0))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 (i 0))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (while (< i 256)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (aset table i i)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (setq i (1+ i)))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
345 ;; make changes in `table' according to `recoding-pairs'
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (while recoding-pairs
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (aset table (car (car recoding-pairs)) (cdr (car recoding-pairs)))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (setq recoding-pairs (cdr recoding-pairs)))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
349 ;; return the table just built
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 table))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
352 ;; ---- Commands for one-to-one recoding -------------------------------
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
353
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (defun ogonek-recode-region (start end from-encoding to-encoding)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
355 "Recode text in a marked region in one-to-one manner.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
356 When called interactively ask the user for the names of the FROM-
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
357 and TO- encodings."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (list
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (region-beginning)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (region-end)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 (ogonek-read-encoding "From code" 'ogonek-from-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 (ogonek-read-encoding "To code" 'ogonek-to-encoding))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (save-excursion
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 (translate-region
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 start end
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 (ogonek-build-table
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (ogonek-zip-lists
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (ogonek-lookup-encoding from-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (ogonek-lookup-encoding to-encoding))))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (defun ogonek-recode-buffer (from-encoding to-encoding)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
373 "Call `ogonek-recode-region' on the entire buffer.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
374 When called interactively ask the user for the names of the FROM-
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
375 and TO- encodings."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 (list
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (ogonek-read-encoding "From code" 'ogonek-from-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (ogonek-read-encoding "To code" 'ogonek-to-encoding))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (ogonek-recode-region
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (point-min) (point-max) from-encoding to-encoding))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
383 ;; ---- Recoding with prefix notation -------------------------------
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
385 (defconst ogonek-prefix-code '(?A ?C ?E ?L ?N ?O ?S ?X ?Z
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
386 ?a ?c ?e ?l ?n ?o ?s ?x ?z))
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (defun ogonek-prefixify-region (start end from-encoding prefix-char)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
389 "In a region, replace FROM-encoded Polish characters with PREFIX pairs.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
390 A PREFIX pair generated consists of PREFIX-CHAR and the respective
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
391 character listed in the `ogonek-prefix-code' constant.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
392 PREFIX-CHAR itself gets doubled."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (list
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (region-beginning)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (region-end)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (ogonek-read-encoding "From code" 'ogonek-prefix-from-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (ogonek-read-prefix "Prefix character" 'ogonek-prefix-char))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (let*
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 ((from-code (ogonek-lookup-encoding from-encoding))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
401 (to-code ogonek-prefix-code)
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
402 (recoding-pairs ; `ogonek-prefix-char' added for doubling
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (ogonek-zip-lists
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (cons prefix-char from-code)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (cons prefix-char to-code))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (save-excursion
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (goto-char start)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 (while (< (point) end)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (let ((pair (assoc (following-char) recoding-pairs)))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (if (null pair)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
411 ;; not a Polish character -- skip it
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (forward-char 1)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
413 ;; Polish character -- insert a prefix pair instead
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (delete-char 1)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (insert ogonek-prefix-char)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (insert (cdr pair))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
417 ;; the region is now one character longer
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (setq end (1+ end))))))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (defun ogonek-prefixify-buffer (from-encoding prefix-char)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 "Call `ogonek-prefixify-region' on the entire buffer."
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (list
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (ogonek-read-encoding "From code" 'ogonek-prefix-from-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (ogonek-read-prefix "Prefix character" 'ogonek-prefix-char))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (ogonek-prefixify-region
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (point-min) (point-max) from-encoding prefix-char))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (defun ogonek-deprefixify-region (start end prefix-char to-encoding)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
430 "In a region, replace PREFIX pairs with their corresponding TO-encodings.
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
431 PREFIX-CHAR followed by a Polish character from the `ogonek-prefix-code'
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
432 list is replaced with the corresponding TO-encoded character. A doubled
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
433 PREFIX-CHAR gets replaced with a single one. A combination of PREFIX-CHAR
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
434 followed by a non-Polish character, that is one not listed in the
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
435 `ogonek-prefix-code' constant, is left unchanged."
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 (list (region-beginning)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 (region-end)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (ogonek-read-prefix
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 "Prefix character" 'ogonek-prefix-char)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (ogonek-read-encoding
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 "To code" 'ogonek-prefix-to-encoding))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 (let*
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
444 ((from-code ogonek-prefix-code)
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (to-code (ogonek-lookup-encoding to-encoding))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (recoding-pairs
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 (ogonek-zip-lists
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (cons prefix-char from-code)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (cons prefix-char to-code))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (save-excursion
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (goto-char start)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (while (< (point) end)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (forward-char 1)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (if (or (not (= (preceding-char) prefix-char)) (= (point) end))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
455 ;; non-prefix character or the end-of-region -- do nothing
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 ()
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
457 ;; now, we can check the next character
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 (let ((pair (assoc (following-char) recoding-pairs)))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (if (null pair)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
460 ;; `following-char' is not a Polish character nor it is
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
461 ;; `prefix-char' since the one is among `recoding-pairs'
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (forward-char 1)
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
463 ;; else prefix followed by a Polish character has been found
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
464 ;; replace it by the corresponding Polish character
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (backward-char 1)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (delete-char 2)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (insert (cdr pair))
18363
31e4a16368c9 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18264
diff changeset
468 ;; the region got shorter by one character
18264
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (setq end (1- end)))))))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (defun ogonek-deprefixify-buffer (prefix-char to-encoding)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 "Call `ogonek-deprefixify-region' on the entire buffer."
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (interactive (progn (barf-if-buffer-read-only)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (list
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (ogonek-read-prefix "Prefix character" 'ogonek-prefix-char)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (ogonek-read-encoding "To code" 'ogonek-prefix-to-encoding))))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 (ogonek-deprefixify-region
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (point-min) (point-max) prefix-char to-encoding))
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 (provide 'ogonek)
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481
85e7518aaf4a Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 ;;; ogonek.el ends here