emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115103: * lisp/progmodes/ruby-mode.el (ruby-mode-se


From: Bozhidar Batsov
Subject: [Emacs-diffs] trunk r115103: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding):
Date: Thu, 14 Nov 2013 12:42:41 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115103
revision-id: address@hidden
parent: address@hidden
committer: Bozhidar Batsov <address@hidden>
branch nick: master
timestamp: Thu 2013-11-14 14:39:41 +0200
message:
  * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding):
  Fix and simplify encoding comment update logic.
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-14 10:35:49 +0000
+++ b/lisp/ChangeLog    2013-11-14 12:39:41 +0000
@@ -2,6 +2,7 @@
 
        * progmodes/ruby-mode.el (ruby-mode-set-encoding):
        Add the ability to always insert an utf-8 encoding comment.
+       Fix and simplify coding comment update logic.
 
 2013-11-14  Michael Albinus  <address@hidden>
 

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2013-11-14 10:35:49 +0000
+++ b/lisp/progmodes/ruby-mode.el       2013-11-14 12:39:41 +0000
@@ -683,15 +683,11 @@
       (let ((coding-system (ruby--detect-encoding)))
         (when coding-system
           (if (looking-at "^#!") (beginning-of-line 2))
-          (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s 
*\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
+          (cond ((looking-at "\\s *#\\s *.*\\(en\\)?coding\\s *:\\s 
*\\([-a-z0-9_]*\\)")
+                 ;; update existing encoding comment if necessary
                  (unless (string= (match-string 2) coding-system)
                    (goto-char (match-beginning 2))
                    (delete-region (point) (match-end 2))
-                   (and (looking-at "-\*-")
-                        (let ((n (skip-chars-backward " ")))
-                          (cond ((= n 0) (insert "  ") (backward-char))
-                                ((= n -1) (insert " "))
-                                ((forward-char)))))
                    (insert coding-system)))
                 ((looking-at "\\s *#.*coding\\s *[:=]"))
                 (t (when ruby-insert-encoding-magic-comment


reply via email to

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