unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Bernardo Bacic <bernardo.bacic@pobox.com>
To: help-gnu-emacs@gnu.org
Subject: hs-minor-mode broken in python files
Date: Mon, 22 Sep 2008 21:28:30 +1000	[thread overview]
Message-ID: <48D7815E.4000005@pobox.com> (raw)

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	other threads:[~2008-09-22 11:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D7815E.4000005@pobox.com \
    --to=bernardo.bacic@pobox.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).