all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: Buffer-local variables affect general-purpose functions
Date: Thu, 27 Mar 2014 19:17:46 +0200	[thread overview]
Message-ID: <83ppl7y30l.fsf@gnu.org> (raw)
In-Reply-To: <jwv4n2j2141.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: emacs-devel@gnu.org
> Date: Thu, 27 Mar 2014 10:17:23 -0400
> 
> >   M-x find-file-literally RET some-file RET
> >   M-x set-variable RET case-fold-search RET t RET
> >   M-: (chars-equal ?à ?À) 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, not
> > as Latin characters, and raw bytes don't have lower/upper-case pairs.
> 
> I agree with Paul on this one: this should be fixed to disregard
> unibyte setting.  `char-equal' compares chars, not bytes (use `eq'
> for bytes).
> It's an old backward compatibility hack that should go.

Paul seemed to say something more broad: that _all_ behaviors specific
to unibyte buffers should go away.  Do you agree?

Anyway, what should replace those hacks?  Arbitrarily interpreting raw
bytes as Latin characters is not TRT, IMO.

Actually, in the above case, we could simply make char-equal disregard
case-fold-search in unibyte buffers -- that would give you and Paul
what you want, but also keep backward compatibility (except for ASCII
characters).

> > The question is: do we want to do something about that?
> 
> Not sure.  It's hard to find all occurrences of this problem.
> And I don't think we can find a "general" solution: each case might be
> best solved in a different way.  Furthermore the right solution will
> sometimes (often?) be to throw away the current functionality and
> replace it with something different.

Maybe so, but something like

  (with-buffer-defaults BODY)

might be the solution, and should be easy enough to implement.  Or
maybe some other way of telling primitives: don't apply
buffer-specific behavior to this code.

>    % grep with-case-table **/*.el
>    emacs-lisp/lisp-mode.el:                       "eval-and-compile" "eval-when-compile" "with-case-table"
>    leim/quail/sisheng.el:  (with-case-table (standard-case-table)
>    mail/smtpmail.el:                   (with-case-table ascii-case-table ;Why?
>    subr.el:(defmacro with-case-table (table &rest body)
> 
> And the only uses of with-case-table are in lisp/leim/quail/sisheng.el
> (where it sets the standard case table, so it should have no effect) and
> in lisp/mail/smtpmail.el (where it uses ascii-case-table but should only
> apply it to ASCII text, so it could just as well use the standard case
> table).
> 
> And then we can use the Unicode 'case tables' as recently discussed.
> Patch for that welcome on trunk.

OK.




  reply	other threads:[~2014-03-27 17:17 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 19:04 Buffer-local variables affect general-purpose functions Eli Zaretskii
2014-03-26 19:32 ` Paul Eggert
2014-03-26 20:03   ` Eli Zaretskii
2014-03-26 21:50     ` Paul Eggert
2014-03-27 17:42       ` Eli Zaretskii
2014-03-27 18:55         ` Paul Eggert
2014-03-27 14:17 ` Stefan Monnier
2014-03-27 17:17   ` Eli Zaretskii [this message]
2014-03-27 21:04     ` Stefan Monnier
2014-03-28  7:11       ` Eli Zaretskii
2014-03-28  7:46         ` Paul Eggert
2014-03-28  8:18           ` Unibyte characters, strings and buffers Eli Zaretskii
2014-03-28 18:42             ` Paul Eggert
2014-03-28 18:52               ` Eli Zaretskii
2014-03-28 19:21                 ` Paul Eggert
2014-03-29  6:40                   ` Eli Zaretskii
2014-03-29 18:57                     ` Paul Eggert
2014-03-29 19:46                       ` Eli Zaretskii
2014-03-28 20:23                 ` Stefan Monnier
2014-03-29 19:34                 ` Stefan Monnier
2014-03-28 14:12         ` Buffer-local variables affect general-purpose functions Stefan Monnier
2014-03-28  3:38     ` Stephen J. Turnbull
2014-03-28  8:51       ` Unibyte characters, strings, and buffers Eli Zaretskii
2014-03-28 10:28         ` Stephen J. Turnbull
2014-03-28 10:58           ` David Kastrup
2014-03-28 11:22             ` Andreas Schwab
2014-03-28 11:34               ` David Kastrup
2014-03-28 11:42             ` Stephen J. Turnbull
2014-03-28 17:29           ` Eli Zaretskii
2014-03-28 17:50             ` David Kastrup
2014-03-28 18:31               ` Eli Zaretskii
2014-03-28 19:25                 ` David Kastrup
2014-03-29  6:43                   ` Eli Zaretskii
2014-03-29  7:23                     ` David Kastrup
2014-03-29  8:24                       ` Eli Zaretskii
2014-03-29  8:40                         ` David Kastrup
2014-03-29  9:25                           ` Eli Zaretskii
2014-03-28 20:27             ` Stefan Monnier
2014-03-29  9:23             ` Stephen J. Turnbull
2014-03-29  9:52               ` Andreas Schwab
2014-03-29 10:48                 ` Eli Zaretskii
2014-03-29 11:00                   ` Andreas Schwab
2014-03-29 11:18                     ` Eli Zaretskii
2014-03-29 11:30                       ` Andreas Schwab
     [not found]                         ` <83ha6hduzz.fsf@gnu.org>
2014-03-29 14:30                           ` Andreas Schwab
2014-03-29 14:47                             ` Eli Zaretskii
2014-03-29 10:42               ` David Kastrup
2014-03-29 11:07                 ` Eli Zaretskii
2014-03-29 11:30                   ` David Kastrup
2014-03-29 12:58                     ` Eli Zaretskii
2014-03-29 13:15                       ` David Kastrup
2014-03-29 10:44               ` Eli Zaretskii
2014-03-29 11:06               ` Andreas Schwab
2014-03-29 11:12                 ` Eli Zaretskii
2014-03-29 16:11                   ` Stephen J. Turnbull
2014-03-29 15:37                 ` Stephen J. Turnbull
2014-03-29 15:55                   ` David Kastrup
2014-03-29 16:28                     ` Stephen J. Turnbull
2014-03-29 17:00                       ` David Kastrup
2014-03-30  2:05                         ` Stephen J. Turnbull
2014-03-30  9:01                           ` David Kastrup
2014-03-30 12:13                             ` Stephen J. Turnbull
2014-03-30 14:25                             ` Andreas Schwab
2014-03-30 15:05                               ` David Kastrup
2014-03-30 15:39                                 ` Andreas Schwab
2014-03-29 17:08                       ` Andreas Schwab
2014-03-30  0:24                     ` Richard Stallman
2014-03-30  3:32                       ` Stefan Monnier
2014-03-30 15:13                         ` Richard Stallman
2014-03-29 15:58                   ` Andreas Schwab
2014-03-29 16:35                     ` Stephen J. Turnbull
2014-03-29 17:06                       ` Andreas Schwab
2014-03-29 17:01               ` Nathan Trapuzzano
2014-03-29 17:08                 ` Nathan Trapuzzano
2014-03-29 17:18                   ` David Kastrup
2014-03-29 17:33                     ` Nathan Trapuzzano
2014-03-30  0:24                       ` Richard Stallman
2014-03-30  8:38                         ` Andreas Schwab
2014-03-30 15:12                           ` Richard Stallman
2014-03-29 17:16                 ` David Kastrup
2014-03-28 18:45           ` Daniel Colascione
2014-03-28 19:35             ` Glenn Morris
2014-03-29 11:17             ` Stephen J. Turnbull
2014-03-29 11:22               ` Eli Zaretskii
2014-03-29 16:03                 ` Stephen J. Turnbull
2014-03-31 15:22                   ` Eli Zaretskii
2014-04-01  3:36                     ` Stephen J. Turnbull
2014-04-01  7:42                       ` David Kastrup
2014-04-01  9:38                         ` Stephen J. Turnbull
2014-04-01 15:19                         ` Eli Zaretskii
2014-04-01 15:16                       ` Eli Zaretskii
2014-04-02  4:20                         ` Stephen J. Turnbull
2014-04-02 17:06                           ` Eli Zaretskii
2014-04-03 10:59                             ` David Kastrup
2014-04-03 16:07                               ` Eli Zaretskii
2014-04-03 16:26                                 ` David Kastrup
2014-04-03 19:11                                   ` Eli Zaretskii
2014-04-03 20:03                                     ` David Kastrup
2014-04-04  0:48                                       ` Stephen J. Turnbull
2014-04-04  8:08                                         ` Eli Zaretskii
2014-04-04  7:58                                       ` Eli Zaretskii
2014-04-04 11:40                                     ` Richard Stallman
2014-04-03 13:04                             ` Stephen J. Turnbull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ppl7y30l.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.