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
261 stars 91 forks source link

hs-special-modes-alist grows indefinitely #1106

Closed veripoolbot closed 6 years ago

veripoolbot commented 8 years ago

Author Name: Robert Swan Original Redmine Issue: 1106 from https://www.veripool.org


(when (boundp 'hs-special-modes-alist) (unless (assq 'verilog-mode hs-special-modes-alist) (setq hs-special-modes-alist (cons '(verilog-mode-mode "\<begin\>" "\<end\>" nil verilog-forward-sexp-function) hs-special-modes-alist))))

should be

(when (boundp 'hs-special-modes-alist) (unless (assq 'verilog-mode_mode hs-special-modes-alist) (setq hs-special-modes-alist (cons '(verilog-mode-mode "\<begin\>" "\<end\>" nil verilog-forward-sexp-function) hs-special-modes-alist))))

veripoolbot commented 8 years ago

Original Redmine Comment Author Name: Robert Swan Original Date: 2016-11-09T15:28:20Z


Well, formatting is messed up but probably you get the idea.

(unless (assq 'verilog-mode hs-special-modes-alist)

needs to be

(unless (assq 'verilog-mode-mode hs-special-modes-alist)
veripoolbot commented 8 years ago

Original Redmine Comment Author Name: Kaushal Modi Original Date: 2016-11-09T16:37:49Z


You can use @with-eval-after-load@ (emacs 24.3+) and @add-to-list@. That way, you do not need to worry about @hs-special-modes-alist@ being available.

I have this in my config and it works fine:

     (with-eval-after-load 'hideshow
       (add-to-list 'hs-special-modes-alist
                    `(verilog-mode ,(concat "\\b\\(begin"
                                            "\\|task"
                                            "\\|function"
                                            "\\|class"
                                            "\\|module"
                                            "\\|program"
                                            "\\|interface"
                                            "\\|module"
                                            "\\|case"
                                            "\\|fork\\)\\b")
                                   ,(concat "\\b\\(end"
                                            "\\|endtask"
                                            "\\|endfunction"
                                            "\\|endclass"
                                            "\\|endmodule"
                                            "\\|endprogram"
                                            "\\|endinterface"
                                            "\\|endmodule"
                                            "\\|endcase"
                                            "\\|join\\|join_none\\|join_any\\)\\b")
                                   nil verilog-forward-sexp-function)))
veripoolbot commented 8 years ago

Original Redmine Comment Author Name: Kaushal Modi Original Date: 2016-11-09T16:39:31Z


Also, why does @verilog-mode@ need to be @verilog-mode-mode@?

veripoolbot commented 8 years ago

Original Redmine Comment Author Name: Robert Swan Original Date: 2016-11-09T17:10:21Z


Verilog-mode.el has a bug, and you're correct, @verilog-mode-mode@ should be changed to @verilog-mode@, not the other way round.

;; hideshow support
  (when (boundp 'hs-special-modes-alist)
     (unless (assq 'verilog-mode hs-special-modes-alist)
       (setq hs-special-modes-alist
        (cons '(verilog-mode-mode  "\\<begin\\>" "\\<end\\>" nil
                       verilog-forward-sexp-function)
          hs-special-modes-alist))))

Thanks for the hs-special-modes-alist, works great.

Robert

veripoolbot commented 7 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2016-11-15T00:03:54Z


So do you think verilog-mode.el should add something similar to what you'all have as a default, or should it leave it to the user's config files? If it should add something, exactly what?

veripoolbot commented 6 years ago

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


Looks like this is no longer a problem with verilog-mode.el itself, if it actually is please reopen or file a new bug, thanks.