From: Glenn Morris Date: Sun, 4 Mar 2007 20:51:17 +0000 (+0000) Subject: (hs-minor-mode): Turn mode off and show all when switching major mode. X-Git-Tag: emacs-pretest-22.0.96~269 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b9634f953f526ecf74833b62cdad969dffed5782;p=emacs.git (hs-minor-mode): Turn mode off and show all when switching major mode. (hs-minor-mode, hs-c-start-regexp, hs-block-start-regexp) (hs-block-start-mdata-select, hs-block-end-regexp) (hs-forward-sexp-func, hs-adjust-block-beginning): Do not make these variables permanent-local. --- diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 35ab0362613..3bc1c55cc7d 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -906,11 +906,18 @@ Key bindings: (if hs-minor-mode (progn (hs-grok-mode-type) + ;; Turn off this mode if we change major modes. + (add-hook 'change-major-mode-hook + (lambda () (hs-minor-mode -1)) + nil t) (easy-menu-add hs-minor-mode-menu) (set (make-local-variable 'line-move-ignore-invisible) t) (add-to-invisibility-spec '(hs . t))) (easy-menu-remove hs-minor-mode-menu) - (remove-from-invisibility-spec '(hs . t))) + (remove-from-invisibility-spec '(hs . t)) + ;; hs-show-all does nothing unless h-m-m is non-nil. + (let ((hs-minor-mode t)) + (hs-show-all))) (run-hooks 'hs-minor-mode-hook)) ;;--------------------------------------------------------------------------- @@ -945,7 +952,7 @@ Key bindings: (add-to-list 'minor-mode-map-alist (cons 'hs-minor-mode hs-minor-mode-map)) (add-to-list 'minor-mode-alist '(hs-minor-mode " hs") t) -;; make some variables permanently buffer-local +;; make some variables buffer-local (dolist (var '(hs-minor-mode hs-c-start-regexp hs-block-start-regexp @@ -953,8 +960,7 @@ Key bindings: hs-block-end-regexp hs-forward-sexp-func hs-adjust-block-beginning)) - (make-variable-buffer-local var) - (put var 'permanent-local t)) + (make-variable-buffer-local var)) ;;--------------------------------------------------------------------------- ;; that's it