diff options
author | Peter Kleiweg <pkleiweg@xs4all.nl> | 2012-06-13 16:24:27 -0400 |
---|---|---|
committer | Sameer Ajmani <sameer@golang.org> | 2012-06-13 16:24:27 -0400 |
commit | c8ba37cf377497e73d3d924b06505db63b906fe7 (patch) | |
tree | 47eede8856e1315e5adf470bd11c510db61ffa4d | |
parent | d0176e77e7117ec1a6eb063d008d765d32381525 (diff) | |
download | go-c8ba37cf377497e73d3d924b06505db63b906fe7.tar.gz go-c8ba37cf377497e73d3d924b06505db63b906fe7.zip |
[release-branch.go1] Emacs go-mode: don't indent the inside of strings.
««« backport 8888febbe757
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
»»»
-rw-r--r-- | misc/emacs/go-mode.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index 783d1a8bb5..f6ae568229 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -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 |