help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hs-minor-mode broken in python files


From: Bernardo Bacic
Subject: hs-minor-mode broken in python files
Date: Mon, 22 Sep 2008 21:28:30 +1000
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Greetings,

It seems the hs-minor-mode got broken for python files in Emacs post-v22.1
releases.

Having a (test) file consisting of
----8<--start---------------------------------
class Test:
    def method1( self ):
        pass

    def method2( self ):
        pass
----8<--end---------------------------------

when hs-hide-all is executed in Emacs version 22.1.1 it shows (a preferable
behaviour IMO):
class Test:
    def method1( self ):...

    def method2( self ):...

In version 22.2.1 (and v22.3.1) it shows:
class Test:...

I should mention Emacs is started with the -Q command line option in all cases
and hideshow mode is manually activated.

A quick look into hideshow.el reveals the following suggestion to hide inner
levels, rather than the outmost one:
;;   (defun ttn-hs-hide-level-1 ()
;;     (hs-hide-level 1)
;;     (forward-sexp 1))
;;   (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1)

This worked only partially better. In fact, the (hs-hide-level 1) statement
had to be changed to (hs-hide-level 2) and this results with the first method
hidden (collapsed), but the second one was unaffected.

A diff between hideshow.el between versions 22.1.1 and 22.2.1 didn't show any
substantial changes, some comments got cleaned up.
It appears the changes in python.el are the culprit and there is some comment
along these lines in the vicinity of code where hs-special-modes-alist is 
updated.

To quickly get around this issue i've hacked my .emacs removing the new
python-mode entry in hs-special-modes-alist and inserting the version from
v22.1.1 release.

This appears to work ok but was just wondering if anybody has a better solution.

Regards, Bernardo






reply via email to

[Prev in Thread] Current Thread [Next in Thread]