Skip to content
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

Ignore lines starting with certain characters from indenting automatically [Feature request] #885

Closed
veripoolbot opened this issue Feb 23, 2015 · 4 comments

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Kaushal Modi
Original Redmine Issue: 885 from https://www.veripool.org


Hi,

I use the "outshine":https://github.com/tj64/outshine package to organize my verilog/systemverilog code blocks.

outshine setup

Below is the setup required for @outshine@.

     ;; (defvar outline-minor-mode-prefix "\M-#")
     ;; Above needs to be set using Customize so that it is set BEFORE the
     ;; `outline' (not `outshine') library is loaded.
     (require 'outshine)
     (add-hook 'outline-minor-mode-hook #'outshine-hook-function)
     (dolist (hook '(verilog-mode-hook))
       (add-hook hook #'outline-minor-mode))

Use of outshine in verilog/systemverilog code

And below is how you use it in code:

The only requirement is that you need @// * Heading@ at the very beginning of the line, without any space or indentation before it.

Below snippet shows the example use of @// * Heading1@ and @// ** Heading2@. Similarly, you can also have @// *** Heading3@ and so on.

// * Class definition
class my_class extends my_base_class;
    // code ..
    
// ** Task 1 definition
    virtual task my_task1;
        // code ..
    endtask 

// ** Task 2 definition
    virtual task my_task2;
        // code ..
    endtask 
endclass 

This allows quick navigation and overview of the code

!Clipboard01.png!

Problem with indentation

As shown in this snippet, @// * Heading1@, @// ** Heading2@, etc need to stick to the very left, without any space before them.

Auto-indentation will indent the @// ** Task 1 definition@ below too and that will break the features that @outline-mode@ and @outshine@ have to offer.

class my_class extends my_base_class;
    // code ..
    
// ** Task 1 definition
    virtual task my_task1;
        // code ..
    endtask 

So coming to the feature request ...

*Can the indentation algorithm be configured that it does not try to indent the lines that begin with '@// @' ?

Thanks!

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Kaushal Modi
Original Date: 2015-02-23T19:18:25Z


Missing image from the above post-

!Clipboard01.png!

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Kaushal Modi
Original Date: 2015-03-13T20:59:54Z


I have settled on "this solution":https://github.com/kaushalmodi/.emacs.d/blob/340b7ce03dc8be2b9b1183cb72eca68d4d030bcb/setup-files/setup-verilog.el#L360-384 that works great for me.

If a line matches @^[[:blank:]]// \@ then any preceding white space is removed and that line is not indented.

It would be good to see it integrated into @verilog-mode@ if there are no side-effects.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Kaushal Modi
Original Date: 2015-06-23T16:13:02Z


Still using that advice; no issues till date.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-11-19T13:18:51Z


This is very user specific, but if you can make a more generic optionally-enabled patch we'll consider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant