[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode b6dfdd4 037/495: Closes gh-5
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode b6dfdd4 037/495: Closes gh-5 |
Date: |
Sat, 7 Aug 2021 09:04:39 -0400 (EDT) |
branch: elpa/go-mode
commit b6dfdd4c5ed2e3981982e905be0ff72f8fa0d691
Merge: 4371669 4c5493b
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
Closes gh-5
---
go-mode.el | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 1657111..8e3aab3 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -10,6 +10,10 @@
;; - Fontify unicode in method receiver types, array/slice/map types
;; and everywhere where type-name is being used
+(eval-when-compile
+ (require 'diff-mode)
+ (require 'cl))
+
(defconst go-dangling-operators-regexp "[^-]-\\|[^+]\\+\\|[/*&><.=|^]")
(defconst gofmt-stdin-tag "<standard input>")
(defconst go-identifier-regexp "[[:word:][:multibyte:]_]+")
@@ -132,7 +136,7 @@ built-ins, functions, and some types.")
(setq pos (point))
(beginning-of-line)
(if (or (looking-at "^[[:word:]]+:$") (looking-at "^[[:space:]]*\\(case
.+\\|default\\):"))
- (progn (previous-line)
+ (progn (forward-line -1)
(end-of-line))
(goto-char pos))
(if (/= start-pos (point))
@@ -302,8 +306,8 @@ Replace the current buffer on success; display errors on
failure."
(coding-system-for-read 'utf-8) ;; use utf-8 with subprocesses
(coding-system-for-write 'utf-8))
(with-current-buffer errbuf
- (toggle-read-only 0)
- (erase-buffer))
+ (let ((inhibit-read-only t))
+ (erase-buffer)))
(with-current-buffer srcbuf
(save-restriction
(let (deactivate-mark)
@@ -527,12 +531,14 @@ link in the kill ring."
(message "%s" (point))
(put-text-property (1- (point)) (point) 'syntax-table
(string-to-syntax "."))))))))))
-(defun go--common-prefix (sequences)
- (assert sequences)
- (flet ((common-prefix (s1 s2)
- (let ((diff-pos (mismatch s1 s2)))
- (if diff-pos (subseq s1 0 diff-pos) s1))))
- (reduce #'common-prefix sequences)))
+;; ;; Commented until we actually make use of this function
+;; (defun go--common-prefix (sequences)
+;; ;; mismatch and reduce are cl
+;; (assert sequences)
+;; (flet ((common-prefix (s1 s2)
+;; (let ((diff-pos (mismatch s1 s2)))
+;; (if diff-pos (subseq s1 0 diff-pos) s1))))
+;; (reduce #'common-prefix sequences)))
(defun go-import-add (arg import)
"Add a new import to the list of imports.
@@ -560,7 +566,7 @@ uncommented, otherwise a new import will be added."
(setq line (format "%s \"%s\"" as import))
(setq line (format "\"%s\"" import)))
- (beginning-of-buffer)
+ (goto-char (point-min))
(if (re-search-forward (concat "^// import " line "$") nil t)
(uncomment-region (line-beginning-position) (line-end-position))
(case (go-goto-imports)
@@ -659,7 +665,8 @@ will be commented, otherwise they will be removed
completely."
(message "Cannot operate on unsaved buffer")
(setq lines (go-unused-imports-lines))
(dolist (import lines)
- (goto-line import)
+ (goto-char (point-min))
+ (forward-line (1- import))
(beginning-of-line)
(if arg
(comment-region (line-beginning-position) (line-end-position))
- [nongnu] elpa/go-mode 903768b 053/495: tweak godoc to behave more like help in emacs, (continued)
- [nongnu] elpa/go-mode 903768b 053/495: tweak godoc to behave more like help in emacs, ELPA Syncer, 2021/08/07
- [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 <=
- [nongnu] elpa/go-mode 9dbdf22 041/495: Do not skip over strings when checking for dangling operator, ELPA Syncer, 2021/08/07
- [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