]> Cypherpunks repositories - gostls13.git/commitdiff
Emacs go-mode: don't indent the inside of strings.
authorPeter Kleiweg <pkleiweg@xs4all.nl>
Tue, 29 May 2012 20:30:06 +0000 (16:30 -0400)
committerSameer Ajmani <sameer@golang.org>
Tue, 29 May 2012 20:30:06 +0000 (16:30 -0400)
Two fixes for indentation problems:

1. Properly recognize multi-line strings. These start with `, not ".

2. Don't indent a line if the beginning of the line is the end of a multi-line string. This happened for instance when inserting a closing bracket after a multi-line string.

R=sameer
CC=golang-dev
https://golang.org/cl/6157044

misc/emacs/go-mode.el

index 783d1a8bb5983986ce7615bf28202156efd05056..f6ae568229a38de2d90695e97b3bf68df3c6b62c 100644 (file)
@@ -250,8 +250,8 @@ comment or string."
 
   (unless pos
     (setq pos (point)))
-  (when (> pos go-mode-mark-cs-end)
-    (go-mode-mark-cs pos))
+  (when (>= pos go-mode-mark-cs-end)
+    (go-mode-mark-cs (1+ pos)))
   (get-text-property pos 'go-mode-cs))
 
 (defun go-mode-mark-cs (end)
@@ -597,7 +597,7 @@ indented one level."
       (cond
        ((and cs (save-excursion
                   (goto-char (car cs))
-                  (looking-at "\\s\"")))
+                  (looking-at "`")))
         ;; Inside a multi-line string.  Don't mess with indentation.
         nil)
        (cs