[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] trunk r114533: Revert 114527

From: Dmitry Gutov
Subject: Re: [Emacs-diffs] trunk r114533: Revert 114527
Date: Sat, 05 Oct 2013 21:52:14 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

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
+        (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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]