зеркало из https://github.com/github/ruby.git
* 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:
Родитель
1ecf20cda2
Коммит
449822c76c
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>
|
Tue Oct 8 03:19:19 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* misc/ruby-additional.el (ruby-mode-set-encoding): Add support
|
* misc/ruby-additional.el (ruby-mode-set-encoding): Add support
|
||||||
|
|
|
@ -73,12 +73,17 @@
|
||||||
(or (ruby-brace-to-do-end)
|
(or (ruby-brace-to-do-end)
|
||||||
(ruby-do-end-to-brace)))
|
(ruby-do-end-to-brace)))
|
||||||
|
|
||||||
(defcustom ruby-encoding-map
|
(defconst ruby-default-encoding-map
|
||||||
'((us-ascii . nil) ;; Do not put coding: us-ascii
|
'((us-ascii . nil) ;; Do not put coding: us-ascii
|
||||||
(utf-8 . nil) ;; Do not put coding: utf-8
|
(utf-8 . nil) ;; Do not put coding: utf-8
|
||||||
(shift-jis . cp932) ;; Emacs charset name of Shift_JIS
|
(shift-jis . cp932) ;; Emacs charset name of Shift_JIS
|
||||||
(shift_jis . cp932) ;; MIME charset name of Shift_JIS
|
(shift_jis . cp932) ;; MIME charset name of Shift_JIS
|
||||||
(japanese-cp932 . cp932)) ;; Emacs charset name of CP932
|
(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.
|
"Alist to map encoding name from Emacs to Ruby.
|
||||||
Associating an encoding name with nil means it needs not be
|
Associating an encoding name with nil means it needs not be
|
||||||
explicitly declared in magic comment."
|
explicitly declared in magic comment."
|
||||||
|
@ -107,8 +112,10 @@ Emacs to Ruby."
|
||||||
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
||||||
(cond ((eq coding-type 'undecided)
|
(cond ((eq coding-type 'undecided)
|
||||||
(if nonascii
|
(if nonascii
|
||||||
(if (coding-system-get coding-system :prefer-utf-8)
|
(or (and (coding-system-get coding-system :prefer-utf-8)
|
||||||
'utf-8 'ascii-8bit)))
|
'utf-8)
|
||||||
|
(coding-system-get default-buffer-file-coding-system :coding-type)
|
||||||
|
'ascii-8bit)))
|
||||||
((memq coding-type '(utf-8 shift-jis))
|
((memq coding-type '(utf-8 shift-jis))
|
||||||
coding-type))))))
|
coding-type))))))
|
||||||
(coding-system
|
(coding-system
|
||||||
|
|
|
@ -355,8 +355,10 @@ Emacs to Ruby."
|
||||||
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
(let ((coding-type (coding-system-get coding-system :coding-type)))
|
||||||
(cond ((eq coding-type 'undecided)
|
(cond ((eq coding-type 'undecided)
|
||||||
(if nonascii
|
(if nonascii
|
||||||
(if (coding-system-get coding-system :prefer-utf-8)
|
(or (and (coding-system-get coding-system :prefer-utf-8)
|
||||||
'utf-8 'ascii-8bit)))
|
'utf-8)
|
||||||
|
(coding-system-get default-buffer-file-coding-system :coding-type)
|
||||||
|
'ascii-8bit)))
|
||||||
((memq coding-type '(utf-8 shift-jis))
|
((memq coding-type '(utf-8 shift-jis))
|
||||||
coding-type))))))
|
coding-type))))))
|
||||||
(coding-system
|
(coding-system
|
||||||
|
|
Загрузка…
Ссылка в новой задаче