From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Loris Bennett" Subject: [OT] Org-like folding with cperl mode? Date: Fri, 04 May 2018 09:32:02 +0200 Message-ID: <87k1sjg9l9.fsf@hornfels.zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEVCS-0001mG-DA for emacs-orgmode@gnu.org; Fri, 04 May 2018 03:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEVCN-0004tg-V5 for emacs-orgmode@gnu.org; Fri, 04 May 2018 03:32:16 -0400 Received: from [195.159.176.226] (port=35762 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEVCN-0004sU-Nj for emacs-orgmode@gnu.org; Fri, 04 May 2018 03:32:11 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fEVAE-0006SY-0M for emacs-orgmode@gnu.org; Fri, 04 May 2018 09:29:58 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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.