![启用 hideshow 获得更多模式,例如 Ruby?](https://linux22.com/image/1357871/%E5%90%AF%E7%94%A8%20hideshow%20%E8%8E%B7%E5%BE%97%E6%9B%B4%E5%A4%9A%E6%A8%A1%E5%BC%8F%EF%BC%8C%E4%BE%8B%E5%A6%82%20Ruby%EF%BC%9F.png)
隐藏显示很酷,但它仅限于几种编程语言。有人能帮我添加对更多语言的支持吗,比如 Ruby 和 Haskell?
答案1
(add-hook 'ruby-mode-hook
(lambda () (hs-minor-mode)))
(eval-after-load "hideshow"
'(add-to-list 'hs-special-modes-alist
`(ruby-mode
,(rx (or "def" "class" "module" "do" "{" "[" "if" "else" "unless")) ; Block start
,(rx (or "}" "]" "end")) ; Block end
,(rx (or "#" "=begin")) ; Comment start
ruby-forward-sexp nil)))
在这里找到https://coderwall.com/p/u-l0ra/ruby-code-folding-in-emacs