unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Invalid read syntax for compiled bool vector
       [not found]   ` <857jw35hcq.fsf@junk.nocrew.org>
@ 2004-04-26 14:10     ` Richard Stallman
  2004-04-26 16:08       ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2004-04-26 14:10 UTC (permalink / raw)
  Cc: emacs-devel

    Apparently, you have to bind coding-system-for-write before writing a
    source file with a literal bool-vector constant in it, or else Emacs
    will either ask the user for the coding system, or write the file
    using some default coding system which may not do the right thing.

I guess we should change the syntax for bool-vectors
so as to put just 4 bits into each character.
The question is how to do that in a somewhat compatible way.

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 14:10     ` Invalid read syntax for compiled bool vector Richard Stallman
@ 2004-04-26 16:08       ` Andreas Schwab
  2004-04-26 17:47         ` Lars Brinkhoff
  2004-04-27 16:28         ` Richard Stallman
  0 siblings, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2004-04-26 16:08 UTC (permalink / raw)
  Cc: Lars Brinkhoff, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Apparently, you have to bind coding-system-for-write before writing a
>     source file with a literal bool-vector constant in it, or else Emacs
>     will either ask the user for the coding system, or write the file
>     using some default coding system which may not do the right thing.
>
> I guess we should change the syntax for bool-vectors
> so as to put just 4 bits into each character.
> The question is how to do that in a somewhat compatible way.

The print syntax could use octal or hexadecimal escapes in the bit string.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 16:08       ` Andreas Schwab
@ 2004-04-26 17:47         ` Lars Brinkhoff
  2004-04-26 22:01           ` Andreas Schwab
  2004-04-27 16:28         ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Brinkhoff @ 2004-04-26 17:47 UTC (permalink / raw)
  Cc: rms, emacs-devel

Andreas Schwab <schwab@suse.de> writes:
> Richard Stallman <rms@gnu.org> writes:
> >     Apparently, you have to bind coding-system-for-write before
> >     writing a source file with a literal bool-vector constant in
> >     it, or else Emacs will either ask the user for the coding
> >     system, or write the file using some default coding system
> >     which may not do the right thing.
> > I guess we should change the syntax for bool-vectors so as to put
> > just 4 bits into each character.  The question is how to do that
> > in a somewhat compatible way.
> The print syntax could use octal or hexadecimal escapes in the bit string.

Yes.  Since the print syntax for bool-vectors looks like strings, I
would sugggest doing whatever the print syntax for strings does.

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 17:47         ` Lars Brinkhoff
@ 2004-04-26 22:01           ` Andreas Schwab
  2004-04-26 22:53             ` David Kastrup
  2004-04-27 16:29             ` Richard Stallman
  0 siblings, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2004-04-26 22:01 UTC (permalink / raw)
  Cc: rms, emacs-devel

Lars Brinkhoff <lars@nocrew.org> writes:

> Andreas Schwab <schwab@suse.de> writes:
>> Richard Stallman <rms@gnu.org> writes:
>> >     Apparently, you have to bind coding-system-for-write before
>> >     writing a source file with a literal bool-vector constant in
>> >     it, or else Emacs will either ask the user for the coding
>> >     system, or write the file using some default coding system
>> >     which may not do the right thing.
>> > I guess we should change the syntax for bool-vectors so as to put
>> > just 4 bits into each character.  The question is how to do that
>> > in a somewhat compatible way.
>> The print syntax could use octal or hexadecimal escapes in the bit string.
>
> Yes.  Since the print syntax for bool-vectors looks like strings, I
> would sugggest doing whatever the print syntax for strings does.

I have now changed the print syntax to always use octal escapes for
non-ascii characters in the bool-vector string.  This way the string will
always be read as unibyte string, avoiding all coding issues.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 22:01           ` Andreas Schwab
@ 2004-04-26 22:53             ` David Kastrup
  2004-04-27 12:42               ` Andreas Schwab
  2004-04-27 16:29             ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: David Kastrup @ 2004-04-26 22:53 UTC (permalink / raw)
  Cc: Lars Brinkhoff, rms, emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> Lars Brinkhoff <lars@nocrew.org> writes:
>
> > Yes.  Since the print syntax for bool-vectors looks like strings,
> > I would sugggest doing whatever the print syntax for strings does.
> 
> I have now changed the print syntax to always use octal escapes for
> non-ascii characters in the bool-vector string.  This way the string
> will always be read as unibyte string, avoiding all coding issues.

I think that hexadecimal notation would be quite more compact, without
a loss of generality and (probably unimportant) readability.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 22:53             ` David Kastrup
@ 2004-04-27 12:42               ` Andreas Schwab
  2004-04-27 12:52                 ` David Kastrup
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2004-04-27 12:42 UTC (permalink / raw)
  Cc: Lars Brinkhoff, rms, emacs-devel

David Kastrup <dak@gnu.org> writes:

> I think that hexadecimal notation would be quite more compact, without
> a loss of generality and (probably unimportant) readability.

If you use hexadecimal notation then the reader will force the string to
multibyte, with octal notation it is forced to unibyte.  The process of
converting a unibyte string to multibyte will change characters in the
range 0x80..0x9f.  Maybe the bool vector reader should just force the
string back to unibyte.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-27 12:42               ` Andreas Schwab
@ 2004-04-27 12:52                 ` David Kastrup
  0 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2004-04-27 12:52 UTC (permalink / raw)
  Cc: Lars Brinkhoff, rms, emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> David Kastrup <dak@gnu.org> writes:
> 
> > I think that hexadecimal notation would be quite more compact, without
> > a loss of generality and (probably unimportant) readability.
> 
> If you use hexadecimal notation then the reader will force the string to
> multibyte, with octal notation it is forced to unibyte.  The process of
> converting a unibyte string to multibyte will change characters in the
> range 0x80..0x9f.  Maybe the bool vector reader should just force the
> string back to unibyte.

Ah, uh, ok.  Just forget it, then.  Looks like I did not know what I
was talking about.  Not that this happens too rarely...

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 16:08       ` Andreas Schwab
  2004-04-26 17:47         ` Lars Brinkhoff
@ 2004-04-27 16:28         ` Richard Stallman
  2004-04-27 17:47           ` Andreas Schwab
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2004-04-27 16:28 UTC (permalink / raw)
  Cc: lars, emacs-devel

    The print syntax could use octal or hexadecimal escapes in the bit string.

That would be incompatible for some bool-vector values, wouldn't it?
The \ character could appear in a bool-vector with the current syntax.

To avoid misinterpreting some constants, I think we need to change the
syntax in a bigger way, to use a new syntax that would not be valid at
all under the old rules.

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-26 22:01           ` Andreas Schwab
  2004-04-26 22:53             ` David Kastrup
@ 2004-04-27 16:29             ` Richard Stallman
  2004-04-27 17:54               ` Andreas Schwab
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2004-04-27 16:29 UTC (permalink / raw)
  Cc: lars, emacs-devel

    I have now changed the print syntax to always use octal escapes for
    non-ascii characters in the bool-vector string.  This way the string will
    always be read as unibyte string, avoiding all coding issues.

That was too hasty.  As I mentioned earlier, this solution would cause
some previously-written bool-vectors to be read wrong.

If nobody has any previously-written bool-vectors, that incompatibility
does not matter, but are we confident of that?  And is there a better way?

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-27 16:28         ` Richard Stallman
@ 2004-04-27 17:47           ` Andreas Schwab
  2004-04-29 10:43             ` Richard Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2004-04-27 17:47 UTC (permalink / raw)
  Cc: lars, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The print syntax could use octal or hexadecimal escapes in the bit string.
>
> That would be incompatible for some bool-vector values, wouldn't it?
> The \ character could appear in a bool-vector with the current syntax.

No, the print syntax already used backslash as escape within the string,
and the reader just uses the normal string parser.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-27 16:29             ` Richard Stallman
@ 2004-04-27 17:54               ` Andreas Schwab
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2004-04-27 17:54 UTC (permalink / raw)
  Cc: lars, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     I have now changed the print syntax to always use octal escapes for
>     non-ascii characters in the bool-vector string.  This way the string will
>     always be read as unibyte string, avoiding all coding issues.
>
> That was too hasty.  As I mentioned earlier, this solution would cause
> some previously-written bool-vectors to be read wrong.

The new syntax variant is completely backward and forward compatible.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Invalid read syntax for compiled bool vector
  2004-04-27 17:47           ` Andreas Schwab
@ 2004-04-29 10:43             ` Richard Stallman
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2004-04-29 10:43 UTC (permalink / raw)
  Cc: lars, emacs-devel

    No, the print syntax already used backslash as escape within the string,
    and the reader just uses the normal string parser.

Ok, in that case I see no problem in your solution.
Thanks for taking care of the problem.

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

end of thread, other threads:[~2004-04-29 10:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <85k70cbeil.fsf@junk.nocrew.org>
     [not found] ` <E1BFdNk-0003Ia-Oq@fencepost.gnu.org>
     [not found]   ` <857jw35hcq.fsf@junk.nocrew.org>
2004-04-26 14:10     ` Invalid read syntax for compiled bool vector Richard Stallman
2004-04-26 16:08       ` Andreas Schwab
2004-04-26 17:47         ` Lars Brinkhoff
2004-04-26 22:01           ` Andreas Schwab
2004-04-26 22:53             ` David Kastrup
2004-04-27 12:42               ` Andreas Schwab
2004-04-27 12:52                 ` David Kastrup
2004-04-27 16:29             ` Richard Stallman
2004-04-27 17:54               ` Andreas Schwab
2004-04-27 16:28         ` Richard Stallman
2004-04-27 17:47           ` Andreas Schwab
2004-04-29 10:43             ` Richard Stallman

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