From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r114533: Revert 114527 Date: Sat, 05 Oct 2013 21:52:14 +0300 Message-ID: <52505FDE.30106@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1380999155 6493 80.91.229.3 (5 Oct 2013 18:52:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Oct 2013 18:52:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 05 20:52:38 2013 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 1VSWxy-0004eY-NY for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2013 20:52:38 +0200 Original-Received: from localhost ([::1]:52736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSWxy-0005hk-DV for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2013 14:52:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSWxo-0005hc-8Y for emacs-devel@gnu.org; Sat, 05 Oct 2013 14:52:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSWxf-0000Gx-Qs for emacs-devel@gnu.org; Sat, 05 Oct 2013 14:52:28 -0400 Original-Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]:45251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSWxf-0000Go-JZ for emacs-devel@gnu.org; Sat, 05 Oct 2013 14:52:19 -0400 Original-Received: by mail-ee0-f45.google.com with SMTP id c50so2431308eek.18 for ; Sat, 05 Oct 2013 11:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Ph6wRgSNmbjCbN5oyN+P8heazhlChmlxa38BrvYqsA0=; b=aBCgCKXKKgysUe0W2GPTCaMJ9c2ANQ7JSlRt0cnBtCJIL4Jglw3CdVv6nznRJhF2tk Jw1YKaAk0Y6E0l46a7B25mBPKzUZEJkLJwAb0zcVfHBkmNgRtNab6FLQzX32heZMHUSk SNXBLEIMd3KMjLZrkB9/uW61e0qPfuMTCqFuGXzoqxGmdijiILTe3Uobr+9su2HdOp70 fJjunXLfJfycf0qeHEJi/EB9BwT4OSTAA0dmNvHf4cVT4aWbUh0JI6OLl3gd5mVh1gjE XPZf4hghuTJhl5cSB5pIvYIdDWw6qgbw8dcQE5sfRgoyS61F7lOuHI5uUS6DtO8U11/I mU+w== X-Received: by 10.15.93.131 with SMTP id w3mr6212126eez.47.1380999138416; Sat, 05 Oct 2013 11:52:18 -0700 (PDT) Original-Received: from [192.168.10.2] (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id h52sm42475095eez.3.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Oct 2013 11:52:17 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22d 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:163889 Archived-At: On 05.10.2013 21:43, Stefan Monnier wrote: >> `last-coding-system-used' is unreliable: it can be modified by other >> functions in `after-save-hook'. > > Indeed. Why not use buffer-file-coding-system? Because its value doesn't change (from the initial `undecided-unix') even after the buffer is saved with new, non-ASCII characters. Should this be considered a bug? So far I've decided to use `select-safe-coding-system-function', but it just adds to the mess: === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-10-05 17:21:22 +0000 +++ lisp/progmodes/ruby-mode.el 2013-10-05 18:49:48 +0000 @@ -452,6 +452,9 @@ (let ((coding-system (or coding-system-for-write buffer-file-coding-system))) + (when (string-match-p "\\`undecided-" (symbol-name coding-system)) + (setq coding-system (funcall select-safe-coding-system-function + (point-min) (point-max) nil #'identity))) (if coding-system (setq coding-system (or (coding-system-get coding-system 'mime-charset)