emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
To: emacs-orgmode@gnu.org
Subject: [OT] Org-like folding with cperl mode?
Date: Fri, 04 May 2018 09:32:02 +0200	[thread overview]
Message-ID: <87k1sjg9l9.fsf@hornfels.zedat.fu-berlin.de> (raw)

Hi,

This isn't about Org, but about me wanting other things to behave like
Org.

To get folding in Perl programs I have cargo-cult-copied the
outline-based set-up here

  https://github.com/villadora/emacs-config/blob/master/modes.el

In particular I have:

  ;; CPerl mode hook
  (setq cperl-mode-hook 'my-cperl-customizations)

  (defun my-cperl-customizations ()
    "cperl-mode customizations that must be done after cperl-mode loads"
    (outline-minor-mode)
    (abbrev-mode)
    (defun cperl-outline-level ()
      (looking-at outline-regexp)
      (let ((match (match-string 1)))
        (cond
         ((eq match "=head1" ) 1)
         ((eq match "package") 2)
         ((eq match "=head2" ) 3)
         ((eq match "=item"  ) 4)
         ((eq match "sub"    ) 5)
         (t 7)
         )))
    (setq cperl-outline-regexp  my-cperl-outline-regexp)
    (setq outline-regexp        cperl-outline-regexp)
    (setq outline-level        'cperl-outline-level)
    )

My expectation was that if I have

  =head2 STUFF
  =over
  =item foo
  Do foo
  =cut
  sub foo {
    return 'foo';
  }
  
I should be able to fold to

  =head2 STUFF...

but instead I just can only fold to, say

  =head2 STUFF...
  =item foo
  Do foo
  =cut
  sub foo {
    return 'foo';
  }

i.e. the hierarchy, which I thought gets defined by 'outline-level'
doesn't seem to work.

I do have

  (add-hook 'outline-minor-mode-hook 'outshine-hook-function)

to get tab-cycling, but maybe this is screwing things up. 

Any thoughts or other approaches?

Cheers,

Loris

-- 
This signature is currently under construction.

                 reply	other threads:[~2018-05-04  7:32 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.orgmode.org/

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

  git send-email \
    --in-reply-to=87k1sjg9l9.fsf@hornfels.zedat.fu-berlin.de \
    --to=loris.bennett@fu-berlin.de \
    --cc=emacs-orgmode@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).