mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* misc/ruby-additional.el (ruby-mode-set-encoding): Use
`default-buffer-file-coding-system` if the :prefer-utf-8 property is not available. * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto. * misc/ruby-additional.el (ruby-encoding-map): Override the default value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1ecf20cda2
commit
449822c76c
3 changed files with 25 additions and 5 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Tue Oct 8 03:57:34 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* misc/ruby-additional.el (ruby-mode-set-encoding): Use
|
||||
`default-buffer-file-coding-system` if the :prefer-utf-8
|
||||
property is not available.
|
||||
|
||||
* misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
|
||||
|
||||
* misc/ruby-additional.el (ruby-encoding-map): Override the
|
||||
default value.
|
||||
|
||||
Tue Oct 8 03:19:19 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* misc/ruby-additional.el (ruby-mode-set-encoding): Add support
|
||||
|
|
|
@ -73,12 +73,17 @@
|
|||
(or (ruby-brace-to-do-end)
|
||||
(ruby-do-end-to-brace)))
|
||||
|
||||
(defcustom ruby-encoding-map
|
||||
(defconst ruby-default-encoding-map
|
||||
'((us-ascii . nil) ;; Do not put coding: us-ascii
|
||||
(utf-8 . nil) ;; Do not put coding: utf-8
|
||||
(shift-jis . cp932) ;; Emacs charset name of Shift_JIS
|
||||
(shift_jis . cp932) ;; MIME charset name of Shift_JIS
|
||||
(japanese-cp932 . cp932)) ;; Emacs charset name of CP932
|
||||
)
|
||||
|
||||
(custom-set-default 'ruby-encoding-map ruby-default-encoding-map)
|
||||
|
||||
(defcustom ruby-encoding-map ruby-default-encoding-map
|
||||
"Alist to map encoding name from Emacs to Ruby.
|
||||
Associating an encoding name with nil means it needs not be
|
||||
explicitly declared in magic comment."
|
||||
|
@ -107,8 +112,10 @@ Emacs to Ruby."
|
|||
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
||||
(cond ((eq coding-type 'undecided)
|
||||
(if nonascii
|
||||
(if (coding-system-get coding-system :prefer-utf-8)
|
||||
'utf-8 'ascii-8bit)))
|
||||
(or (and (coding-system-get coding-system :prefer-utf-8)
|
||||
'utf-8)
|
||||
(coding-system-get default-buffer-file-coding-system :coding-type)
|
||||
'ascii-8bit)))
|
||||
((memq coding-type '(utf-8 shift-jis))
|
||||
coding-type))))))
|
||||
(coding-system
|
||||
|
|
|
@ -355,8 +355,10 @@ Emacs to Ruby."
|
|||
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
||||
(cond ((eq coding-type 'undecided)
|
||||
(if nonascii
|
||||
(if (coding-system-get coding-system :prefer-utf-8)
|
||||
'utf-8 'ascii-8bit)))
|
||||
(or (and (coding-system-get coding-system :prefer-utf-8)
|
||||
'utf-8)
|
||||
(coding-system-get default-buffer-file-coding-system :coding-type)
|
||||
'ascii-8bit)))
|
||||
((memq coding-type '(utf-8 shift-jis))
|
||||
coding-type))))))
|
||||
(coding-system
|
||||
|
|
Loading…
Reference in a new issue