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

hs-special-modes-alist grows indefinitely #1106

Closed
veripoolbot opened this issue Nov 9, 2016 · 6 comments
Closed

hs-special-modes-alist grows indefinitely #1106

veripoolbot opened this issue Nov 9, 2016 · 6 comments

Comments

@veripoolbot
Copy link
Collaborator

@veripoolbot veripoolbot commented Nov 9, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 9, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 9, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 9, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 9, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 15, 2016


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
Copy link
Collaborator Author

@veripoolbot veripoolbot commented Nov 19, 2017


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.

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.