From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: package.el encoding problem Date: Sat, 25 May 2019 19:03:30 +0300 Message-ID: <8336l24j3h.fsf@gnu.org> References: <87blztw65c.fsf@wavexx.thregr.org> <83k1ef3ugs.fsf@gnu.org> <83ef4m4pet.fsf@gnu.org> <837eae4lw0.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="100749"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 25 18:05:38 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUZAw-000Q2V-LJ for ged-emacs-devel@m.gmane.org; Sat, 25 May 2019 18:05:38 +0200 Original-Received: from localhost ([127.0.0.1]:43948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUZAv-0003TV-LX for ged-emacs-devel@m.gmane.org; Sat, 25 May 2019 12:05:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUZAD-0003SQ-7g for emacs-devel@gnu.org; Sat, 25 May 2019 12:04:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:32856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUZ8u-0005Uq-Q5; Sat, 25 May 2019 12:03:33 -0400 Original-Received: from [176.228.60.248] (port=4370 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hUZ8t-0002CA-1S; Sat, 25 May 2019 12:03:31 -0400 In-reply-to: (message from Stefan Monnier on Sat, 25 May 2019 11:26:21 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:236983 Archived-At: > From: Stefan Monnier > Date: Sat, 25 May 2019 11:26:21 -0400 > > > You previously said that in the past we attempted to bind > > coding-system-for-write, which in general is the easiest way of > > preventing the prompt. Didn't it work? > > For some reason this function does something else: > > (defun package--write-file-no-coding (file-name) > (let ((buffer-file-coding-system 'no-conversion)) > (write-region (point-min) (point-max) file-name nil 'silent))) > > AFAIK using coding-system-for-write would have solve the problem as well. Yes. In fact, binding buffer-file-coding-system is not useful at all. So why not bind coding-system-for-write here? > > One obvious benefit is that you won't need to set the buffer to be > > unibyte. > > (set-buffer-multibyte nil) sets up the buffer to receive bytes. > Since we're putting bytes into the buffer, it's The Right Thing to do. We disagree here. We can put bytes into a multibyte buffer, they have a special representation there which tells they are raw bytes, so there's nothing wrong with doing that. > > People tend to regard this as some kind of black magic, which creates > > myths, like the (wrong) idea that unibyte text cannot be processed > > correctly in a multibyte buffer. > > I think they're right: it's hard to get it right. Using a multibyte buffer removes one subtlety from what we should educate people to do in this case, so it's easier to get that right. > Don't get me wrong: it's important that it be possible to do it, because > that's sometimes necessary. But when the code only manipulates bytes, > using any multibyte objects along the way is asking for trouble. Sorry, I see no trouble here. the only trouble is the binding of buffer-file-coding-system instead of coding-system-for-write.