New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart indenting multi-line `define #1082
Comments
Original Redmine Comment Thanks, this is a good suggestion. Just so you know, the indentation code is pretty fragile and this would add more complication and perhaps performance issues, so it's unlikely to be fixed soon unless you take it on yourself. |
Original Redmine Comment Is not trying to indent the lines ending in @\$@ at all a viable 'solution'? |
Original Redmine Comment
A reasonable thing to be tried. |
Original Redmine Comment Wilson Snyder wrote:
I tend to agree. I like the idea of semantically-aware indentation inside macros, but it's really not feasible. There's no guarantee that the `define is a complete (System)Verilog statement, therefore we cannot accurately indent the "Right Way" each and every time. Maybe abandoning all attempt at indentation is the best approach. As a trivial example, consider a multi-line macro that contains quoted text (maybe it's part of a debug/error message). The user most definitely doesn't want their pretty message formatting perturbed by verilog-mode. |
Original Redmine Comment Below tests fine in my personal config .. If that looks fine, I can start working on a patch for @verilog-indent-line-relative@ and @verilog-indent-line@.
|
Hi @kaushalmodi , @wsnyder I have written some code that supports ignoring indentation of multiline macros and custom regexps conditionally through defcustoms (5b9bc2a). It works on GNU Emacs 28.1. This would enable ignoring indentation for outshine comments (#885), custom "keep indent" markers (#922), or any other custom regexp. Since this does not rely on Thanks! |
Can you please convert to a pull request? With that not sure we need ignore-regexp. Also should we say verilog-indent-ignore-multiline-defines instead of -macros? I don't think we should be changing indentation of any comments that are outside `defines, not sure if you are. |
The In #885 @kaushalmodi explains why it would be nice to be able to ignore indentation on some specific lines. I also use outshine along with modi's advice function and it works really well for buffer navigation. However, since his solution seems very user-specific the use of a variable with a custom regexp would be much more generic. If this variable is set to |
Implemented in #1778 |
Author Name: Kaushal Modi
Original Redmine Issue: 1082 from https://www.veripool.org
Original Date: 2016-08-16
For auto-indentation does not handle `define macros that extend multiple-lines.
Example (manually indented code before calling @indent-region@):
Here is what calling @indent-region@ over that code does!:
It would be nice if multi-line defines were handled well.
My work-around is to remove the trailing @@ characters, indent the code and then add them back. But I need to remember to not indent the whole buffer for files containing such `defines.
The text was updated successfully, but these errors were encountered: