dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.39k stars 211 forks source link

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

Open fjl opened 6 years ago

fjl commented 6 years ago

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?

dominikh commented 6 years ago

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.

raxod502 commented 5 years ago

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

dominikh commented 1 year ago

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