changeset 76314:a91ba205af7e

(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.
author Glenn Morris <rgm@gnu.org>
date Sun, 04 Mar 2007 20:51:17 +0000
parents a5e667d4ac50
children c85e1748f5ca
files lisp/progmodes/hideshow.el
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/hideshow.el	Sun Mar 04 20:50:54 2007 +0000
+++ b/lisp/progmodes/hideshow.el	Sun Mar 04 20:51:17 2007 +0000
@@ -906,11 +906,18 @@
   (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 @@
 (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 @@
                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