[Top][All Lists]

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

Re: Unibyte characters, strings, and buffers

From: David Kastrup
Subject: Re: Unibyte characters, strings, and buffers
Date: Sat, 29 Mar 2014 12:30:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: David Kastrup <address@hidden>
>> If we want different semantics for case-fold-search in binary buffers,
>> then the solution is setting a buffer-local setting of case-fold-search
>> when opening a buffer intended to be manipulated in a binary way.
>> But the unibyte setting of the buffer should not affect normal character
>> and string operation semantics.  It is a buffer implementation detail
>> that should not really have a visible effect apart from making some
>> buffer operations impossible.
> But if case-fold-search is set to nil in unibyte buffers, and (as we
> know) buffer-local value of case-fold-search does affects functions
> that compare text, either because they consult case-fold-search
> directly or because the consult buffer-local case-table, then the
> unibyte setting does affect the semantics, albeit indirectly.

No, it doesn't.  Correlation is not causation.  Just because some
operations will create a unibyte buffer as well as set a
case-fold-search variable does not mean that the unibyte setting of the
buffer is the cause of the case-fold-search setting in any meaningful

>> If something chooses a unibyte buffer representation for some reason,
>> it is the responsibility of the same something to switch character
>> operations and case-fold-search etc to something making sense in the
>> context of its operation.  That may well be through some buffer-local
>> setting of case-fold-search etc, but it is not tied to the internal
>> representation of the buffer contents.
> Not that I disagree with you, but why does it matter whether some code
> makes a buffer unibyte or sets its case-fold-search, to achieve that
> goal?  In both cases, that something tells Emacs to ignore case
> conversion, it just uses 2 different ways of saying that.  If we are
> not going to abolish unibyte buffers, how is the difference important?

Because it makes things predictable.  I can take a look at the setting
of case-fold-search in order to figure out what will happen regarding
the case folding of searches.  If I want them to occur, I can set the
variable, and if I don't want them to occur, I can clear that variable.

I can perfectly well do that with a let-binding, and it will work
throughout the let-binding without having some buffer properties

David Kastrup

reply via email to

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