aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2002-02-26 16:27:47 +0000
committerEli Zaretskii2002-02-26 16:27:47 +0000
commit5dde3c716fd5a30910fbfe3819d18e39d9279564 (patch)
treef99e8117f818e1662a215c6dc7b577d102ad4c00
parent4a81d892ea342a0fb19131754a8f5422b1548388 (diff)
downloademacs-5dde3c716fd5a30910fbfe3819d18e39d9279564.tar.gz
emacs-5dde3c716fd5a30910fbfe3819d18e39d9279564.zip
(ctext-pre-write-conversion): Handle the
case when FROM is a string, and when we are called from build_annotations_2.
-rw-r--r--lisp/international/mule.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 9bb9c4bf5cc..8235ce58e65 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1392,9 +1392,23 @@ encode each character in this charset. NOCTETS can be 0 (meaning the number
1392of octets per character is variable), 1, 2, 3, or 4.") 1392of octets per character is variable), 1, 2, 3, or 4.")
1393 1393
1394(defun ctext-pre-write-conversion (from to) 1394(defun ctext-pre-write-conversion (from to)
1395 "Encode characters between FROM and TO as Compound Text w/Extended Segments." 1395 "Encode characters between FROM and TO as Compound Text w/Extended Segments.
1396 (buffer-disable-undo) ; minimize consing due to insertions and deletions 1396
1397 (narrow-to-region from to) 1397If FROM is a string, or if the current buffer is not the one set up for us
1398by run_pre_post_conversion_on_str, generate a new temp buffer, insert the
1399text, and convert it in the temporary buffer. Otherwise, convert in-place."
1400 (cond ((and (string= (buffer-name) " *code-converting-work*")
1401 (not (stringp from)))
1402 ; Minimize consing due to subsequent insertions and deletions.
1403 (buffer-disable-undo)
1404 (narrow-to-region from to))
1405 (t
1406 (let ((buf (current-buffer)))
1407 (set-buffer (generate-new-buffer " *temp"))
1408 (buffer-disable-undo)
1409 (if (stringp from)
1410 (insert from)
1411 (insert-buffer-substring buf from to)))))
1398 (encode-coding-region from to 'ctext-no-compositions) 1412 (encode-coding-region from to 'ctext-no-compositions)
1399 ;; Replace ISO-2022 charset designations with extended segments, for 1413 ;; Replace ISO-2022 charset designations with extended segments, for
1400 ;; those charsets that are not part of the official X registry. 1414 ;; those charsets that are not part of the official X registry.
@@ -1404,6 +1418,8 @@ of octets per character is variable), 1, 2, 3, or 4.")
1404 (case-fold-search nil) 1418 (case-fold-search nil)
1405 pt desig encode-info encoding chset noctets textlen) 1419 pt desig encode-info encoding chset noctets textlen)
1406 (set-buffer-multibyte nil) 1420 (set-buffer-multibyte nil)
1421 ;; The regexp below finds the leading sequences for big5 and
1422 ;; iso8859-1[03-6] charsets.
1407 (while (re-search-forward "\e\\(\$([01]\\|-[VY_bf]\\)" nil 'move) 1423 (while (re-search-forward "\e\\(\$([01]\\|-[VY_bf]\\)" nil 'move)
1408 (setq desig (match-string 1) 1424 (setq desig (match-string 1)
1409 pt (point-marker) 1425 pt (point-marker)
@@ -1416,6 +1432,7 @@ of octets per character is variable), 1, 2, 3, or 4.")
1416 (cond 1432 (cond
1417 ((eq encoding t) ; only the leading sequence needs to be changed 1433 ((eq encoding t) ; only the leading sequence needs to be changed
1418 (setq textlen (+ (- newpt pt) (length chset) 1)) 1434 (setq textlen (+ (- newpt pt) (length chset) 1))
1435 ;; Generate the ICCCM control sequence for an extended segment.
1419 (replace-match (format "\e%%/%d%c%c%s" 1436 (replace-match (format "\e%%/%d%c%c%s"
1420 noctets 1437 noctets
1421 (+ (/ textlen 128) 128) 1438 (+ (/ textlen 128) 128)
@@ -1437,6 +1454,7 @@ of octets per character is variable), 1, 2, 3, or 4.")
1437 chset)))) 1454 chset))))
1438 (goto-char newpt)))) 1455 (goto-char newpt))))
1439 (set-buffer-multibyte t) 1456 (set-buffer-multibyte t)
1457 ;; Must return nil, as build_annotations_2 expects that.
1440 nil) 1458 nil)
1441 1459
1442;;; FILE I/O 1460;;; FILE I/O