~ubuntu-branches/ubuntu/lucid/dictionaries-common/lucid-201002122359

« back to all changes in this revision

Viewing changes to debian/patches/470_ispell.el_fixlatin0-1.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2005-09-02 13:39:19 UTC
  • mfrom: (1.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050902133919-1yjcebqd0y0op3tz
Tags: 0.49.2ubuntu1
scripts/system/dc-debconf-select.pl: Drop default question priority to
medium so that the default wordlist question is not asked on initial
installation. (This is a temporary workaround, and leaves a dangling
symlink in /usr/share/dict/words.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## 470_ispell.el_fixlatin0-1.dpatch by Agustin Martin Domingo <agmartin@debian.org>
 
2
## 470_ispell.el_fixlatin0-1.dpatch put together by Agustin Martin Domingo <agmartin@debian.org>
3
3
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
4
## 
6
 
## DP:Redefine ispell-get-coding-system function in ispell.el so
7
 
## DP:if emacs buffer-file-coding-system is set to iso-8859-15 and
8
 
## DP:ispell-coding-system is selected as iso-8859-1, this last is
9
 
## DP:set to iso-8859-15. This should work around the iso-8859-{1,15}
10
 
## DP:emacs unification problem. 
 
5
## DP: Two patches put together to deal with ispell and 
 
6
## DP: some iso-8859-{1,15} unification problems:
 
7
## DP: 
 
8
## DP: a) Kenichi Handa, useful for emacs >=21.3
 
9
## DP:    - Make sure the same char is treated similarly when
 
10
## DP:      in different charsets. Works even with utf-8 buffers.
 
11
## DP: b) A. Martin, useful for xemacs21 and emacs21 < 21.3
 
12
## DP:    - Redefine ispell-get-coding-system function in ispell.el
 
13
## DP:      so if emacs buffer-file-coding-system is set to
 
14
## DP:      iso-8859-15 and ispell-coding-system is selected as
 
15
## DP:      iso-8859-1, this last is set to iso-8859-15. This should
 
16
## DP:      work around the iso-8859-{1,15} emacs unification problem. 
 
17
## DP:      This in practice means do not reencode in this case.
 
18
## DP:      Does nothing with utf-8 buffers.
11
19
 
12
20
@DPATCH@
13
 
diff -urNad dictionaries-common/support/emacsen/ispell.el /tmp/dpep.vHINGF/dictionaries-common/support/emacsen/ispell.el
14
 
--- dictionaries-common/support/emacsen/ispell.el       2004-12-28 13:38:46.000000000 +0100
15
 
+++ /tmp/dpep.vHINGF/dictionaries-common/support/emacsen/ispell.el      2004-12-28 13:42:04.000000000 +0100
16
 
@@ -1078,7 +1078,24 @@
17
 
 (defun ispell-get-extended-character-mode ()
18
 
   (nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
19
 
 (defun ispell-get-coding-system ()
20
 
-  (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
21
 
+  (let (ispell-coding-system emacs-coding-system)
 
21
diff -urNad dictionaries-common/support/emacsen/ispell.el /tmp/dpep.I39uz3/dictionaries-common/support/emacsen/ispell.el
 
22
--- dictionaries-common/support/emacsen/ispell.el       Tue Jan 18 00:20:32 2005
 
23
+++ /tmp/dpep.I39uz3/dictionaries-common/support/emacsen/ispell.el      Tue Jan 18 00:22:59 2005
 
24
@@ -1062,15 +1062,104 @@
 
25
       (decode-coding-string str (ispell-get-coding-system))
 
26
     str))
 
27
 
 
28
+;; ----------- Debian changes (main patch from Kenichi Handa) ------
 
29
+
 
30
+; -- patch from A. Martin
 
31
+
 
32
+(defun debian-get-coding-system-workaround ()
 
33
+  (let (ispell-coding-system emacs-coding-system local-buffer-file-coding-system)
22
34
+    (setq ispell-coding-system
23
35
+         (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
24
 
+    (if buffer-file-coding-system
 
36
+    (condition-case ()
25
37
+       (setq emacs-coding-system
26
 
+             (coding-system-get buffer-file-coding-system 'mime-charset))
27
 
+      (setq emacs-coding-system "undefined"))
 
38
+             (if (featurep 'xemacs)
 
39
+                 (coding-system-name
 
40
+                  (coding-system-base buffer-file-coding-system))
 
41
+               (coding-system-get buffer-file-coding-system 'mime-charset)))
 
42
+      (error (setq emacs-coding-system "undefined")))
 
43
+    (condition-case ()
 
44
+       (setq local-buffer-file-coding-system buffer-file-coding-system)
 
45
+      (error (setq local-buffer-file-coding-system "void")))
28
46
+    (condition-case ()
29
47
+       (if debian-dict-common-debug
30
48
+           (message "- codings: bfcs: %s, ecs: %s ics: %s"
31
 
+                    buffer-file-coding-system
 
49
+                    local-buffer-file-coding-system
32
50
+                    emacs-coding-system
33
51
+                    ispell-coding-system))
34
52
+      (error nil))
36
54
+            (string-equal ispell-coding-system "iso-8859-1"))
37
55
+       emacs-coding-system
38
56
+      ispell-coding-system)))
 
57
+
 
58
+(condition-case ()
 
59
+    (setq debian-ucs-mule-8859-to-mule-unicode ucs-mule-8859-to-mule-unicode)
 
60
+  (error (setq debian-ucs-mule-8859-to-mule-unicode nil)))
 
61
+
 
62
+; -- patch from Kenichi Handa
 
63
+
 
64
+(if debian-ucs-mule-8859-to-mule-unicode
 
65
+    (progn
 
66
+      (put 'ispell-unified-chars-table 'char-table-extra-slots 0)
 
67
+      
 
68
+      ;; Char-table that maps an Unicode character (charset:
 
69
+      ;; latin-iso8859-1, mule-unicode-0100-24ff, mule-unicode-2500-34ff) to
 
70
+      ;; a string in which all equivalent characters are listed.
 
71
+      
 
72
+      (defconst ispell-unified-chars-table
 
73
+       (let ((table (make-char-table 'ispell-unified-chars-table)))
 
74
+         (map-char-table
 
75
+          #'(lambda (c v)
 
76
+              (if (and v (/= c v))
 
77
+                  (let ((unified (or (aref table v) (string v))))
 
78
+                    (aset table v (concat unified (string c))))))
 
79
+          ucs-mule-8859-to-mule-unicode)
 
80
+         table))
 
81
+      
 
82
+      ;; Return a string decoded from Nth element of the current dictionary
 
83
+      ;; while splice equivalent characters into the string.  This splicing
 
84
+      ;; is done only if the string is a regular expression of the form
 
85
+      ;; "[...]" because, otherwise, splicing will result in incorrect
 
86
+      ;; regular expression matching.
 
87
+      
 
88
+      (defun ispell-get-decoded-string (n)
 
89
+       (let* ((slot (assoc ispell-dictionary ispell-dictionary-alist))
 
90
+              (str (nth n slot)))
 
91
+         (when (and (> (length str) 0)
 
92
+                    (not (multibyte-string-p str)))
 
93
+           (setq str (ispell-decode-string str))
 
94
+           (if (and (= (aref str 0) ?\[)
 
95
+                    (eq (string-match "\\]" str) (1- (length str))))
 
96
+               (setq str
 
97
+                     (string-as-multibyte
 
98
+                      (mapconcat
 
99
+                       #'(lambda (c)
 
100
+                           (let ((unichar (aref ucs-mule-8859-to-mule-unicode c)))
 
101
+                             (if unichar
 
102
+                                 (aref ispell-unified-chars-table unichar)
 
103
+                               (string c))))
 
104
+                       str ""))))
 
105
+           (setcar (nthcdr n slot) str))
 
106
+         str))
 
107
+      ))
 
108
+
 
109
+; -- Making both patches coexist
 
110
+
 
111
 (defun ispell-get-casechars ()
 
112
-  (ispell-decode-string
 
113
-   (nth 1 (assoc ispell-dictionary ispell-dictionary-alist))))
 
114
+  (if debian-ucs-mule-8859-to-mule-unicode
 
115
+      (ispell-get-decoded-string 1)
 
116
+    (ispell-decode-string
 
117
+     (nth 1 (assoc ispell-dictionary ispell-dictionary-alist)))))
 
118
 (defun ispell-get-not-casechars ()
 
119
-  (ispell-decode-string
 
120
-   (nth 2 (assoc ispell-dictionary ispell-dictionary-alist))))
 
121
+  (if debian-ucs-mule-8859-to-mule-unicode
 
122
+      (ispell-get-decoded-string 2)
 
123
+    (ispell-decode-string
 
124
+     (nth 2 (assoc ispell-dictionary ispell-dictionary-alist)))))
 
125
 (defun ispell-get-otherchars ()
 
126
-  (ispell-decode-string
 
127
-   (nth 3 (assoc ispell-dictionary ispell-dictionary-alist))))
 
128
+  (if debian-ucs-mule-8859-to-mule-unicode
 
129
+      (ispell-get-decoded-string 3)
 
130
+    (ispell-decode-string
 
131
+     (nth 3 (assoc ispell-dictionary ispell-dictionary-alist)))))
 
132
 (defun ispell-get-many-otherchars-p ()
 
133
   (nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
 
134
 (defun ispell-get-ispell-args ()
 
135
@@ -1078,8 +1167,11 @@
 
136
 (defun ispell-get-extended-character-mode ()
 
137
   (nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
 
138
 (defun ispell-get-coding-system ()
 
139
-  (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
 
140
+  (if debian-ucs-mule-8859-to-mule-unicode
 
141
+      (nth 7 (assoc ispell-dictionary ispell-dictionary-alist))
 
142
+    (debian-get-coding-system-workaround)))
39
143
 
 
144
+;; ------------- End of Debian changes -----------------
40
145
 
41
146
 (defvar ispell-pdict-modified-p nil
 
147
   "Non-nil means personal dictionary has modifications to be saved.")