gmlarumbe / verilog-ext

Verilog Extensions for Emacs
GNU General Public License v3.0
52 stars 8 forks source link

Error in templates when instantiating module from file #12

Open gmlarumbe opened 9 months ago

gmlarumbe commented 9 months ago

The following error shows up if running verilog-ext-template-inst-auto-from-file with verilog-ts-mode:

This is caused by the behaviour of verilog-auto, used by the AUTO_TEMPLATE construct for the instance template:

        ;; Snippet from `verilog-auto`:
        ;; ...
        ;; If we're not in verilog-mode, change syntax table so parsing works right
        (unless (eq major-mode 'verilog-mode) (verilog-mode))

verilog-auto will switch from verilog-ts-mode to verilog-mode which should not be the intended behaviour for template instantiation.

gmlarumbe commented 9 months ago

Current error can be worked around by switching to verilog-mode before running verilog-auto and then switching back to verilog-ts-mode:

    (if (eq major-mode 'verilog-ts-mode)
        (progn
          (verilog-mode)
          (verilog-auto)
          (verilog-ts-mode))
      (verilog-auto))
gmlarumbe commented 2 weeks ago

Implemented in verilog-ts-auto via C-c C-a.

The error still shows up from time to time. Re-running verilog-ts-auto works it around.