Mercurial > emacs
annotate lisp/international/mule-util.el @ 91645:c0a02f63009d
*** empty log message ***
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 08 Feb 2008 05:14:03 +0000 |
parents | 606f2d163a64 |
children | 39b7a7b122f8 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29354
diff
changeset
|
1 ;;; mule-util.el --- utility functions for mulitilingual environment (mule) |
17052 | 2 |
74544 | 3 ;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, |
79709 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
74605
6ee41fdd69ff
Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents:
74544
diff
changeset
|
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
79709 | 6 ;; 2005, 2006, 2007, 2008 |
62274 | 7 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
8 ;; Registration Number H14PRO021 | |
89483 | 9 ;; Copyright (C) 2003 |
10 ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
11 ;; Registration Number H13PRO009 | |
17052 | 12 |
13 ;; Keywords: mule, multilingual | |
14 | |
15 ;; This file is part of GNU Emacs. | |
16 | |
17 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
18 ;; it under the terms of the GNU General Public License as published by | |
78310
2daf9c28b3a4
Restore comma mistakenly removed in last change.
Glenn Morris <rgm@gnu.org>
parents:
78301
diff
changeset
|
19 ;; the Free Software Foundation; either version 3, or (at your option) |
17052 | 20 ;; any later version. |
21 | |
22 ;; GNU Emacs is distributed in the hope that it will be useful, | |
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 ;; GNU General Public License for more details. | |
26 | |
27 ;; You should have received a copy of the GNU General Public License | |
17071 | 28 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
30 ;; Boston, MA 02110-1301, USA. | |
17052 | 31 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29354
diff
changeset
|
32 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29354
diff
changeset
|
33 |
17052 | 34 ;;; Code: |
35 | |
36 ;;; String manipulations while paying attention to multibyte | |
37 ;;; characters. | |
38 | |
39 ;;;###autoload | |
40 (defun string-to-sequence (string type) | |
41 "Convert STRING to a sequence of TYPE which contains characters in STRING. | |
18200
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
42 TYPE should be `list' or `vector'." |
28458 | 43 ;;; (let ((len (length string)) |
44 ;;; (i 0) | |
45 ;;; val) | |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
46 (cond ((eq type 'list) |
28458 | 47 ;; Applicable post-Emacs 20.2 and asymptotically ~10 times |
48 ;; faster than the code below: | |
49 (append string nil)) | |
50 ;;; (setq val (make-list len 0)) | |
51 ;;; (let ((l val)) | |
52 ;;; (while (< i len) | |
53 ;;; (setcar l (aref string i)) | |
54 ;;; (setq l (cdr l) i (1+ i)))))) | |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
55 ((eq type 'vector) |
28458 | 56 ;; As above. |
57 (vconcat string)) | |
58 ;;; (setq val (make-vector len 0)) | |
59 ;;; (while (< i len) | |
60 ;;; (aset val i (aref string i)) | |
61 ;;; (setq i (1+ i)))) | |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
62 (t |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
63 (error "Invalid type: %s" type))) |
28458 | 64 ;;; val) |
65 ) | |
46511
f44beb42c7c1
(string-to-sequence, truncate-string): Add autoload cookie.
Juanma Barranquero <lekktu@gmail.com>
parents:
46051
diff
changeset
|
66 |
f44beb42c7c1
(string-to-sequence, truncate-string): Add autoload cookie.
Juanma Barranquero <lekktu@gmail.com>
parents:
46051
diff
changeset
|
67 ;;;###autoload |
41232
43e756c38f4f
(string-to-sequence): Make it obsolete.
Richard M. Stallman <rms@gnu.org>
parents:
38414
diff
changeset
|
68 (make-obsolete 'string-to-sequence |
46051
990c78360ef5
(string-to-sequence): Fix obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
45908
diff
changeset
|
69 "use `string-to-list' or `string-to-vector'." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
58804
diff
changeset
|
70 "22.1") |
17052 | 71 |
72 ;;;###autoload | |
73 (defsubst string-to-list (string) | |
74 "Return a list of characters in STRING." | |
41232
43e756c38f4f
(string-to-sequence): Make it obsolete.
Richard M. Stallman <rms@gnu.org>
parents:
38414
diff
changeset
|
75 (append string nil)) |
17052 | 76 |
77 ;;;###autoload | |
78 (defsubst string-to-vector (string) | |
79 "Return a vector of characters in STRING." | |
41232
43e756c38f4f
(string-to-sequence): Make it obsolete.
Richard M. Stallman <rms@gnu.org>
parents:
38414
diff
changeset
|
80 (vconcat string)) |
17052 | 81 |
82 ;;;###autoload | |
83 (defun store-substring (string idx obj) | |
84 "Embed OBJ (string or character) at index IDX of STRING." | |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
85 (if (integerp obj) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
86 (aset string idx obj) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
87 (let ((len1 (length obj)) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
88 (len2 (length string)) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
89 (i 0)) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
90 (while (< i len1) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
91 (aset string (+ idx i) (aref obj i)) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
92 (setq i (1+ i))))) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
93 string) |
17052 | 94 |
95 ;;;###autoload | |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
96 (defun truncate-string-to-width (str end-column |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
97 &optional start-column padding ellipsis) |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
98 "Truncate string STR to end at column END-COLUMN. |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
99 The optional 3rd arg START-COLUMN, if non-nil, specifies the starting |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
100 column; that means to return the characters occupying columns |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
101 START-COLUMN ... END-COLUMN of STR. Both END-COLUMN and START-COLUMN |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
102 are specified in terms of character display width in the current |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
103 buffer; see also `char-width'. |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
104 |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
105 The optional 4th arg PADDING, if non-nil, specifies a padding |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
106 character (which should have a display width of 1) to add at the end |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
107 of the result if STR doesn't reach column END-COLUMN, or if END-COLUMN |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
108 comes in the middle of a character in STR. PADDING is also added at |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
109 the beginning of the result if column START-COLUMN appears in the |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
110 middle of a character in STR. |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
111 |
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
112 If PADDING is nil, no padding is added in these cases, so |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
113 the resulting string may be narrower than END-COLUMN. |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
114 |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
115 If ELLIPSIS is non-nil, it should be a string which will replace the |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
116 end of STR (including any padding) if it extends beyond END-COLUMN, |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
117 unless the display width of STR is equal to or less than the display |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
118 width of ELLIPSIS. If it is non-nil and not a string, then ELLIPSIS |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
119 defaults to \"...\"." |
17052 | 120 (or start-column |
121 (setq start-column 0)) | |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
122 (when (and ellipsis (not (stringp ellipsis))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
123 (setq ellipsis "...")) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
124 (let ((str-len (length str)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
125 (str-width (string-width str)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
126 (ellipsis-len (if ellipsis (length ellipsis) 0)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
127 (ellipsis-width (if ellipsis (string-width ellipsis) 0)) |
17052 | 128 (idx 0) |
129 (column 0) | |
130 (head-padding "") (tail-padding "") | |
131 ch last-column last-idx from-idx) | |
132 (condition-case nil | |
133 (while (< column start-column) | |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
134 (setq ch (aref str idx) |
17052 | 135 column (+ column (char-width ch)) |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
136 idx (1+ idx))) |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
137 (args-out-of-range (setq idx str-len))) |
17052 | 138 (if (< column start-column) |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
139 (if padding (make-string end-column padding) "") |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
140 (when (and padding (> column start-column)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
141 (setq head-padding (make-string (- column start-column) padding))) |
17052 | 142 (setq from-idx idx) |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
143 (when (>= end-column column) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
144 (if (and (< end-column str-width) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
145 (> str-width ellipsis-width)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
146 (setq end-column (- end-column ellipsis-width)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
147 (setq ellipsis "")) |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
148 (condition-case nil |
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
149 (while (< column end-column) |
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
150 (setq last-column column |
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
151 last-idx idx |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
152 ch (aref str idx) |
19916
f43513081277
(truncate-string-to-width):
Richard M. Stallman <rms@gnu.org>
parents:
19745
diff
changeset
|
153 column (+ column (char-width ch)) |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
154 idx (1+ idx))) |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
155 (args-out-of-range (setq idx str-len))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
156 (when (> column end-column) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
157 (setq column last-column |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
158 idx last-idx)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
159 (when (and padding (< column end-column)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
160 (setq tail-padding (make-string (- end-column column) padding)))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
161 (concat head-padding (substring str from-idx idx) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
162 tail-padding ellipsis)))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
163 |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
164 ;;; Test suite for truncate-string-to-width |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
165 ;; (dolist (test '((("" 0) . "") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
166 ;; (("x" 1) . "x") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
167 ;; (("xy" 1) . "x") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
168 ;; (("xy" 2 1) . "y") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
169 ;; (("xy" 0) . "") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
170 ;; (("xy" 3) . "xy") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
171 ;; (("$AVP(B" 0) . "") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
172 ;; (("$AVP(B" 1) . "") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
173 ;; (("$AVP(B" 2) . "$AVP(B") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
174 ;; (("$AVP(B" 1 nil ? ) . " ") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
175 ;; (("$AVPND(B" 3 1 ? ) . " ") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
176 ;; (("x$AVP(Bx" 2) . "x") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
177 ;; (("x$AVP(Bx" 3) . "x$AVP(B") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
178 ;; (("x$AVP(Bx" 3) . "x$AVP(B") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
179 ;; (("x$AVP(Bx" 4 1) . "$AVP(Bx") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
180 ;; (("kor$(CGQ(Be$(C1[(Ban" 8 1 ? ) . "or$(CGQ(Be$(C1[(B") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
181 ;; (("kor$(CGQ(Be$(C1[(Ban" 7 2 ? ) . "r$(CGQ(Be ") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
182 ;; (("" 0 nil nil "...") . "") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
183 ;; (("x" 3 nil nil "...") . "x") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
184 ;; (("$AVP(B" 3 nil nil "...") . "$AVP(B") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
185 ;; (("foo" 3 nil nil "...") . "foo") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
186 ;; (("foo" 2 nil nil "...") . "fo") ;; XEmacs failure? |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
187 ;; (("foobar" 6 0 nil "...") . "foobar") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
188 ;; (("foobarbaz" 6 nil nil "...") . "foo...") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
189 ;; (("foobarbaz" 7 2 nil "...") . "ob...") |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
190 ;; (("foobarbaz" 9 3 nil "...") . "barbaz") |
89909 | 191 ;; (("$A$3(Bh$A$s(Be$A$K(Bl$A$A(Bl$A$O(Bo" 15 1 ? t) . " h$A$s(Be$A$K(Bl$A$A(Bl$A$O(Bo") |
192 ;; (("$A$3(Bh$A$s(Be$A$K(Bl$A$A(Bl$A$O(Bo" 14 1 ? t) . " h$A$s(Be$A$K(Bl$A$A(B...") | |
193 ;; (("x" 3 nil nil "$(Gemk#(B") . "x") | |
194 ;; (("$AVP(B" 2 nil nil "$(Gemk#(B") . "$AVP(B") | |
195 ;; (("$AVP(B" 1 nil ?x "$(Gemk#(B") . "x") ;; XEmacs error | |
196 ;; (("$AVPND(B" 3 nil ? "$(Gemk#(B") . "$AVP(B ") ;; XEmacs error | |
197 ;; (("foobarbaz" 4 nil nil "$(Gemk#(B") . "$(Gemk#(B") | |
198 ;; (("foobarbaz" 5 nil nil "$(Gemk#(B") . "f$(Gemk#(B") | |
199 ;; (("foobarbaz" 6 nil nil "$(Gemk#(B") . "fo$(Gemk#(B") | |
200 ;; (("foobarbaz" 8 3 nil "$(Gemk#(B") . "b$(Gemk#(B") | |
201 ;; (("$A$3(Bh$A$s(Be$A$K(Bl$A$A(Bl$A$O(Bo" 14 4 ?x "$AHU1>$(Gk#(B") . "xe$A$KHU1>$(Gk#(B") | |
202 ;; (("$A$3(Bh$A$s(Be$A$K(Bl$A$A(Bl$A$O(Bo" 13 4 ?x "$AHU1>$(Gk#(B") . "xex$AHU1>$(Gk#(B") | |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
203 ;; )) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
204 ;; (let (ret) |
48156
5701c670b676
(coding-system-eol-type-mnemonic): Move to mule.el.
Juanma Barranquero <lekktu@gmail.com>
parents:
46511
diff
changeset
|
205 ;; (condition-case e |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
206 ;; (setq ret (apply #'truncate-string-to-width (car test))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
207 ;; (error (setq ret e))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
208 ;; (unless (equal ret (cdr test)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
209 ;; (error "%s: expected %s, got %s" |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
210 ;; (prin1-to-string (cons 'truncate-string-to-width (car test))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
211 ;; (prin1-to-string (cdr test)) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
212 ;; (if (consp ret) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
213 ;; (format "error: %s: %s" (car ret) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
214 ;; (prin1-to-string (cdr ret))) |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
215 ;; (prin1-to-string ret)))))) |
17052 | 216 |
217 | |
218 ;;; Nested alist handler. Nested alist is alist whose elements are | |
219 ;;; also nested alist. | |
220 | |
221 ;;;###autoload | |
222 (defsubst nested-alist-p (obj) | |
23196 | 223 "Return t if OBJ is a nested alist. |
17052 | 224 |
225 Nested alist is a list of the form (ENTRY . BRANCHES), where ENTRY is | |
226 any Lisp object, and BRANCHES is a list of cons cells of the form | |
45908
bb8152219329
open-paren-in-column-0 in dosctring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45453
diff
changeset
|
227 \(KEY-ELEMENT . NESTED-ALIST). |
17052 | 228 |
229 You can use a nested alist to store any Lisp object (ENTRY) for a key | |
230 sequence KEYSEQ, where KEYSEQ is a sequence of KEY-ELEMENT. KEYSEQ | |
231 can be a string, a vector, or a list." | |
232 (and obj (listp obj) (listp (cdr obj)))) | |
233 | |
234 ;;;###autoload | |
235 (defun set-nested-alist (keyseq entry alist &optional len branches) | |
236 "Set ENTRY for KEYSEQ in a nested alist ALIST. | |
23196 | 237 Optional 4th arg LEN non-nil means the first LEN elements in KEYSEQ |
17052 | 238 is considered. |
239 Optional argument BRANCHES if non-nil is branches for a keyseq | |
240 longer than KEYSEQ. | |
241 See the documentation of `nested-alist-p' for more detail." | |
242 (or (nested-alist-p alist) | |
23196 | 243 (error "Invalid argument %s" alist)) |
17052 | 244 (let ((islist (listp keyseq)) |
245 (len (or len (length keyseq))) | |
246 (i 0) | |
247 key-elt slot) | |
248 (while (< i len) | |
249 (if (null (nested-alist-p alist)) | |
250 (error "Keyseq %s is too long for this nested alist" keyseq)) | |
251 (setq key-elt (if islist (nth i keyseq) (aref keyseq i))) | |
252 (setq slot (assoc key-elt (cdr alist))) | |
253 (if (null slot) | |
254 (progn | |
255 (setq slot (cons key-elt (list t))) | |
256 (setcdr alist (cons slot (cdr alist))))) | |
257 (setq alist (cdr slot)) | |
258 (setq i (1+ i))) | |
259 (setcar alist entry) | |
260 (if branches | |
26890
4cd9407a4683
(set-nested-alist): Set BRANCHES (if
Kenichi Handa <handa@m17n.org>
parents:
26691
diff
changeset
|
261 (setcdr (last alist) branches)))) |
17052 | 262 |
263 ;;;###autoload | |
264 (defun lookup-nested-alist (keyseq alist &optional len start nil-for-too-long) | |
265 "Look up key sequence KEYSEQ in nested alist ALIST. Return the definition. | |
266 Optional 1st argument LEN specifies the length of KEYSEQ. | |
267 Optional 2nd argument START specifies index of the starting key. | |
268 The returned value is normally a nested alist of which | |
269 car part is the entry for KEYSEQ. | |
270 If ALIST is not deep enough for KEYSEQ, return number which is | |
271 how many key elements at the front of KEYSEQ it takes | |
272 to reach a leaf in ALIST. | |
273 Optional 3rd argument NIL-FOR-TOO-LONG non-nil means return nil | |
274 even if ALIST is not deep enough." | |
275 (or (nested-alist-p alist) | |
28458 | 276 (error "Invalid argument %s" alist)) |
17052 | 277 (or len |
278 (setq len (length keyseq))) | |
279 (let ((i (or start 0))) | |
280 (if (catch 'lookup-nested-alist-tag | |
281 (if (listp keyseq) | |
282 (while (< i len) | |
283 (if (setq alist (cdr (assoc (nth i keyseq) (cdr alist)))) | |
284 (setq i (1+ i)) | |
285 (throw 'lookup-nested-alist-tag t)))) | |
286 (while (< i len) | |
287 (if (setq alist (cdr (assoc (aref keyseq i) (cdr alist)))) | |
288 (setq i (1+ i)) | |
289 (throw 'lookup-nested-alist-tag t)))) | |
290 ;; KEYSEQ is too long. | |
291 (if nil-for-too-long nil i) | |
292 alist))) | |
293 | |
18299
c6f35cac24b4
(coding-system-parent): New function.
Kenichi Handa <handa@m17n.org>
parents:
18200
diff
changeset
|
294 |
17052 | 295 ;; Coding system related functions. |
296 | |
297 ;;;###autoload | |
18200
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
298 (defun coding-system-post-read-conversion (coding-system) |
42049 | 299 "Return the value of CODING-SYSTEM's `post-read-conversion' property." |
88652
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
300 (coding-system-get coding-system :post-read-conversion)) |
18200
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
301 |
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
302 ;;;###autoload |
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
303 (defun coding-system-pre-write-conversion (coding-system) |
42049 | 304 "Return the value of CODING-SYSTEM's `pre-write-conversion' property." |
88652
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
305 (coding-system-get coding-system :pre-write-conversion)) |
18200
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
306 |
c913160e34a7
(set-coding-system-alist): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
17092
diff
changeset
|
307 ;;;###autoload |
22126
97cf1cae1971
Change term unification to
Kenichi Handa <handa@m17n.org>
parents:
21554
diff
changeset
|
308 (defun coding-system-translation-table-for-decode (coding-system) |
89483 | 309 "Return the value of CODING-SYSTEM's `decode-translation-table' property." |
88652
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
310 (coding-system-get coding-system :decode-translation-table)) |
19455
7cf3d42a6fd7
(coding-system-unification-table):
Kenichi Handa <handa@m17n.org>
parents:
19264
diff
changeset
|
311 |
7cf3d42a6fd7
(coding-system-unification-table):
Kenichi Handa <handa@m17n.org>
parents:
19264
diff
changeset
|
312 ;;;###autoload |
22126
97cf1cae1971
Change term unification to
Kenichi Handa <handa@m17n.org>
parents:
21554
diff
changeset
|
313 (defun coding-system-translation-table-for-encode (coding-system) |
89483 | 314 "Return the value of CODING-SYSTEM's `encode-translation-table' property." |
88652
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
315 (coding-system-get coding-system :encode-translation-table)) |
17052 | 316 |
18299
c6f35cac24b4
(coding-system-parent): New function.
Kenichi Handa <handa@m17n.org>
parents:
18200
diff
changeset
|
317 ;;;###autoload |
89483 | 318 (defmacro with-coding-priority (coding-systems &rest body) |
319 "Execute BODY like `progn' with CODING-SYSTEMS at the front of priority list. | |
320 CODING-SYSTEMS is a list of coding systems. See | |
321 `set-coding-priority'. This affects the implicit sorting of lists of | |
322 coding sysems returned by operations such as `find-coding-systems-region'." | |
323 (let ((current (make-symbol "current"))) | |
324 `(let ((,current (coding-system-priority-list))) | |
325 (apply #'set-coding-system-priority ,coding-systems) | |
326 (unwind-protect | |
327 (progn ,@body) | |
328 (apply #'set-coding-system-priority ,current))))) | |
329 (put 'with-coding-priority 'lisp-indent-function 1) | |
330 (put 'with-coding-priority 'edebug-form-spec t) | |
17052 | 331 |
18299
c6f35cac24b4
(coding-system-parent): New function.
Kenichi Handa <handa@m17n.org>
parents:
18200
diff
changeset
|
332 ;;;###autoload |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
333 (defmacro detect-coding-with-priority (from to priority-list) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
334 "Detect a coding system of the text between FROM and TO with PRIORITY-LIST. |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
335 PRIORITY-LIST is an alist of coding categories vs the corresponding |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
336 coding systems ordered by priority." |
88867
438e610d8d06
(detect-coding-with-priority): Fix the place of using `,' marker in
Kenichi Handa <handa@m17n.org>
parents:
88842
diff
changeset
|
337 `(with-coding-priority (mapcar #'cdr ,priority-list) |
88810 | 338 (detect-coding-region ,from ,to))) |
339 (make-obsolete 'detect-coding-with-priority | |
90104
a01e7a9f1659
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-14
Miles Bader <miles@gnu.org>
parents:
90103
diff
changeset
|
340 "Use with-coding-priority and detect-coding-region" "23.1") |
20162
dc6f12ef4d47
(find-safe-coding-system): New function.
Kenichi Handa <handa@m17n.org>
parents:
20113
diff
changeset
|
341 |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
342 ;;;###autoload |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
343 (defun detect-coding-with-language-environment (from to lang-env) |
89500
e8de75a86fbc
(detect-coding-with-language-environment): Doc fix.
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
344 "Detect a coding system for the text between FROM and TO with LANG-ENV. |
23196 | 345 The detection takes into account the coding system priorities for the |
20730
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
346 language environment LANG-ENV." |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
347 (let ((coding-priority (get-language-info lang-env 'coding-priority))) |
42d729244a85
(find-safe-coding-system): Moved to
Kenichi Handa <handa@m17n.org>
parents:
20162
diff
changeset
|
348 (if coding-priority |
88652
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
349 (with-coding-priority coding-priority |
8b4e3bbe01d4
(coding-system-post-read-conversion)
Dave Love <fx@gnu.org>
parents:
42049
diff
changeset
|
350 (detect-coding-region from to))))) |
20162
dc6f12ef4d47
(find-safe-coding-system): New function.
Kenichi Handa <handa@m17n.org>
parents:
20113
diff
changeset
|
351 |
52403 | 352 ;;;###autoload |
353 (defun char-displayable-p (char) | |
354 "Return non-nil if we should be able to display CHAR. | |
355 On a multi-font display, the test is only whether there is an | |
356 appropriate font from the selected frame's fontset to display CHAR's | |
357 charset in general. Since fonts may be specified on a per-character | |
358 basis, this may not be accurate." | |
359 (cond ((< char 256) | |
360 ;; Single byte characters are always displayable. | |
361 t) | |
58804
9b0a547610a4
(char-displayable-p): Return nil for unibyte mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57443
diff
changeset
|
362 ((not enable-multibyte-characters) |
9b0a547610a4
(char-displayable-p): Return nil for unibyte mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57443
diff
changeset
|
363 ;; Maybe there's a font for it, but we can't put it in the buffer. |
9b0a547610a4
(char-displayable-p): Return nil for unibyte mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57443
diff
changeset
|
364 nil) |
52403 | 365 ((display-multi-font-p) |
366 ;; On a window system, a character is displayable if we have | |
367 ;; a font for that character in the default face of the | |
368 ;; currently selected frame. | |
55095
4d5ade635f7a
(char-displayable-p): Simplified by using internal-char-font.
Kenichi Handa <handa@m17n.org>
parents:
54638
diff
changeset
|
369 (car (internal-char-font nil char))) |
52403 | 370 (t |
90058
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
371 (let ((coding 'iso-2022-7bit)) |
52403 | 372 (if coding |
90058
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
373 (let ((cs-list (coding-system-get coding :charset-list))) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
374 (cond |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
375 ((listp cs-list) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
376 (catch 'tag |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
377 (mapc #'(lambda (charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
378 (if (encode-char char charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
379 (throw 'tag charset))) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
380 cs-list) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
381 nil)) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
382 ((eq cs-list 'iso-2022) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
383 (catch 'tag2 |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
384 (mapc #'(lambda (charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
385 (if (and (plist-get (charset-plist charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
386 :iso-final-char) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
387 (encode-char char charset)) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
388 (throw 'tag2 charset))) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
389 charset-list) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
390 nil)) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
391 ((eq cs-list 'emacs-mule) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
392 (catch 'tag3 |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
393 (mapc #'(lambda (charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
394 (if (and (plist-get (charset-plist charset) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
395 :emacs-mule-id) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
396 (encode-char char charset)) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
397 (throw 'tag3 charset))) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
398 charset-list) |
48f163b71dbf
(char-displayable-p): Check :charset-list property of CODING.
Kenichi Handa <handa@m17n.org>
parents:
90054
diff
changeset
|
399 nil))))))))) |
17052 | 400 |
28458 | 401 (provide 'mule-util) |
402 | |
45453
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
403 ;; Local Variables: |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
404 ;; coding: iso-2022-7bit |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
405 ;; End: |
05d77f58ead5
(truncate-string-to-width): New optional argument `ellipsis'. Add
Colin Walters <walters@gnu.org>
parents:
42049
diff
changeset
|
406 |
58804
9b0a547610a4
(char-displayable-p): Return nil for unibyte mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57443
diff
changeset
|
407 ;; arch-tag: 5bdb52b6-a3a5-4529-b7a0-37d01b0e570b |
26890
4cd9407a4683
(set-nested-alist): Set BRANCHES (if
Kenichi Handa <handa@m17n.org>
parents:
26691
diff
changeset
|
408 ;;; mule-util.el ends here |