unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
@ 2013-11-10  9:14 Jambunathan K
  2013-11-12  2:20 ` Nathan Trapuzzano
  2013-11-15  5:14 ` Jambunathan K
  0 siblings, 2 replies; 7+ messages in thread
From: Jambunathan K @ 2013-11-10  9:14 UTC (permalink / raw)
  To: 15854

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]


This is either a bug or a feature request.

Summary: cperl-mode: Support for outlining (much like that in perl-mode)

1. Add this to your .emacs

      (add-hook 'perl-mode-hook 'outline-minor-mode)
      (add-hook 'cperl-mode-hook 'outline-minor-mode)

      (add-hook 'outline-minor-mode-hook
        (lambda ()
          (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
          ;; (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)
          (define-key outline-minor-mode-map [backtab] 'org-global-cycle)
          ))

2. C-x C-f org.pl
3. M-x perl-mode

4. Do this <S-iso-lefttab>, <S-iso-lefttab>

   See the attached screenshot for what I get.

5. M-x cperl-mode
6. Repeat step 4.

   Nothing interesting happens.  Only thing I see is this message.

      --8<---------------cut here---------------start------------->8---
         hide-sublevels: Must keep at least one level of headers [3 times]
      --8<---------------cut here---------------end--------------->8---


Expected behaviour
==================

I should be able to "cycle" through the visibility.


[-- Attachment #2: perl-mode-outlining-and-org-cycle.png --]
[-- Type: image/png, Size: 44583 bytes --]

[-- Attachment #3: Type: text/plain, Size: 361 bytes --]



----------------------------------------------------------------
In GNU Emacs 24.3.50.4 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2013-11-09 on debian-6.05
Bzr revision: 115051 jan.h.d@swipnet.se-20131109111953-cysfi19meuidy96q
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description:	Debian GNU/Linux 6.0.5 (squeeze)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-10  9:14 bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode) Jambunathan K
@ 2013-11-12  2:20 ` Nathan Trapuzzano
  2013-11-12  4:31   ` Jambunathan K
  2013-11-15  5:14 ` Jambunathan K
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Trapuzzano @ 2013-11-12  2:20 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15854

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

Jambunathan K <kjambunathan@gmail.com> writes:

> I should be able to "cycle" through the visibility.

Try the attached patch and let me know.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cperl-mode.el.patch --]
[-- Type: text/x-diff, Size: 4878 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nbtrap@nbtrap.com-20131112021806-7r8z68lcggolglmd
# target_branch: file:///home/nathan/opt/etc/bzr-repos/emacs/trunk/
# testament_sha1: 96915ca7a15c022348d563dc4bdda8cd383c1843
# timestamp: 2013-11-11 21:18:47 -0500
# base_revision_id: monnier@iro.umontreal.ca-20131111180547-\
#   6k3t8pomzwp8zbtf
# 
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-11-11 18:05:47 +0000
+++ lisp/ChangeLog	2013-11-12 02:18:06 +0000
@@ -1,3 +1,8 @@
+2013-11-12  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+	* progmodes/cperl-mode.el (cperl-outline-regexp)
+	(cperl-outline-level): Fix outline level detection bug.  (Bug#15854)
+
 2013-11-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* subr.el (force-mode-line-update): Delete, move to buffer.c.

=== modified file 'lisp/progmodes/cperl-mode.el'
--- lisp/progmodes/cperl-mode.el	2013-11-04 03:44:23 +0000
+++ lisp/progmodes/cperl-mode.el	2013-11-12 02:13:34 +0000
@@ -1438,11 +1438,11 @@
    ))
 
 ;;; Details of groups in this are used in `cperl-imenu--create-perl-index'
-;;;  and `cperl-outline-level'.
+;;; and `cperl-imenu--function-name-regexp-perl'.
 ;;;; Was: 2=sub|package; now 2=package-group, 5=package-name 8=sub-name (+3)
-(defvar cperl-imenu--function-name-regexp-perl
+(defvar cperl-outline-regexp
   (concat
-   "^\\("				; 1 = all
+   "\\("				; 1 = all
        "\\([ \t]*package"		; 2 = package-group
           "\\("				; 3 = package-name-group
 	    cperl-white-and-comment-rex ; 4 = pre-package-name
@@ -1456,8 +1456,8 @@
      "\\([^\n]+\\)$"			; 17=text
    "\\)"))
 
-(defvar cperl-outline-regexp
-  (concat cperl-imenu--function-name-regexp-perl "\\|" "\\`"))
+(defvar cperl-imenu--function-name-regexp-perl
+  (concat "^" cperl-outline-regexp))
 
 (defvar cperl-mode-syntax-table nil
   "Syntax table in use in CPerl mode buffers.")
@@ -5623,13 +5623,12 @@
 ;; Suggested by Mark A. Hershberger
 (defun cperl-outline-level ()
   (looking-at outline-regexp)
-  (cond ((not (match-beginning 1)) 0)	; beginning-of-file
-;;;; 2=package-group, 5=package-name 8=sub-name 16=head-level
-	((match-beginning 2) 0)		; package
-	((match-beginning 8) 1)		; sub
+  (cond ;;;; 2=package-group, 5=package-name 8=sub-name 16=head-level
+	((match-beginning 2) 1)		; package
+	((match-beginning 8) 2)		; sub
 	((match-beginning 16)
-	 (- (char-after (match-beginning 16)) ?0)) ; headN ==> N
-	(t 5)))				; should not happen
+	 (1+ (- (char-after (match-beginning 16)) ?0))) ; headN ==> N
+	(t 6)))				; should not happen
 
 \f
 (defun cperl-windowed-init ()

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWu4kq8AA4BfgGAwWP///9sF
FAX/7//0YAbulL4FAFRCgAAENEamQU9T0ngk8U8o2KaeoPUaDQNPU9QAcwCYCZGAEYmJhMJghpia
YHMAmAmRgBGJiYTCYIaYmmAkkGkVPaT00ZUaeKNN6U8o9T1G0Ro9QaGhoHMAmAmRgBGJiYTCYIaY
mmA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CB7H1GAZV
M9e5WnOBxdDW5xZy5OSwaKLVSYIIsuJnjaIu1VsL7pjlw5G/q4G1RjhpNXoMPLZJ9Vj1u9xyDUEE
oDcRehqCaxjJ1ievI8jc5yQPuLPZE8aG8uOO1yPE/AXcLDvv+X3fG+Qy6ZCDQkWftOcYxd4xrQeF
pxGHwceBc3Ba+Zqc+BpuPmSuRYJiIrepYvZFm4wqibsTr5hC0lmL6fCgxgY3R0PFmByEQcsz4tPo
IEMhKLNfjp2FhR10szky4ZLFfFGEqr64C4nHQa0WBW7mwz97F6XUN5w97MzEqYHX5OQv/yQDgfXt
gFwuzi0OVMNYHZHjRJUqIlgXQ1VqCUUpiqO+dh2w2jeIunTSMD3XPxciExPCHSy3IPh/w7mh2YPi
N4ufeXkg4c3eiYg/JBYpMMMkxOtLiJg0FM0FbIUG6gb0/8DE2gHtDL7V5pF5WGfFsjA/kTDokd+Q
aC31EgxP6pcBYNQI8A9NDcVk9owwsfqj5uBddqfasjp8gZHBLnHlwgnZMgdDgVgRHA5i8OwvLTm3
cW8UvW44kzUWJeYFADYyir9U56oKhWivNRgyQcShSBWXlaMEYUIBYEKRUHYFYEzUQfgZjTBhxn6q
uZaO6ohOMJ0UNUEIoYIq32FeIkiToGF3rW1ExZpPP+TaQLton4Aj5hdiMIgf0LRFSw0Sv9oIpEWW
fn5TvptRc324MDe5zcIJG0HEFZ8TQcYUg2UN6RkeIRnfPq1CK2i1dTZ0egmRBLh7xgQfemRjRkWC
L7TyJBMp5shOjiilhrU54VlbVOL+Ns5GnBBW5AwyZM1xhYA5WdWBofjYFaVej7T4SxyaPImDjnUM
iAOV78S8PE5hWoAxdl2Mg3rgLBLEU6AgdKthWDHYVRTfX9GUMj80MWwrZLVeCCR7CjvV4nxgInaJ
jzDAWUkKpbmDxE9SgE1M2BeuX/F3JFOFCQa7iSrw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-12  2:20 ` Nathan Trapuzzano
@ 2013-11-12  4:31   ` Jambunathan K
  2013-11-12 11:29     ` Nathan Trapuzzano
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-11-12  4:31 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15854

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

>> I should be able to "cycle" through the visibility.
>
> Try the attached patch and let me know.

Thanks.  Looks good to me.

ps: You don't have to send a bzr bundle.  Maintainers don't insist on
it.  The presence of ChangeLog diffs in my work area led to workarea
conflicts and made my life very difficult when 'bzr update-d'.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-12  4:31   ` Jambunathan K
@ 2013-11-12 11:29     ` Nathan Trapuzzano
  2013-11-12 13:59       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Trapuzzano @ 2013-11-12 11:29 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15854

Jambunathan K <kjambunathan@gmail.com> writes:

> Thanks.  Looks good to me.

Can someone install this?

> ps: You don't have to send a bzr bundle.  Maintainers don't insist on
> it.  The presence of ChangeLog diffs in my work area led to workarea
> conflicts and made my life very difficult when 'bzr update-d'.

The manual doesn't call for a bzr merge directive, but I'm pretty sure
it asks for the patch submitter to include the ChangeLog entry in the
patch.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-12 11:29     ` Nathan Trapuzzano
@ 2013-11-12 13:59       ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-11-12 13:59 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15854, Jambunathan K

> The manual doesn't call for a bzr merge directive, but I'm pretty sure
> it asks for the patch submitter to include the ChangeLog entry in the
> patch.

A bzr bundle is fine, yes.  A patch with the ChangeLog inside is fine.
A patch with a ChangeLog alongside is fine.
A patch without ChangeLog is suboptimal, but it's pretty good as well.


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-10  9:14 bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode) Jambunathan K
  2013-11-12  2:20 ` Nathan Trapuzzano
@ 2013-11-15  5:14 ` Jambunathan K
  2013-11-15 11:30   ` Nathan Trapuzzano
  1 sibling, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-11-15  5:14 UTC (permalink / raw)
  To: 15854-done


OP here.  Closed.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode)
  2013-11-15  5:14 ` Jambunathan K
@ 2013-11-15 11:30   ` Nathan Trapuzzano
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Trapuzzano @ 2013-11-15 11:30 UTC (permalink / raw)
  To: 15854; +Cc: kjambunathan

Jambunathan K <kjambunathan@gmail.com> writes:

> OP here.  Closed.

This patch hasn't been installed yet.  No reason to close it.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-15 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10  9:14 bug#15854: 24.3.50; cperl-mode: Support for outlining (much like that in perl-mode) Jambunathan K
2013-11-12  2:20 ` Nathan Trapuzzano
2013-11-12  4:31   ` Jambunathan K
2013-11-12 11:29     ` Nathan Trapuzzano
2013-11-12 13:59       ` Stefan Monnier
2013-11-15  5:14 ` Jambunathan K
2013-11-15 11:30   ` Nathan Trapuzzano

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).