unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Replace latin-1-specific case-manipulation
@ 2019-02-20 14:26 Mattias Engdegård
  2019-02-20 17:24 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Mattias Engdegård @ 2019-02-20 14:26 UTC (permalink / raw)
  To: emacs-devel

There is some broken case-manipulation code from the latin-1 era in cmpl-coerce-string-case. OK to apply?

---
Replace latin-1-specific case-manipulation

* lisp/completion.el (cmpl-coerce-string-case):
Rewrite case-changing code written for latin-1 but not valid today.

diff --git a/lisp/completion.el b/lisp/completion.el
index 14ecc9b83d..1073ae8915 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -409,10 +409,7 @@ Used to decide whether to save completions.")
 (defun cmpl-coerce-string-case (string case-type)
   (cond ((eq case-type :down) (downcase string))
        ((eq case-type :up) (upcase string))
-       ((eq case-type :capitalized)
-        (setq string (downcase string))
-        (aset string 0 (logand ?\337 (aref string 0)))
-        string)
+       ((eq case-type :capitalized) (capitalize string))
        (t string)))
 
 (defun cmpl-merge-string-cases (string-to-coerce given-string)





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

* Re: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-20 14:26 Mattias Engdegård
@ 2019-02-20 17:24 ` Eli Zaretskii
  2019-02-20 20:47   ` Mattias Engdegård
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2019-02-20 17:24 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Wed, 20 Feb 2019 15:26:45 +0100
> 
> There is some broken case-manipulation code from the latin-1 era in cmpl-coerce-string-case. OK to apply?

How did you deduce it was for Latin-1?



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

* Re: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-20 17:24 ` Eli Zaretskii
@ 2019-02-20 20:47   ` Mattias Engdegård
  2019-02-21  3:37     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Mattias Engdegård @ 2019-02-20 20:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

20 feb. 2019 kl. 18.24 skrev Eli Zaretskii <eliz@gnu.org>:
> 
>> From: Mattias Engdegård <mattiase@acm.org>
>> Date: Wed, 20 Feb 2019 15:26:45 +0100
>> 
>> There is some broken case-manipulation code from the latin-1 era in cmpl-coerce-string-case. OK to apply?
> 
> How did you deduce it was for Latin-1?

Just a guess, from the bitwise AND with octal 337 which corresponds to the positions of upper/lower case letters in Latin-1.
But I suppose it could work for other in the ISO 8859-n series as well.




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

* Re: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-20 20:47   ` Mattias Engdegård
@ 2019-02-21  3:37     ` Eli Zaretskii
  2019-02-21  5:25       ` Drew Adams
  2019-02-21  9:30       ` Mattias Engdegård
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-02-21  3:37 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Wed, 20 Feb 2019 21:47:17 +0100
> Cc: emacs-devel@gnu.org
> 
> > How did you deduce it was for Latin-1?
> 
> Just a guess, from the bitwise AND with octal 337 which corresponds to the positions of upper/lower case letters in Latin-1.
> But I suppose it could work for other in the ISO 8859-n series as well.

I think it's simply because Emacs didn't have 'capitalize' back then.
That code survived since 1990.

So of course it's OK to use capitalize now.

Thanks.



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

* RE: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-21  3:37     ` Eli Zaretskii
@ 2019-02-21  5:25       ` Drew Adams
  2019-02-21 14:37         ` Eli Zaretskii
  2019-02-21  9:30       ` Mattias Engdegård
  1 sibling, 1 reply; 8+ messages in thread
From: Drew Adams @ 2019-02-21  5:25 UTC (permalink / raw)
  To: Eli Zaretskii, Mattias Engdegård; +Cc: emacs-devel

> I think it's simply because Emacs didn't have
> 'capitalize' back then.  That code survived
> since 1990.  So of course it's OK to use
> capitalize now.

FWIW, I think I used `capitalize', `capitalize-word',
and `capitalize-region' long ago, in the mid 1980s.

I could be mistaken, but my recollection is that
at least commands like `capitalize-word' and
`upcase-word' were used back then.



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

* Re: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-21  3:37     ` Eli Zaretskii
  2019-02-21  5:25       ` Drew Adams
@ 2019-02-21  9:30       ` Mattias Engdegård
  1 sibling, 0 replies; 8+ messages in thread
From: Mattias Engdegård @ 2019-02-21  9:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

21 feb. 2019 kl. 04.37 skrev Eli Zaretskii <eliz@gnu.org>:
> 
> I think it's simply because Emacs didn't have 'capitalize' back then.
> That code survived since 1990.
> 
> So of course it's OK to use capitalize now.

Thank you, pushed.




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

* Re: [PATCH] Replace latin-1-specific case-manipulation
  2019-02-21  5:25       ` Drew Adams
@ 2019-02-21 14:37         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-02-21 14:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: mattiase, emacs-devel

> Date: Wed, 20 Feb 2019 21:25:45 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: emacs-devel@gnu.org
> 
> > I think it's simply because Emacs didn't have
> > 'capitalize' back then.  That code survived
> > since 1990.  So of course it's OK to use
> > capitalize now.
> 
> FWIW, I think I used `capitalize', `capitalize-word',
> and `capitalize-region' long ago, in the mid 1980s.

In what program?  Emacs was first released "in mid 1980s", did you use
Emacs before version 18.

> I could be mistaken, but my recollection is that
> at least commands like `capitalize-word' and
> `upcase-word' were used back then.

For ASCII, most probably.



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

* RE: [PATCH] Replace latin-1-specific case-manipulation
       [not found]         ` <<834l8xgqbx.fsf@gnu.org>
@ 2019-02-21 15:23           ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2019-02-21 15:23 UTC (permalink / raw)
  To: Eli Zaretskii, Drew Adams; +Cc: mattiase, emacs-devel

> > > I think it's simply because Emacs didn't have
> > > 'capitalize' back then.  That code survived
> > > since 1990.  So of course it's OK to use
> > > capitalize now.
> >
> > FWIW, I think I used `capitalize', `capitalize-word',
> > and `capitalize-region' long ago, in the mid 1980s.
> 
> In what program?  Emacs was first released "in mid 1980s", did you use
> Emacs before version 18.

GNU Emacs, from the outset of my use of it.

But I don't know if it was before v18.  (I
definitely used v18.)

And I could be mistaken.  My recollection is
using capitalization commands as soon as GNU
Emacs was available (to me), in the 1980s.

My doubt is that this was introduced only in
1990 - but I could be wrong.

In any case, if there's no reason for this
code not to use `capitalize' then use
`capitalize'.  I wouldn't think that that
decision should depend on when `capitalize'
was first introduced.

> > I could be mistaken, but my recollection is that
> > at least commands like `capitalize-word' and
> > `upcase-word' were used back then.
> 
> For ASCII, most probably.

Yes, probably.  Some non-ASCII latin-1 too,
but I may have used such commands only with
ASCII.



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

end of thread, other threads:[~2019-02-21 15:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <<23807310-A2F9-4322-8A2C-03A63EFFD2AE@acm.org>
     [not found] ` <<83va1egypa.fsf@gnu.org>
     [not found]   ` <<779A26F9-FE8F-477E-81BD-86200977E81D@acm.org>
     [not found]     ` <<83ef81hkwb.fsf@gnu.org>
     [not found]       ` <<b5545b1f-2488-4943-a063-09c25ace7b9b@default>
     [not found]         ` <<834l8xgqbx.fsf@gnu.org>
2019-02-21 15:23           ` [PATCH] Replace latin-1-specific case-manipulation Drew Adams
2019-02-20 14:26 Mattias Engdegård
2019-02-20 17:24 ` Eli Zaretskii
2019-02-20 20:47   ` Mattias Engdegård
2019-02-21  3:37     ` Eli Zaretskii
2019-02-21  5:25       ` Drew Adams
2019-02-21 14:37         ` Eli Zaretskii
2019-02-21  9:30       ` Mattias Engdegård

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