[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode d511e35 402/495: Replace obsolete one-argument fo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode d511e35 402/495: Replace obsolete one-argument form of ‘looking-back’. |
Date: |
Sat, 7 Aug 2021 09:05:56 -0400 (EDT) |
branch: elpa/go-mode
commit d511e352c81ccdc08271024104d567b3bd15bf67
Author: Philipp Stephani <phst@google.com>
Commit: Dominik Honnef <dominik@honnef.co>
Replace obsolete one-argument form of ‘looking-back’.
Replace it with the two-argument form most of the time, except when looking
at
exactly one character.
---
go-mode.el | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 3786240..bbd9267 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -69,6 +69,12 @@ function."
(defconst go-dangling-operators-regexp "[^-]-\\|[^+]\\+\\|[/*&><.=|^]")
+(defconst go--max-dangling-operator-length 2
+ "The maximum length of dangling operators.
+This must be at least the length of the longest string matched by
+‘go-dangling-operators-regexp.’, and must be updated whenever
+that constant is changed.")
+
(defconst go-identifier-regexp "[[:word:][:multibyte:]]+")
(defconst go-type-name-no-prefix-regexp
"\\(?:[[:word:][:multibyte:]]+\\.\\)?[[:word:][:multibyte:]]+")
(defconst go-qualified-identifier-regexp (concat go-identifier-regexp "\\."
go-identifier-regexp))
@@ -495,13 +501,13 @@ STOP-AT-STRING is not true, over strings."
(let (pos (start-pos (point)))
(skip-chars-backward "\n\s\t")
(if (and (save-excursion (beginning-of-line) (go-in-string-p))
- (looking-back "`")
+ (= (char-before) ?`)
(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 "\\*/")
+ (if (looking-back "\\*/" (line-beginning-position))
(backward-char))
(if (go-in-comment-p)
(go-goto-beginning-of-string-or-comment))
@@ -529,7 +535,8 @@ STOP-AT-STRING is not true, over strings."
(save-excursion
(beginning-of-line)
(go--backward-irrelevant t)
- (setq val (looking-back go-dangling-operators-regexp))
+ (setq val (looking-back go-dangling-operators-regexp
+ (- (point)
go--max-dangling-operator-length)))
(if (not (go--buffer-narrowed-p))
(puthash cur-line val go-dangling-cache))))
val))
@@ -584,7 +591,9 @@ current line will be returned."
(if (go-previous-line-has-dangling-op-p)
(- (current-indentation) tab-width)
(go--indentation-for-opening-parenthesis)))
- ((progn (go--backward-irrelevant t) (looking-back
go-dangling-operators-regexp))
+ ((progn (go--backward-irrelevant t)
+ (looking-back go-dangling-operators-regexp
+ (- (point) go--max-dangling-operator-length)))
;; only one nesting for all dangling operators in one operation
(if (go-previous-line-has-dangling-op-p)
(current-indentation)
@@ -659,7 +668,8 @@ current line will be returned."
(skip-chars-forward "^{")
(forward-char)
(or (go-in-string-or-comment-p)
- (looking-back "\\(struct\\|interface\\)\\s-*{"))))
+ (looking-back "\\(struct\\|interface\\)\\s-*{"
+ (line-beginning-position)))))
(setq orig-level (go-paren-level))
(while (>= (go-paren-level) orig-level)
(skip-chars-forward "^}")
@@ -1714,7 +1724,8 @@ If ARG is non-nil, anonymous functions are ignored."
(skip-chars-forward "^{")
(forward-char)
(or (go-in-string-or-comment-p)
- (looking-back "\\(struct\\|interface\\)\\s-*{"))))
+ (looking-back "\\(struct\\|interface\\)\\s-*{"
+ (line-beginning-position)))))
(backward-char))
(defun go--in-function-p (compare-point)
- [nongnu] elpa/go-mode 4d1ab9f 347/495: cmd/oracle: improve error messages, (continued)
- [nongnu] elpa/go-mode 4d1ab9f 347/495: cmd/oracle: improve error messages, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9c2bf9b 360/495: cmd/guru: emacs: push mark in go-guru-definition, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5ef1d53 355/495: cmd/guru: use byte (not rune) count in -modified archive, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 60ed26e 368/495: cmd/guru: emacs: only check modified buffers with file names, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d209550 353/495: cmd/guru: emacs: minor changes to keybindings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6ac5669 372/495: cmd/guru: emacs: interpret byte offsets correctly, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode afb2a24 382/495: go.tools: use golang.org/x/... import paths, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3a82342 379/495: Regenerate AUTHORS, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8991b83 384/495: refactor/rename: emacs: kill go-rename buffer correctly, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode adea2e5 395/495: Make go-guru-build-tags a list of strings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d511e35 402/495: Replace obsolete one-argument form of ‘looking-back’.,
ELPA Syncer <=
- [nongnu] elpa/go-mode 35f6826 404/495: Bump version to 1.5.0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode da55ef1 413/495: Evaluate error conditions before prompting for new name, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 59dfa96 423/495: Add confirmation prompt for Playground uploads, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 13e9f22 428/495: Fix go-rename when buffer is not visiting any file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9ab06b3 443/495: indent: fix nested dangling lines that don't use parens, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6d58e9d 442/495: indent: fix case statement in func in composite literal, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 592bd4b 440/495: indent: fix various cases with dangling operators, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 35a5ddc 445/495: indent: fix decl statements with dangling "=", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f9174b2 458/495: Improve go-dot-mod-mode font lock regexp, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 91b37c4 461/495: Disable output during indentation tests, ELPA Syncer, 2021/08/07