From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Buffer-local variables affect general-purpose functions Date: Wed, 26 Mar 2014 21:04:45 +0200 Message-ID: <831txozsqa.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1395860702 22802 80.91.229.3 (26 Mar 2014 19:05:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2014 19:05:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 26 20:05:11 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 1WSt8Q-0000NS-UH for ged-emacs-devel@m.gmane.org; Wed, 26 Mar 2014 20:05:11 +0100 Original-Received: from localhost ([::1]:49810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSt8Q-0002YS-Ex for ged-emacs-devel@m.gmane.org; Wed, 26 Mar 2014 15:05:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSt8H-0002Ey-Ul for emacs-devel@gnu.org; Wed, 26 Mar 2014 15:05:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSt86-0006YE-Rd for emacs-devel@gnu.org; Wed, 26 Mar 2014 15:05:01 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:33370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSt86-0006XB-J4 for emacs-devel@gnu.org; Wed, 26 Mar 2014 15:04:50 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0N3200N004R2FV00@mtaout27.012.net.il> for emacs-devel@gnu.org; Wed, 26 Mar 2014 21:01:58 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N3200IMD4VAO050@mtaout27.012.net.il> for emacs-devel@gnu.org; Wed, 26 Mar 2014 21:01:58 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.183 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:171009 Archived-At: (See bug#17011 for some context.) In some cases, Emacs uses buffer-local variables in ways that affect operations which might not have anything with buffer text. One example, from bug #17011 is this: M-x find-file-literally RET some-file RET M-x set-variable RET case-fold-search RET t RET M-: (chars-equal ?=E0 ?=C0) RET This produces nil, although the characters should compare equal under case-fold-search. Why? Because we are in a unibyte buffer, where values between 128 and 255 are interpreted as eight-bit raw bytes, no= t as Latin characters, and raw bytes don't have lower/upper-case pairs. Another example, from the same sequence of commands above, is the fac= t that setting case-fold-search for the buffer affects comparison of characters that don't belong to the buffer, merely because that buffe= r happens to be current at the moment of comparison. Yet another example is 'downcase' and 'upcase' functions -- they use case tables local to the current buffer, even when the functions they are applied to characters and strings not from the buffer. This could produce subtle bugs, and is certainly confusing and unexpected, at least by some. The question is: do we want to do something about that?