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

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

Re: python setup ?


From: Bernardo
Subject: Re: python setup ?
Date: Tue, 28 Apr 2009 20:43:00 +1000
User-agent: Thunderbird 2.0.0.21 (X11/20090302)

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




reply via email to

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