unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: thai + M-q + cut'n'paste problem
Date: Thu, 31 Mar 2005 13:51:23 +0900 (JST)	[thread overview]
Message-ID: <200503310451.NAA04620@etlken.m17n.org> (raw)
In-Reply-To: <20050331.011639.85691665.wl@gnu.org> (message from Werner LEMBERG on Thu, 31 Mar 2005 01:16:39 +0200 (CEST))

In article <20050331.011639.85691665.wl@gnu.org>, Werner LEMBERG <wl@gnu.org> 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
solution.

> 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
handa@m17n.org

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))

      parent reply	other threads:[~2005-03-31  4:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30 23:16 thai + M-q + cut'n'paste problem Werner LEMBERG
2005-03-30 23:40 ` Werner LEMBERG
2005-03-31  4:51 ` Kenichi Handa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200503310451.NAA04620@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).