emacs-elpa-diffs
[Top][All Lists]
Advanced

[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))



reply via email to

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