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

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

Re: python setup ?


From: superbobry
Subject: Re: python setup ?
Date: Tue, 28 Apr 2009 04:25:28 -0700 (PDT)
User-agent: G2/1.0

On Apr 28, 2:43 pm, Bernardo <bernardo.ba...@pobox.com> wrote:
> > Hello,
> > Can anyone help me with python code folding please? I tried:
> > * hs-minor-mode (doesn't work with python)
> > * outline mode (it does the folding part, but is really buggy with
> > python)
>
> > Is there a solution?
> > Thank you,
> > Sergei
>
> hi,
>
> which version of Emacs are you using?
> i remember there was a hideshow problem introduced somewhere after v22.1
> and i added this 'quick-n-dirty' hack into my .emacs
>
> (defun bb-python-hs-helper (arg)
>    "Helper function for the bb-use-old-hideshow-setting below"
>    (python-end-of-defun)
>    (skip-chars-backward " \t\n"))
>
> (defun bb-use-old-hideshow-setting ()
>    "Restore the hs-special-modes-alist setting that used to work fine in
> v22.1.1"
>    (if (and (= emacs-major-version 22)
>             (>= emacs-minor-version 2))
>        (progn
>          (setq hs-special-modes-alist
>                (assq-delete-all 'python-mode  hs-special-modes-alist))
>          (add-to-list 'hs-special-modes-alist
>                       '(python-mode "^\\s-*def\\>" nil "#"
>                                     bb-python-hs-helper
>                                     nil)))))
>
> (add-hook 'python-mode-hook
>    (lambda ()
>      (hs-minor-mode 1)
>      (bb-use-old-hideshow-setting)
>      ;other stuff
>      ))
>
> this fixed the folding problem in v22.3 but may or may not help with
> your issue
>
> however, version pre-23 seems to work without this ugly hack
>
> HTH

Hello,
I'm using 23.0 from, built from cvs. I tryed the hack above already,
and it wasnt working 100% with me. Anyway, i managed to solve the
problem using semantic (from CEDET tools).
Cheers,
Sergei


reply via email to

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