veripool / verilog-mode

Verilog-Mode for Emacs with Indentation, Hightlighting and AUTOs. Master repository for pushing to GNU, verilog.com and veripool.org.
http://veripool.org/verilog-mode
GNU General Public License v3.0
247 stars 90 forks source link

'verilog-mark-defun' does not mark functions #1777

Closed gmlarumbe closed 1 year ago

gmlarumbe commented 2 years ago

Hi,

According to the docstring of verilog-mode and verilog-mark-defun this function should mark functions. However, since function/task regexps do not belong to verilog-defun-re and verilog-end-defun-re, verilog-mark-defun marks whole modules, classes, interfaces, packages...

I believe that simply adding function/task regexps to verilog-defun-re would not easily work as this variable is used for indentation, completion, autos...

I have made some changes in 8d2aa7c that mark functions/tasks and do not break any test. However still looks a bit confusing to have to separate between verilog-end-of-defun and (verilog-re-search-forward verilog-end-defun-re) in different parts of the code to keep compatibility.

What would be the best approach here? Is this a feature that should be merged into master?

Thanks!

wsnyder commented 2 years ago

I don't use this feature myself, but I think the behavior would make sense to jump to the function, then if done again jump to the container of the function (module/package etc) which should happen automatically as that's the next most upper thing.

As an alternative you could just try both regexps (functions and non) and see which point is found earlier and jump to that.

wsnyder commented 2 years ago

Also can you please convert this to a pull request? Thanks