go-mode on Emacs 23 wrongly recognizes a backquote in a comment or
a string as a start of a raw string literal. Below is an example
that go-mode does not work well. This patch is to fix that issue.
// `
var x = 1
// `
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/84900043
Name of built-in function is not reserved word in Go, and you can
use it as variable name. "new" is often used as local variable, for
instance.
This patch is to apply font-lock-builtin-face only when built-in
function name is followed by '(', so that it doesn't highlight
non-function variable that happen to have the same name as built-in
function.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/79260043
Go-mode in Emacs 23 does not recognize a backslash followed
by a backquote as end of raw string literal, as it does not
support syntax-propertize-function which Go-mode uses to
remove special meaning from backslashes in ``.
This patch provides a fallback mechanism to do the same thing
using font-lock-syntactic-keywords, which is supported by
Emacs 23.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef
CC=adonovan, golang-codereviews
https://golang.org/cl/78730048
c-mode classically uses ff-find-other-file to toggle between headers
and implementation. For Go it seemingly makes sense to jump between
implementation and test.
While there's no enforced mapping of file names for tests, the mapping
in this CL seems to be very common at least throughout the standard
library, and ff-find-other-file fails gracefully when the mapping
doesn't apply.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/65750044
Require at least one space after "type" and do not fontify closing
parenthesis of type switch as a type.
R=adonovan
CC=golang-codereviews
https://golang.org/cl/37720050
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
This is identical to CL 19010044 with one exception: Making sure
it doesn't break on Emacs 22.1
R=adonovan, bradfitz, shendaras
CC=golang-dev
https://golang.org/cl/20100043
bradfitz reports:
> It breaks go-mode on GNU Emacs 22.1.1 as ships with OS X 10.8.6.
««« original CL description
misc/emacs: various cleanups
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
R=adonovan
CC=golang-dev
https://golang.org/cl/19010044
»»»
R=bradfitz
CC=golang-dev
https://golang.org/cl/19640043
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
R=adonovan
CC=golang-dev
https://golang.org/cl/19010044
The newest version of godef supports jumping to a package's source
directory if point is on an import statement.
R=adonovan
CC=golang-dev
https://golang.org/cl/18230043
The Go compiler emits extra information for this case:
imported and not used: "sandbox/foo_bar" as bar
R=adonovan
CC=golang-dev
https://golang.org/cl/14111043
Some users have multiple Go development trees and invoke the
'go' tool via a wrapper that sets GOROOT and GOPATH based on
the current directory. Such users should customize go-command
to point to the wrapper script.
R=dominik.honnef
CC=golang-dev
https://golang.org/cl/13233043
When the coverage report file is older than the file we're
showing the coverage report for, then we show a simple message
to state this fact.
R=adonovan, dominik.honnef, bradfitz
CC=golang-dev
https://golang.org/cl/12919044
When identifying structs or interfaces we really want to know
their makeup, not just their name.
R=adonovan
CC=golang-dev
https://golang.org/cl/13042043
Jumps to the same file will use the original buffer, not the
coverage buffer. Making it work for the coverage buffer isn't
worth the trouble, especially because it would break as soon as
you jump to a different file and back.
Use error instead of message so it actually terminates
R=adonovan
CC=golang-dev
https://golang.org/cl/13041043
Use the same algorithm that go tool cover uses when producing HTML
output to render coverage intensity.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12712043
Renders code coverage as an overlay, replicating the look of the
HTML that go tool cover produces.
Also some cleanups.
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/12684043
This will behave like similar "*-other-window" functions in Emacs.
Default key bind is C-x 4 C-c C-j – while awkward, it follows both
the convention for other-window functions and the convention for
not using user- or emacs-reserved keys.
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/10707045
Operations like gofmt and go-remove-unused-imports delete entire
lines of text. Previously this put them on the kill-ring,
negatively affecting user experience.
R=adonovan
CC=gobot, golang-dev
https://golang.org/cl/9605043
This fixes fontification, navigation and indentation for methods
of the form `func (Foo) Bar...`
R=adonovan
CC=gobot, golang-dev
https://golang.org/cl/8951043
Some packages, like popwin.el, change display behaviour based on
the buffer's mode, so we should enable compilation-mode before
displaying the buffer.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8155043
godef[1][2] is a third party tool for printing information about
expressions, especially the location of their definition. This can be
used to implement a "jump to definition" function. Unlike
cross-language solutions like ctags, godef does not require an index,
operates on the Go AST instead of symbols and works across packages,
including the standard library.
This patch implements two new public functions: godef-describe (C-c
C-d) and godef-jump (C-d C-j). godef-describe describes the expression
at point, printing its type, and godef-jump jumps to its definition.
[1]: https://code.google.com/p/rog-go/source/browse/exp/cmd/godef/
[2]: go get code.google.com/p/rog-go/exp/cmd/godef
R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7781043
Correctly indent the body of functions that have been declared
over multiple lines. See http://play.golang.org/p/MHMwNDbFyf for
an example.
Previously, the body of the function would be indented as deep as
the continuation line of the function declaration. Now it gets
indented as deep as the func keyword.
R=adonovan, cw, patrick.allen.higgins
CC=golang-dev
https://golang.org/cl/7628043
Instead of relying on gofmt's diff output (which is a unified
diff), we manually invoke diff -n and produce an RCS format diff,
which can easily be parsed in Emacs, with the go--apply-rcs-patch
function.
This fixes undocumented issues with the old implementation such as
skipping over hunks of changes, and it fixes the documented issue
of not being able to handle file names that include whitespace.
It can also apply the patch on a buffer that has no file name
attached at all.
Last but not least, it greatly simplifies the gofmt function
itself.
Fixes#4766.
Fixes#4475.
R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7516046
This CL adds compatibility for GNU Emacs 23 (fixing fontification
issues) and XEmacs >=21.5.32 (fixing a lot of issues). Earlier
versions of XEmacs will not be supported because they do not
support POSIX character classes. Because of that, we also make use
of a lot of functions that were added in 21.5.32.
A known and currently unfixable issue with XEmacs is that go-mode
will not always fontify identifiers that use unicode correctly.
All changes for XEmacs are annotated in the diff.
Note: go--position-bytes is not currently used anywhere, but will
be in a future CL.
Fixes#4927.
R=golang-dev, adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7456051
Mimic the Emacs convention of presenting read-only files meant
for browsing using view-mode, rather than Fundamental mode
which mistakenly allows editing of the "godoc" content.
Fixes#4322.
R=golang-dev, bradfitz, sameer
CC=golang-dev
https://golang.org/cl/7231055
The previous code assumed the gofmt output referred to /tmp but
that's not true if TMPDIR points somewhere else (like on Macs).
Fixes#3782.
R=sameer
CC=golang-dev
https://golang.org/cl/6346050
Use code to be used in lisp programs as suggested in the doc strings for
replace-{string|regexp}. Bonus: This code works for XEmacs.
R=golang-dev, sameer, jmeurin
CC=golang-dev
https://golang.org/cl/6296073