Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to permanently enable the hs-minor-mode in emacs

Tags:

emacs

elisp

I am using thhs code in the .emacs file to permanently enable the hs-minor-mode and to change the shortcut:

(setq-default hs-minor-mode t)
(global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h"))         ;;hiding block of code
(global-set-key (kbd "C-c C-r") (kbd "C-c @ C-s"))         ;;revealing block of code

But the mode is not activated automatically. what should i do?

like image 442
sudeepdino008 Avatar asked Oct 06 '12 20:10

sudeepdino008


1 Answers

You can turn on hs-minor-mode for a specific mode like C, C++ mode using c-mode-common-hook.

(add-hook 'c-mode-common-hook #'hs-minor-mode)

In Emacs 24 or later, you can turn it on in all programming modes using prog-mode-hook.

(add-hook 'prog-mode-hook #'hs-minor-mode)
like image 179
Praveen Kumar Avatar answered Sep 25 '22 08:09

Praveen Kumar