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

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

Re: cperl-mode - outline minor mode - subroutines


From: LanX
Subject: Re: cperl-mode - outline minor mode - subroutines
Date: Mon, 19 Apr 2010 09:16:07 -0700 (PDT)
User-agent: G2/1.0

> I would like to know how to give hints to outline minor mode, so that
> the subroutine can be broken down into
> sections and subsections.

I presume we are talking about cperl-mode?

Thats defined in a list of regex in the variable outline-regexp which
is derived  from cperl-outline-regexp


"^\\(\\([       ]*package\\(\\([        
\n]\\|#[^\n]*\n\\)+\\([a-zA-Z_0-9:']+\\)\
\)?\\)\\|[      ]*sub\\(\\([    \n]\\|#[^\n]*\n\\)+\\(::[a-zA-Z_0-9:']+\\|[a-
zA-Z_'][a-zA-Z_0-9:']*\\)\\)\\([        \n]*\\(#[^\n]*\n[       \n]*\\)*\\
(([^()]*)\\)\\)?\\([    \n]*\\(#[^\n]*\n[       \n]*\\)*\\(:[^:]\\)\\)?[        
\n]*
\\(#[^\n]*\n[   \n]*\\)*\\|=head\\([1-4]\\)[    ]+\\([^\n]+\\)$\\)\\|\\`"

all of this derived as concat from


--------------------
;;; Details of groups in this are used in `cperl-imenu--create-perl-
index'
;;;  and `cperl-outline-level'.
;;;; Was: 2=sub|package; now 2=package-group, 5=package-name 8=sub-
name (+3)
(defvar cperl-imenu--function-name-regexp-perl
  (concat
   "^\\("                               ; 1 = all
       "\\([ \t]*package"               ; 2 = package-group
          "\\("                         ; 3 = package-name-group
            cperl-white-and-comment-rex ; 4 = pre-package-name
               "\\([a-zA-Z_0-9:']+\\)\\)?\\)" ; 5 = package-name
       "\\|"
          "[ \t]*sub"
          (cperl-after-sub-regexp 'named nil) ; 8=name 11=proto 14=attr-start
          cperl-maybe-white-and-comment-rex     ; 15=pre-block
   "\\|"
     "=head\\([1-4]\\)[ \t]+"           ; 16=level
     "\\([^\n]+\\)$"                    ; 17=text
   "\\)"))

(defvar cperl-outline-regexp
  (concat cperl-imenu--function-name-regexp-perl "\\|" "\\`"))

--------------------------------

HTH please give a note if you are succesful! :)

Cheers
  rolf


reply via email to

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