go-mode.el icon indicating copy to clipboard operation
go-mode.el copied to clipboard

beginning-of-defun, end-of-defun don't handle types

Open fjl opened this issue 7 years ago • 3 comments

In other modes, e.g. c-mode, beginning-of-defun jumps to the beginning of any definition. For go-mode it works with functions and methods but not for types, variables and constants. Should it work for those?

fjl avatar Feb 07 '18 15:02 fjl

Should it work for those?

It was designed and implemented to work the way it does; that is, it's not a bug.

That doesn't mean we're doing the right thing. I have a somewhat large redesign of go-mode planned, with better parsing of Go code (probably backed by a Go process using go/parser), which would make it trivial to navigate between any kind of syntax – right now we're limited by what's easy and reliable to match via regexps. When that time comes, I'll happily evaluate the major modes of popular programming languages to see if our behaviour or that of c-mode is more common.

dominikh avatar Feb 09 '18 05:02 dominikh

Workaround: https://github.com/raxod502/radian/blob/7bc3674919631689959e47a65e463ee7fbe03c59/emacs/radian.el#L2813-L2863

raxod502 avatar Jul 16 '19 19:07 raxod502

We will revisit this in the context of the upcoming tree-sitter-based major mode.

dominikh avatar Dec 28 '22 17:12 dominikh