[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-se
From: |
Bozhidar Batsov |
Subject: |
[Emacs-diffs] trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use |
Date: |
Fri, 08 Nov 2013 16:03:13 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115036
revision-id: address@hidden
parent: address@hidden
committer: Bozhidar Batsov <address@hidden>
branch nick: master
timestamp: Fri 2013-11-08 18:01:55 +0200
message:
* lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use
`ruby-encoding-magic-comment-style' to control the
style of the auto-inserted encoding comment.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/ruby-mode.el
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-11-08 11:22:52 +0000
+++ b/lisp/ChangeLog 2013-11-08 16:01:55 +0000
@@ -1,3 +1,9 @@
+2013-11-08 Bozhidar Batsov <address@hidden>
+
+ * progmodes/ruby-mode.el (ruby-mode-set-encoding): Use
+ `ruby-encoding-magic-comment-style' to control the
+ style of the auto-inserted encoding comment.
+
2013-11-08 Dmitry Gutov <address@hidden>
* progmodes/ruby-mode.el (ruby-smie--indent-to-stmt): Use
=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el 2013-11-08 11:22:52 +0000
+++ b/lisp/progmodes/ruby-mode.el 2013-11-08 16:01:55 +0000
@@ -261,6 +261,20 @@
"Insert a magic Emacs 'coding' comment upon save if this is non-nil."
:type 'boolean :group 'ruby)
+(defcustom ruby-encoding-magic-comment-style 'ruby
+ "The style of the magic encoding comment to use."
+ :type '(choice
+ (const :tag "Emacs Style" emacs)
+ (const :tag "Ruby Style" ruby)
+ (const :tag "Custom Style" custom))
+ :group 'ruby)
+
+(defcustom ruby-custom-encoding-magic-comment-template "# coding: %s"
+ "The encoding comment template to be used when
+`ruby-encoding-magic-comment-style' is set to `custom'."
+ :type 'string
+ :group 'ruby)
+
(defcustom ruby-use-encoding-map t
"Use `ruby-encoding-map' to set encoding magic comment if this is non-nil."
:type 'boolean :group 'ruby)
@@ -639,7 +653,14 @@
(insert coding-system)))
((looking-at "\\s *#.*coding\\s *[:=]"))
(t (when ruby-insert-encoding-magic-comment
- (insert "# -*- coding: " coding-system " -*-\n"))))
+ (let ((encoding-magic-comment-template
+ (case ruby-encoding-magic-comment-style
+ ('ruby "# coding: %s")
+ ('emacs "# -*- coding: %s -*-")
+ ('custom
ruby-custom-encoding-magic-comment-template))))
+ (insert
+ (format encoding-magic-comment-template coding-system)
+ "\n")))))
(when (buffer-modified-p)
(basic-save-buffer-1)))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use,
Bozhidar Batsov <=