~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to fai/py-outline.el

  • Committer: Robert Collins
  • Date: 2005-09-14 11:27:20 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050914112720-c66a21de86eafa6e
trim fai cribbage

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;; Enable a outline minor mode with Python code
2
 
;; 
3
 
;; Copy this document inside your ".emacs".
4
 
 
5
 
;; arch-tag: 3726247d-4c34-4247-a9aa-c9bc43ee2346
6
 
 
7
 
(add-hook 'python-mode-hook 'my-python-hook)
8
 
 
9
 
; this gets called by outline to deteremine the level
10
 
; just use the length of the whitespace
11
 
(defun py-outline-level ()
12
 
  (let (buffer-invisibility-spec)
13
 
    (save-excursion
14
 
      (skip-chars-forward "\t ")
15
 
      (current-column))))
16
 
 
17
 
; this get called after python mode is enabled
18
 
(defun my-python-hook ()
19
 
  ; outline uses this regexp to find headers. I match lines with no
20
 
  ; indent and indented "class" and "def" lines.
21
 
  (setq outline-regexp "[^ \t\n]\\|[ \t]*\\(def\\|class\\) ")
22
 
  ; enable our level computation
23
 
  (setq outline-level 'py-outline-level)
24
 
  ; do not use their \C-c@ prefix, too hard to type. Note this
25
 
  ; overides some python mode bindings
26
 
  (setq outline-minor-mode-prefix "\C-c")
27
 
  ; turn on outline mode
28
 
  (outline-minor-mode t)
29
 
  ; initially hide all but the headers
30
 
  (hide-body))
31
 
 
32