unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Clipboard and coding systems
@ 2004-10-19 12:21 Jérôme Marant
  2004-10-25  1:24 ` Kenichi Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Jérôme Marant @ 2004-10-19 12:21 UTC (permalink / raw)



Hi,

We (Debian) recently received a bug report related to the clipboard
and coding systems (http://bugs.debian.org/276098).

Here is a way to reproduce the weirdness.

(Emacs 21.3 with Latin-9 language environment)

1) Start Emacs, type `abéècd' in a fresh buffer, copy the typed text
and paste it within the following command in a Xterm:

amboise:~$ echo 'abéècd' > foo

Then,

amboise:~$ hex foo
0x00000000: 61 62 e9 e8 63 64 0a    -                         abéècdJ

2) Start Emacs, type `abéècd' in a fresh buffer, copy the typed text,
_exit from Emacs_ and paste within the following command in a Xterm:

amboise:~$ echo 'abéècd' > foo

Then,

amboise:~$ hex foo
0x00000000: 61 62 8e e9 8e e8 63 64 - 0a                      ab....cdJ

Can this be explained or is it a bug?

Thanks.

-- 
Jérôme Marant

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clipboard and coding systems
  2004-10-19 12:21 Clipboard and coding systems Jérôme Marant
@ 2004-10-25  1:24 ` Kenichi Handa
  2004-11-09 22:29   ` Jérôme Marant
  0 siblings, 1 reply; 5+ messages in thread
From: Kenichi Handa @ 2004-10-25  1:24 UTC (permalink / raw)
  Cc: rms, emacs-devel

In article <871xfuzyo8.fsf@marant.org>, Jérôme Marant <jmarant@nerim.net> writes:

> 2) Start Emacs, type `abéècd' in a fresh buffer, copy the typed text,
> _exit from Emacs_ and paste within the following command in a Xterm:

> amboise:~$ echo 'abéècd' > foo

> Then,

> amboise:~$ hex foo
> 0x00000000: 61 62 8e e9 8e e8 63 64 - 0a                      ab....cdJ

> Can this be explained or is it a bug?

Thank you for the report.  But, I found the fix is not easy.
The explanation is complex and difficult.

This problem is because Emacs stores internal multibyte
sequence into a cut buffer.  So, I at first thought that we
can simply encode STRING by locale-coding-system in
x-set-cut-buffer.  But, then x-cut-buffer-or-selection-value
doesn't work when we copy a string that can't be encoded by
locale-coding-system.  That is because
x-cut-buffer-or-selection-value looks up a cut buffer by
x-get-cut-buffer and compare it with
x-last-selected-text-cut, and they differs.

So, my question is: Should Emacs still support pasting form
an application that uses only a cut buffer?  If not, we can
make x-cut-buffer-or-selection-value not check a cut buffer,
then, we can store encoded string in a cut buffer by
x-set-cut-buffer?

Another way is to solve this problem (the comment before
x-cut-buffer-or-selection-value) not in
x-cut-buffer-or-selection-value.

;;; If this function is called twice and finds the same text,
;;; it returns nil the second time.  This is so that a single
;;; selection won't be added to the kill ring over and over.

---
Ken'ichi HANDA
handa@m17n.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clipboard and coding systems
  2004-10-25  1:24 ` Kenichi Handa
@ 2004-11-09 22:29   ` Jérôme Marant
  2004-12-01  0:38     ` Kenichi Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Jérôme Marant @ 2004-11-09 22:29 UTC (permalink / raw)
  Cc: rms, emacs-devel

Kenichi Handa <handa@m17n.org> writes:

> So, my question is: Should Emacs still support pasting form
> an application that uses only a cut buffer?  If not, we can
> make x-cut-buffer-or-selection-value not check a cut buffer,
> then, we can store encoded string in a cut buffer by
> x-set-cut-buffer?
>
> Another way is to solve this problem (the comment before
> x-cut-buffer-or-selection-value) not in
> x-cut-buffer-or-selection-value.
>
> ;;; If this function is called twice and finds the same text,
> ;;; it returns nil the second time.  This is so that a single
> ;;; selection won't be added to the kill ring over and over.

Hi,

Has anything been decided about fixing this problem? Thanks.

Cheers,

-- 
Jérôme Marant

http://marant.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clipboard and coding systems
  2004-11-09 22:29   ` Jérôme Marant
@ 2004-12-01  0:38     ` Kenichi Handa
  2004-12-05 13:08       ` Jérôme Marant
  0 siblings, 1 reply; 5+ messages in thread
From: Kenichi Handa @ 2004-12-01  0:38 UTC (permalink / raw)
  Cc: rms, emacs-devel

In article <87bre6k65d.fsf@marant.org>, Jérôme Marant <jmarant@nerim.net> writes:

> Kenichi Handa <handa@m17n.org> writes:
>>  So, my question is: Should Emacs still support pasting form
>>  an application that uses only a cut buffer?  If not, we can
>>  make x-cut-buffer-or-selection-value not check a cut buffer,
>>  then, we can store encoded string in a cut buffer by
>>  x-set-cut-buffer?
>> 
>>  Another way is to solve this problem (the comment before
>>  x-cut-buffer-or-selection-value) not in
>>  x-cut-buffer-or-selection-value.
>> 
>>  ;;; If this function is called twice and finds the same text,
>>  ;;; it returns nil the second time.  This is so that a single
>>  ;;; selection won't be added to the kill ring over and over.

> Hi,

> Has anything been decided about fixing this problem? Thanks.

Sorry for not responding long time.  As I found a simple
solution, I've just installed a fix.  Please try the latest
CVS code.

---
Ken'ichi HANDA
handa@m17n.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clipboard and coding systems
  2004-12-01  0:38     ` Kenichi Handa
@ 2004-12-05 13:08       ` Jérôme Marant
  0 siblings, 0 replies; 5+ messages in thread
From: Jérôme Marant @ 2004-12-05 13:08 UTC (permalink / raw)
  Cc: handa

Kenichi Handa <handa@m17n.org> writes:

>> Has anything been decided about fixing this problem? Thanks.
>
> Sorry for not responding long time.  As I found a simple
> solution, I've just installed a fix.  Please try the latest
> CVS code.

Many thanks. It seems to work fine now.

Cheers,

-- 
Jérôme Marant

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-05 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 12:21 Clipboard and coding systems Jérôme Marant
2004-10-25  1:24 ` Kenichi Handa
2004-11-09 22:29   ` Jérôme Marant
2004-12-01  0:38     ` Kenichi Handa
2004-12-05 13:08       ` Jérôme Marant

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