[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thai + M-q + cut'n'paste problem

From: Kenichi Handa
Subject: Re: thai + M-q + cut'n'paste problem
Date: Thu, 31 Mar 2005 13:51:23 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Werner LEMBERG <address@hidden> writes:
> I see two bugs with the current Thai support, but I suspect that both
> are symptoms of the same problem.

> 1. Open the attached file in an `emacs -Q' (using thai-tis620
>    encoding), mark the paragraph as a region paste to another `emacs
>    -Q' (under X11), and you can see that all composite glyphs are
>    displayed decomposed.

This is an old propblem.  If Thai text is decoded from
ctext, it isn't composed automatically.  I'll try to find a

> 2. Start `emacs -Q', set language environment to `Thai' and load the
>    attached file.  Then set the right margin to 60 characters and do
>    M-q.  In the fourth line, the first character appears decomposed.
>    If you do another call to M-q, the character is composed.

This is because fill-newline does this:

  ;; Give newline the properties of the space(s) it replaces
  (set-text-properties (1- (point)) (point)
                       (text-properties-at (point)))

As we should never copy `composition' property, I've just
installed the attached change.   But, aren't there any other
text properties that shouldn't be copied here?

Ken'ichi HANDA

Index: fill.el
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/fill.el,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -c -r1.174 -r1.175
cvs diff: conflicting specifications of output style
*** fill.el     11 Mar 2005 02:04:05 -0000      1.174
--- fill.el     31 Mar 2005 04:44:46 -0000      1.175
*** 539,544 ****
--- 539,555 ----
            ;; Make sure we take SOMETHING after the fill prefix if any.
            (fill-find-break-point linebeg)))))
+ ;; Like text-properties-at but don't include `composition' property.
+ (defun fill-text-properties-at (pos)
+   (let ((l (text-properties-at pos))
+       prop-list)
+     (while l
+       (unless (eq (car l) 'composition)
+       (setq prop-list
+             (cons (car l) (cons (cadr l) prop-list))))
+       (setq l (cddr l)))
+     prop-list))
  (defun fill-newline ()
    ;; Replace whitespace here with one newline, then
    ;; indent to left margin.
*** 546,552 ****
    (insert ?\n)
    ;; Give newline the properties of the space(s) it replaces
    (set-text-properties (1- (point)) (point)
!                      (text-properties-at (point)))
    (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
         (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
           (match-end 2))
--- 557,563 ----
    (insert ?\n)
    ;; Give newline the properties of the space(s) it replaces
    (set-text-properties (1- (point)) (point)
!                      (fill-text-properties-at (point)))
    (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
         (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
           (match-end 2))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]