Commit 2d1fa089 authored by Peter Kleiweg's avatar Peter Kleiweg Committed by Sameer Ajmani

Emacs go-mode: don't indent the inside of strings.

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
parent bd7c6263
...@@ -250,8 +250,8 @@ comment or string." ...@@ -250,8 +250,8 @@ comment or string."
(unless pos (unless pos
(setq pos (point))) (setq pos (point)))
(when (> pos go-mode-mark-cs-end) (when (>= pos go-mode-mark-cs-end)
(go-mode-mark-cs pos)) (go-mode-mark-cs (1+ pos)))
(get-text-property pos 'go-mode-cs)) (get-text-property pos 'go-mode-cs))
(defun go-mode-mark-cs (end) (defun go-mode-mark-cs (end)
...@@ -597,7 +597,7 @@ indented one level." ...@@ -597,7 +597,7 @@ indented one level."
(cond (cond
((and cs (save-excursion ((and cs (save-excursion
(goto-char (car cs)) (goto-char (car cs))
(looking-at "\\s\""))) (looking-at "`")))
;; Inside a multi-line string. Don't mess with indentation. ;; Inside a multi-line string. Don't mess with indentation.
nil) nil)
(cs (cs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment