From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r114533: Revert 114527
Date: Sat, 05 Oct 2013 21:52:14 +0300 [thread overview]
Message-ID: <52505FDE.30106@yandex.ru> (raw)
In-Reply-To: <jwva9inbluk.fsf-monnier+emacsdiffs@gnu.org>
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)
next prev parent reply other threads:[~2013-10-05 18:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1VSVZF-0008Rg-4r@vcs.savannah.gnu.org>
2013-10-05 18:43 ` [Emacs-diffs] trunk r114533: Revert 114527 Stefan Monnier
2013-10-05 18:52 ` Dmitry Gutov [this message]
2013-10-05 19:02 ` Eli Zaretskii
2013-10-05 19:16 ` Dmitry Gutov
2013-10-05 19:38 ` Eli Zaretskii
2013-10-05 20:03 ` Dmitry Gutov
2013-10-06 2:40 ` Eli Zaretskii
2013-10-06 2:44 ` Dmitry Gutov
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=52505FDE.30106@yandex.ru \
--to=dgutov@yandex.ru \
--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.