unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* hs-minor-mode broken in python files
@ 2008-09-22 11:28 Bernardo Bacic
  0 siblings, 0 replies; only message in thread
From: Bernardo Bacic @ 2008-09-22 11:28 UTC (permalink / raw)
  To: help-gnu-emacs

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






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-22 11:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 11:28 hs-minor-mode broken in python files Bernardo Bacic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).