From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Unibyte characters, strings, and buffers Date: Sat, 29 Mar 2014 12:30:21 +0100 Message-ID: <87txahp7hu.fsf@fencepost.gnu.org> References: <831txozsqa.fsf@gnu.org> <83ppl7y30l.fsf@gnu.org> <87r45nouvx.fsf@uwakimon.sk.tsukuba.ac.jp> <8361myyac6.fsf@gnu.org> <87a9capqfr.fsf@uwakimon.sk.tsukuba.ac.jp> <83eh1mfd09.fsf@gnu.org> <87ob0pnyt6.fsf@uwakimon.sk.tsukuba.ac.jp> <87y4ztp9p8.fsf@fencepost.gnu.org> <83mwg9dzzv.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1396092628 16508 80.91.229.3 (29 Mar 2014 11:30:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Mar 2014 11:30:28 +0000 (UTC) Cc: stephen@xemacs.org, monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 29 12:30:37 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WTrTB-0005C5-F7 for ged-emacs-devel@m.gmane.org; Sat, 29 Mar 2014 12:30:37 +0100 Original-Received: from localhost ([::1]:38508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTrTA-0006O4-QT for ged-emacs-devel@m.gmane.org; Sat, 29 Mar 2014 07:30:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTrT5-0006Ny-7U for emacs-devel@gnu.org; Sat, 29 Mar 2014 07:30:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTrT3-0004Zq-MH for emacs-devel@gnu.org; Sat, 29 Mar 2014 07:30:31 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTrT3-0004Zm-JD for emacs-devel@gnu.org; Sat, 29 Mar 2014 07:30:29 -0400 Original-Received: from localhost ([127.0.0.1]:59818 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTrT2-0005yT-SB; Sat, 29 Mar 2014 07:30:29 -0400 Original-Received: by lola (Postfix, from userid 1000) id B27AEE0497; Sat, 29 Mar 2014 12:30:21 +0100 (CET) In-Reply-To: <83mwg9dzzv.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Mar 2014 14:07:48 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:171139 Archived-At: Eli Zaretskii writes: >> From: David Kastrup > >> 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 way. >> 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 interfere. -- David Kastrup