[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 745c437 092/495: style fixes
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 745c437 092/495: style fixes |
Date: |
Sat, 7 Aug 2021 09:04:50 -0400 (EDT) |
branch: elpa/go-mode
commit 745c437c967c56ede45ade12bd6fddedc381caa1
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
style fixes
---
go-mode.el | 82 ++++++++++++++++++++++++++++++--------------------------------
1 file changed, 39 insertions(+), 43 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index f51a3ad..1829164 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -15,7 +15,20 @@
(defconst go-type-regexp "[[:word:][:multibyte:]_*]+")
(defconst go-func-regexp (concat "\\<func\\>\\s *\\(" go-identifier-regexp
"\\)"))
(defconst go-func-meth-regexp (concat "\\<func\\>\\s *\\(?:(\\s *"
go-identifier-regexp "\\s +" go-type-regexp "\\s *)\\s *\\)?\\("
go-identifier-regexp "\\)("))
-(defconst go-builtins '("append" "cap" "close" "complex" "copy" "delete"
"imag" "len" "make" "new" "panic" "print" "println" "real" "recover"))
+(defconst go-builtins
+ '("append" "cap" "close" "complex" "copy"
+ "delete" "imag" "len" "make" "new"
+ "panic" "print" "println" "real" "recover")
+ "All built-in functions in the Go language. Used for font locking.")
+
+(defconst go-mode-keywords
+ '("break" "default" "func" "interface" "select"
+ "case" "defer" "go" "map" "struct"
+ "chan" "else" "goto" "package" "switch"
+ "const" "fallthrough" "if" "range" "type"
+ "continue" "for" "import" "return" "var")
+ "All keywords in the Go language. Used for font locking.")
+
(defconst go-constants '("nil" "true" "false" "iota"))
(defconst go-type-name-regexp (concat "\\(?:[*(]\\)*\\(?:"
go-identifier-regexp "\\.\\)?\\(" go-identifier-regexp "\\)"))
@@ -54,23 +67,12 @@
st)
"Syntax table for Go mode.")
-(defvar go-mode-keywords
- '("break" "default" "func" "interface" "select"
- "case" "defer" "go" "map" "struct"
- "chan" "else" "goto" "package" "switch"
- "const" "fallthrough" "if" "range" "type"
- "continue" "for" "import" "return" "var")
- "All keywords in the Go language. Used for font locking and
-some syntax analysis.")
-
-
(defun go--build-font-lock-keywords ()
(append
`((,(regexp-opt go-mode-keywords 'symbols) . font-lock-keyword-face)
(,(regexp-opt go-builtins 'symbols) . font-lock-builtin-face)
(,(regexp-opt go-constants 'symbols) . font-lock-constant-face)
- (,go-func-regexp 1 font-lock-function-name-face) ;; function (not method)
name
- )
+ (,go-func-regexp 1 font-lock-function-name-face)) ;; function (not
method) name
(if go-fontify-function-calls
`((,(concat "\\(" go-identifier-regexp "\\)[[:space:]]*(") 1
font-lock-function-name-face) ;; function call/method name
@@ -260,12 +262,12 @@ some syntax analysis.")
This mode provides (not just) basic editing capabilities for
working with Go code. It offers almost complete syntax
-highlighting, indentation that is almost identical to gofmt,
+highlighting, indentation that is almost identical to gofmt and
proper parsing of the buffer content to allow features such as
navigation by function, manipulation of comments or detection of
strings.
-Additionally to these core features, it offers various features to
+In addition to these core features, it offers various features to
help with writing Go code. You can directly run buffer content
through gofmt, read godoc documentation from within Emacs, modify
and clean up the list of package imports or interact with the
@@ -288,7 +290,7 @@ add the following hook to your emacs configuration:
If you're looking for even more integration with Go, namely
on-the-fly syntax checking, auto-completion and snippets, it is
-recommended to look at goflymake
+recommended that you look at goflymake
\(https://github.com/dougm/goflymake), gocode
\(https://github.com/nsf/gocode) and yasnippet-go
\(https://github.com/dominikh/yasnippet-go)"
@@ -520,15 +522,12 @@ declaration."
(cond
((re-search-forward "^import ([^)]+)" nil t)
(backward-char 2)
- 'block
- )
+ 'block)
((re-search-forward "\\(^import \\([^\"]+ \\)?\"[^\"]+\"\n?\\)+" nil t)
- 'single
- )
+ 'single)
((re-search-forward "^[[:space:]\n]*package .+?\n" nil t)
(message "No imports found, moving point after package declaration")
- 'none
- )
+ 'none)
(t
(goto-char old-point)
(message "No imports or package declaration found. Is this really a Go
file?")
@@ -645,32 +644,29 @@ uncommented, otherwise a new import will be added."
(mapcar (lambda (file)
(let ((sub (substring file (length pkgdir) -2)))
(unless (or (string-prefix-p "obj/" sub)
(string-prefix-p "tool/" sub))
- (mapconcat 'identity (cdr (split-string sub
"/")) "/")
- )
- ))
+ (mapconcat 'identity (cdr (split-string sub
"/")) "/"))))
(if (file-directory-p dir)
(directory-files dir t "\\.a$"))))
(find-lisp-find-files-internal pkgdir
'find-lisp-file-predicate-is-directory
'find-lisp-default-directory-predicate))))
- (go-root-and-paths))) 'string<))
+ (go-root-and-paths)))
+ 'string<))
(defun go-unused-imports-lines ()
- (let (cmd)
- (if (string-match "_test\.go$" buffer-file-truename)
- (setq cmd "go test -c")
-
- ;; FIXME Technically, -o /dev/null fails in quite some cases (on
- ;; Windows, when compiling from within GOPATH). Practically,
- ;; however, it has the same end result: There won't be a
- ;; compiled binary/archive, and we'll get our import errors when
- ;; there are any.
- (setq cmd "go build -o /dev/null"))
- (reverse (remove nil
- (mapcar
- (lambda (line)
- (if (string-match "^\\(.+\\):\\([[:digit:]]+\\):
imported and not used: \".+\"$" line)
- (if (string= (file-truename (match-string 1 line))
(file-truename buffer-file-name))
- (string-to-number (match-string 2 line)))))
- (split-string (shell-command-to-string cmd) "\n"))))))
+ ;; FIXME Technically, -o /dev/null fails in quite some cases (on
+ ;; Windows, when compiling from within GOPATH). Practically,
+ ;; however, it has the same end result: There won't be a
+ ;; compiled binary/archive, and we'll get our import errors when
+ ;; there are any.
+ (reverse (remove nil
+ (mapcar
+ (lambda (line)
+ (if (string-match "^\\(.+\\):\\([[:digit:]]+\\):
imported and not used: \".+\"$" line)
+ (if (string= (file-truename (match-string 1 line))
(file-truename buffer-file-name))
+ (string-to-number (match-string 2 line)))))
+ (split-string (shell-command-to-string
+ (if (string-match "_test\.go$"
buffer-file-truename)
+ "go test -c"
+ "go build -o /dev/null")) "\n")))))
(defun go-remove-unused-imports (arg)
"Removes all unused imports. If ARG is non-nil, unused imports
- [nongnu] elpa/go-mode 95c9519 049/495: when searching for anchor for indentation, do not limit search to one line, (continued)
- [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
- [nongnu] elpa/go-mode 745c437 092/495: style fixes,
ELPA Syncer <=
- [nongnu] elpa/go-mode c833b77 094/495: Fix cache invalidation for dangling operator cache, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 87c8b6e 096/495: do not use dangling op cache when buffer is narrowed, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8e19ae5 097/495: add some documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b5960fe 099/495: nicer messages in gofmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 939d630 100/495: style fixes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 47b3928 102/495: disable read-only on error buffer before trying to write to it, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c94ca2e 064/495: refactor, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6b77ff1 065/495: allow disabling fontification for function/method calls, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 02d44df 067/495: add function for downloading playgrounds into emacs, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ec6fef4 066/495: Define a customization group for go-mode, ELPA Syncer, 2021/08/07