[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 9dbdf22 041/495: Do not skip over strings when che
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 9dbdf22 041/495: Do not skip over strings when checking for dangling operator |
Date: |
Sat, 7 Aug 2021 09:04:40 -0400 (EDT) |
branch: elpa/go-mode
commit 9dbdf22bd973aa1ce91668419f5ba2a6d80e0eb8
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
Do not skip over strings when checking for dangling operator
Closes gh-14
---
go-mode.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 6cacedf..b565edb 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -122,13 +122,12 @@ built-ins, functions, and some types.")
(defun go-goto-beginning-of-string-or-comment ()
(goto-char (nth 8 (syntax-ppss))))
-(defun go--backward-irrelevant ()
+(defun go--backward-irrelevant (&optional stop-at-string)
(let (pos (start-pos (point)))
(skip-chars-backward "\n[:blank:]")
- (if (save-excursion (beginning-of-line) (go-in-string-p))
- (if (looking-back "`")
- (backward-char)))
- (if (go-in-string-p)
+ (if (and (save-excursion (beginning-of-line) (go-in-string-p))
(looking-back "`") (not stop-at-string))
+ (backward-char))
+ (if (and (go-in-string-p) (not stop-at-string))
(go-goto-beginning-of-string-or-comment))
(if (looking-back "\\*/")
(backward-char))
@@ -141,13 +140,13 @@ built-ins, functions, and some types.")
(end-of-line))
(goto-char pos))
(if (/= start-pos (point))
- (go--backward-irrelevant))
+ (go--backward-irrelevant stop-at-string))
(/= start-pos (point))))
(defun go-previous-line-has-dangling-op-p ()
(save-excursion
(beginning-of-line)
- (go--backward-irrelevant)
+ (go--backward-irrelevant t)
(looking-back go-dangling-operators-regexp)))
(defun go-indentation-at-point (point)
@@ -170,13 +169,14 @@ built-ins, functions, and some types.")
(- (current-indentation) tab-width)
(current-indentation)))
(progn
- (go--backward-irrelevant)
+ (go--backward-irrelevant t)
(if (looking-back go-dangling-operators-regexp)
;; only one nesting for all dangling operators in one
operation
(if (go-previous-line-has-dangling-op-p)
(current-indentation)
(+ (current-indentation) tab-width))
(progn
+ (go--backward-irrelevant)
(if (go-previous-line-has-dangling-op-p)
(setq outindent tab-width))
(setq line-begin (line-beginning-position))
- [nongnu] elpa/go-mode e78baea 054/495: do not leave point at beginning of line when (not) indenting a comment, (continued)
- [nongnu] elpa/go-mode e78baea 054/495: do not leave point at beginning of line when (not) indenting a comment, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a5164ac 055/495: Fix indentation for code after multi-line function signature, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 72cf126 056/495: fix indentation for multi-line if expressions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cfc3d50 058/495: add more test cases, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 63929d2 085/495: get rid of go--flatten, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 850986e 022/495: Do not loop forever in go-beginning-of-defun if point is in comment and there's no function definition before point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b91c53e 025/495: save buffer before trying to remove unused imports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4371669 029/495: Merge branch 'feature/remove_unused_imports', ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cd13093 034/495: use inhibit-read-only instead of toggle-read-only, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b6dfdd4 037/495: Closes gh-5, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9dbdf22 041/495: Do not skip over strings when checking for dangling operator,
ELPA Syncer <=
- [nongnu] elpa/go-mode 95c9519 049/495: when searching for anchor for indentation, do not limit search to one line, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 399393a 057/495: remove dead code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ee10287 059/495: Revert "Fix indentation for code after multi-line function signature", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 79d5860 073/495: improve fontification, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 49b9355 074/495: do not change indentation if in multiline string, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 522543f 077/495: replace several defuns with macros, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4aeb058 078/495: add cache to go-previous-line-has-dangling-op-p, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 438f671 082/495: update documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c2366b2 084/495: formatting, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fb9ab02 087/495: buffer-file-truename is an *abbreviated* truename, so use file-truename instead., ELPA Syncer, 2021/08/07