;;; python-selective-display.el -- Easier interaction with selective-display

;; Copyright (C) 2007 Carlos Eduardo Scheidegger

;;; Author: Carlos Eduardo Scheidegger
;;; email: cscheid@sci.utah.edu
;;; Keywords: python, extension, lisp, selective-display

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

;; $Revision: 1.1 $

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ChangeLog

;; 2007 Mar 11: Initial version

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide 'python-selective-display)
;; (require 'python-mode)

(defvar python-selective-hide-level 0)

(add-hook 'python-mode-hook 'python-selective-display-init)

(defun python-selective-display-init ()
  (make-local-variable 'python-selective-hide-level))
  

(defun python-increase-hide ()
  (interactive)
  (setq python-selective-hide-level 
	(+ python-selective-hide-level 
	   py-indent-offset))
  (set-selective-display python-selective-hide-level))

(defun python-decrease-hide ()
  (interactive)
  (setq python-selective-hide-level 
	(max 0
	     (- python-selective-hide-level
		py-indent-offset)))
  (if (= python-selective-hide-level 0)
      (set-selective-display nil)
    (set-selective-display python-selective-hide-level)))

;;; python-selective-display ends here
