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

Indentation of close struct #1716

Closed punzik closed 3 years ago

punzik commented 3 years ago

Wrong indentation when multiple instances of struct are declared.

Right indentation:

enum int unsigned {
    STATE_0 = 0,
    STATE_1,
    STATE_2
} state;

Wrong indentation:

enum int unsigned {
    STATE_0 = 0,
    STATE_1,
    STATE_2
    } state, next;

Posible fix:

--- a/verilog-mode.el
+++ b/verilog-mode.el
@@ -6510,10 +6510,10 @@
 (defun verilog-at-close-struct-p ()
   "If at the } that closes a struct, return true."
   (if (and
        (equal (char-after) ?\})
        (verilog-in-struct-p))
       ;; true
       (save-excursion
-   (if (looking-at "}\\(?:\\s-*\\w+\\s-*\\)?;") 1))
+   (if (looking-at "}\\(?:\\s-*\\w+\\s-*\\(\\s-*\\,\\s-*\\w+\\)*\\)?;") 1))
     ;; false
     nil))
wsnyder commented 3 years ago

Enjoy bugs that come with good fixes, thanks. Pushed to git.