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
253 stars 90 forks source link

verilog-goto-defun can't not list tasks and functions #1492

Closed veripoolbot closed 5 years ago

veripoolbot commented 5 years ago

Author Name: Enze Chi Original Redmine Issue: 1492 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


When run the verilog-goto-defun command in verilog file buffer, the functions and tasks are not listed as candidates.

As in the verilog-build-defun-re function, the original regexp only match with function/task start with no leading spaces and not taking "automatic|static" keywords and return type before function name into account.


(defun verilog-build-defun-re (str &optional arg)
  "Return function/task/module starting with STR as regular expression.
With optional second ARG non-nil, STR is the complete name of the instruction."
  (if arg
       (concat "^\\(function\\|task\\|module\\)[ \t]+\\(" str "\\)\\>")
     (concat "^\\(function\\|task\\|module\\)[ \t]+\\(" str "[a-zA-Z0-9_ ]*\\)\\>")))

I did a little bit local hack as below, the function and task names are presented as candidates now:


(defun verilog-build-defun-re (str &optional arg)
  "Return function/task/module starting with STR as regular expression.
With optional second ARG non-nil, STR is the complete name of the instruction."
  (if arg
       (concat "^[ \t]*\\(function\\|task\\|module\\)[ \t]+\\(automatic\\|static\\)*\\(" str "\\)\\>")
     (concat "^[ \t]*\\(function\\|task\\|module\\)[ \t]+\\(automatic\\|static\\)*\\(" str "[a-zA-Z0-9_ ]*\\)\\>")))

Also tweak required for verilog-comp-defun as more matched items may be found.

As the swiper package does great job for searching, it maybe good to delicate this functionality to it. The "class|package|interface", etc can all be found easily.

veripoolbot commented 5 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2019-08-27T17:41:49Z


Thanks for the report. Fixed this in git and verilog-mode-2019-08-27-be9b5af-vpo.

Note "swiper" can't be used by default as it's not distributed with Emacs itself (as Verilog-mode is).