Search code examples
emacselisp

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


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?


Solution

  • If you want it to be truly global, this does the trick:

    (define-globalized-minor-mode global-hs-minor-mode
      hs-minor-mode hs-minor-mode)
    
    (global-hs-minor-mode 1)