veripool / verilog-perl

Verilog parser, preprocessor, and related tools for the Verilog-Perl package
https://www.veripool.org/verilog-perl
Artistic License 2.0
121 stars 34 forks source link

Question: indent on/off by comment #900

Closed veripoolbot closed 9 years ago

veripoolbot commented 9 years ago

Author Name: Yoram Stern Original Redmine Message: 1622 from https://www.veripool.org


Hi. I want to run verilog-batch-indent only on a portion of my verilog file, that is to mark by comments the code portion to indent. For example, if there was /AUTOINDENTOFF/ and /AUTOINDENTON/ - it would be glad:

$cat my_file.v

// stuff that I dont want to indent starts here /AUTOINDENTOFF/

// stuff that I dont want to indent ends here // stuff that I want to indent starts here /AUTOINDENTON/

Is there a convenient way to get such behavior?

Thanks, Yoram Stern

veripoolbot commented 9 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2015-04-29T12:38:25Z


There is no such thing presently, but you can make your own function, roughly (untested)

(defun my-indent ()
    (interactive)
    (goto-char (point-min))
    (search-forward "/*AUTOINDENTON*/)
    (let ((ep (save-excursion (search-forward "/*AUTOINDENTOFF\*/)
                     (point))))
       (indent-region (point ep))))