comparison lisp/progmodes/hideshow.el @ 76844:ab61d371ed56

(turn-off-hideshow): New function. (hs-minor-mode): Use it instead of a lambda expression in change-major-mode-hook.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 31 Mar 2007 18:32:05 +0000
parents a91ba205af7e
children 638ed5cc0e55
comparison
equal deleted inserted replaced
76843:56e7e274cc62 76844:ab61d371ed56
182 ;; ad-do-it)) 182 ;; ad-do-it))
183 ;; 183 ;;
184 ;; (5) Hideshow interacts badly with Ediff and `vc-diff'. At the moment, the 184 ;; (5) Hideshow interacts badly with Ediff and `vc-diff'. At the moment, the
185 ;; suggested workaround is to turn off hideshow entirely, for example: 185 ;; suggested workaround is to turn off hideshow entirely, for example:
186 ;; 186 ;;
187 ;; (defun turn-off-hideshow () (hs-minor-mode -1))
188 ;; (add-hook 'ediff-prepare-buffer-hook 'turn-off-hideshow) 187 ;; (add-hook 'ediff-prepare-buffer-hook 'turn-off-hideshow)
189 ;; (add-hook 'vc-before-checkin-hook 'turn-off-hideshow) 188 ;; (add-hook 'vc-before-checkin-hook 'turn-off-hideshow)
190 ;; 189 ;;
191 ;; In the case of `vc-diff', here is a less invasive workaround: 190 ;; In the case of `vc-diff', here is a less invasive workaround:
192 ;; 191 ;;
906 (if hs-minor-mode 905 (if hs-minor-mode
907 (progn 906 (progn
908 (hs-grok-mode-type) 907 (hs-grok-mode-type)
909 ;; Turn off this mode if we change major modes. 908 ;; Turn off this mode if we change major modes.
910 (add-hook 'change-major-mode-hook 909 (add-hook 'change-major-mode-hook
911 (lambda () (hs-minor-mode -1)) 910 'turn-off-hideshow
912 nil t) 911 nil t)
913 (easy-menu-add hs-minor-mode-menu) 912 (easy-menu-add hs-minor-mode-menu)
914 (set (make-local-variable 'line-move-ignore-invisible) t) 913 (set (make-local-variable 'line-move-ignore-invisible) t)
915 (add-to-invisibility-spec '(hs . t))) 914 (add-to-invisibility-spec '(hs . t)))
916 (easy-menu-remove hs-minor-mode-menu) 915 (easy-menu-remove hs-minor-mode-menu)
917 (remove-from-invisibility-spec '(hs . t)) 916 (remove-from-invisibility-spec '(hs . t))
918 ;; hs-show-all does nothing unless h-m-m is non-nil. 917 ;; hs-show-all does nothing unless h-m-m is non-nil.
919 (let ((hs-minor-mode t)) 918 (let ((hs-minor-mode t))
920 (hs-show-all))) 919 (hs-show-all)))
921 (run-hooks 'hs-minor-mode-hook)) 920 (run-hooks 'hs-minor-mode-hook))
921
922 ;;;###autoload
923 (defun turn-off-hideshow ()
924 "Unconditionally turn off hideshow minor mode."
925 (hs-minor-mode -1))
922 926
923 ;;--------------------------------------------------------------------------- 927 ;;---------------------------------------------------------------------------
924 ;; load-time actions 928 ;; load-time actions
925 929
926 ;; keymaps and menus 930 ;; keymaps and menus