unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
@ 2013-11-10  6:58 Jambunathan K
  2013-11-10 11:51 ` Nathan Trapuzzano
  2013-11-15  5:16 ` Jambunathan K
  0 siblings, 2 replies; 30+ messages in thread
From: Jambunathan K @ 2013-11-10  6:58 UTC (permalink / raw)
  To: 15848

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


24.3.50; cperl-mode + which-function: Inaccurate reporting (corner case)

See the attached screenshot.  Note the following

1. Cursor position in the top window. 

   In the bottom window, the cursor is well within the toplevel block of
   sub.

2. which-function field of the modeline.

Hint: Note the presence/absence of `=' (most likely from the =cut line above)


[-- Attachment #2: cperl-which-function-is-inaccurate.png --]
[-- Type: image/png, Size: 85681 bytes --]

[-- Attachment #3: Type: text/plain, Size: 298 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] 30+ messages in thread

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10  6:58 bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case) Jambunathan K
@ 2013-11-10 11:51 ` Nathan Trapuzzano
  2013-11-10 13:06   ` Jambunathan K
  2013-11-15  5:16 ` Jambunathan K
  1 sibling, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-10 11:51 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Hint: Note the presence/absence of `=' (most likely from the =cut line
> above)

=cut directives are supposed to be followed by at least one empty line.
Please see if you can reproduce this using correct pod syntax.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 11:51 ` Nathan Trapuzzano
@ 2013-11-10 13:06   ` Jambunathan K
  2013-11-10 13:13     ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-10 13:06 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

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

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> =cut directives are supposed to be followed by at least one empty
> line.

I expected this.

> Please see if you can reproduce this using correct pod syntax.

Yes, I can.  See for yourself.  Here I go ..


[-- Attachment #2: cperl-which-function.png --]
[-- Type: image/png, Size: 25350 bytes --]

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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 13:06   ` Jambunathan K
@ 2013-11-10 13:13     ` Jambunathan K
  2013-11-10 15:51       ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-10 13:13 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

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

Jambunathan K <kjambunathan@gmail.com> writes:

>> Please see if you can reproduce this using correct pod syntax.
>
> Yes, I can.  See for yourself.  Here I go ..

I attach the screenshot again.  (This one shows the cursor.)


[-- Attachment #2: cperl-which-function.png --]
[-- Type: image/png, Size: 25814 bytes --]

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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 13:13     ` Jambunathan K
@ 2013-11-10 15:51       ` Nathan Trapuzzano
  2013-11-10 16:20         ` Jambunathan K
  2013-11-10 18:04         ` Stefan Monnier
  0 siblings, 2 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-10 15:51 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> I attach the screenshot again.  (This one shows the cursor.)

Thanks, but after looking into this, I don't think it's a bug.
which-function-mode displays either the definition containing point or,
if there is none, the definition before and closest to point.  In
cperl's case, "definition" intentionally includes pod =head directives.
All you're seeing is the previous defintion's name being correctly
displayed in the mode line.

Perhaps a cperl variable to disable imenu indexing of POD directives is
what you want.  I might be able to implement something like that if it's
not too hard.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 15:51       ` Nathan Trapuzzano
@ 2013-11-10 16:20         ` Jambunathan K
  2013-11-10 16:48           ` Nathan Trapuzzano
  2013-11-10 18:04         ` Stefan Monnier
  1 sibling, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-10 16:20 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> I attach the screenshot again.  (This one shows the cursor.)
>
> Thanks, but after looking into this, I don't think it's a bug.

perl-mode behaves differently and correctly.  

> In cperl's case, "definition" intentionally includes pod =head
> directives.  All you're seeing is the previous defintion's name being
> correctly displayed in the mode line.

Is it possible to show the sub name when within a function and show the
head1 or head2 string when within a perldoc string.  (I am new to perl
so I can talk only fuzzily about the language or it's features)

My gut feeling is that the way cperl mode treats POD directives also
limits it from doing outlining.

See the screenshot in this thread.

http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-11/msg00355.html

I would really like to get outlining work when in cperl-mode.

> Perhaps a cperl variable to disable imenu indexing of POD directives is
> what you want.  I might be able to implement something like that if it's
> not too hard.

I think anything that doesn't show "= " would do for me.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 16:20         ` Jambunathan K
@ 2013-11-10 16:48           ` Nathan Trapuzzano
  2013-11-10 18:14             ` Nathan Trapuzzano
  2013-11-11  7:20             ` Jambunathan K
  0 siblings, 2 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-10 16:48 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

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

Jambunathan K <kjambunathan@gmail.com> writes:

> perl-mode behaves differently and correctly.  

I think you've misunderstood.  cperl-mode does exactly what it's
supposed to do, which is more than what perl-mode tries to do.

> Is it possible to show the sub name when within a function and show
> the head1 or head2 string when within a perldoc string.  (I am new to
> perl so I can talk only fuzzily about the language or it's features)

It's not really feasible, though it has nothing to do with Perl per se.
Like I said before, the "function" name displayed by which-function-mode
is the function containing point or, if none, the nearest function
before point.  In cperl-mode pod =head directives count for this purpose
as "functions", and regular subroutines begin at the position following
their name.

> My gut feeling is that the way cperl mode treats POD directives also
> limits it from doing outlining.

After a brief skim of the cperl source, I had the opposite impression.

> I would really like to get outlining work when in cperl-mode.

I'll take a look at that later.  With luck, it'll be as easy as this
one.

> I think anything that doesn't show "= " would do for me.

Again, the "= " means that the "current function" (according to the
above definition) is a pod =head directive.

Try the attached patch.  Make sure you set cperl-imenu-index-pod to nil
before invoking cperl-mode.  If it does what you want, we can ask for it
to be installed.


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

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nbtrap@nbtrap.com-20131110162047-2pqh1c9up17hfzkd
# target_branch: file:///home/nathan/opt/etc/bzr-repos/emacs/trunk/
# testament_sha1: fd4a0d8284f9bbda92ca8a31dc190cfa3b8adb78
# timestamp: 2013-11-10 11:41:32 -0500
# base_revision_id: jan.h.d@swipnet.se-20131110121803-bv908hul7t8ji6c8
# 
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-11-10 08:35:04 +0000
+++ lisp/ChangeLog	2013-11-10 16:20:47 +0000
@@ -1,3 +1,10 @@
+2013-11-10  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+	* progmodes/cperl-mode.el (cperl-imenu-index-pod)
+	(cperl-imenu--create-perl-index): Define and implement
+	`cperl-imenu-index-pod' to optionally disable cperl's indexing of
+	POD directives for imenu.  (Bug#15848)
+
 2013-11-10  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (tramp-methods):

=== 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-10 16:15:36 +0000
@@ -511,6 +511,13 @@
   :type 'boolean
   :group 'cperl-help-system)
 
+(defcustom cperl-imenu-index-pod t
+  "*Whether POD `=head' directives should be indexed by imenu.
+Non-nil means `which-function-mode' won't count POD directives as
+top-level definitions."
+  :type 'boolean
+  :group 'cperl-help-system)
+
 (defcustom cperl-max-help-size 66
   "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents."
   :type '(choice integer (const nil))
@@ -844,7 +851,8 @@
                 interactive sweep over the buffer);
         d) Has support for imenu, including:
                 1) Separate unordered list of \"interesting places\";
-                2) Separate TOC of POD sections;
+                2) Separate TOC of POD sections by default
+                   (cf. `cperl-imenu-index-pod');
                 3) Separate list of packages;
                 4) Hierarchical view of methods in (sub)packages;
                 5) and functions (by the full name - with package);
@@ -5551,7 +5559,7 @@
 	      (push index index-alist))
 	    (if meth (push index index-meth-alist))
 	    (push index index-unsorted-alist)))
-	 ((match-beginning 16)		; POD section
+	 ((and cperl-imenu-index-pod (match-beginning 16))	; POD section
 	  (setq name (buffer-substring (match-beginning 17) (match-end 17))
 		marker (make-marker))
 	  (set-marker marker (match-beginning 17))

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWXtrJDAABhbfgAA02PP//38F
zID////wYAn9sU+alUAKAhqtgrKoADQKhJITQRpNPQGJkyRoJhqABoMgBJTQJpkaBNEmJqGQ9I0B
oAAAOYBMBMjACMTEwmEwQ0xNMCJ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SLF82Z/Z8l7t+fs8TiZHBGzqKUSjrm+Scq9wbb9
zoPVin/tBhdGuVHGe9Ht8OVHxTticp5qnKkqCvZQbA2FjzlEvs9GBPY+Lxcvpj3mRbWmku1Rouoh
uqM0emjA8mdsknWUK9BibU0ptM2vQWGL0IzX41fUWRUo41DUchH9nOrRFLKtFLKsUsq3jG7I1qmm
STfpOiXRedKM6OY76VmYVnjkSl00YKiLZrElRPLCOZp1fKGolyOoL+DJHV+KZZjbs338ZBVQx5lJ
/pUTvNdpWGjFRr5i6JUNtiavNrYd6OmszfvEazMlhHPr6essUTOPu1RM9EYhA2UYiNK/gLwVahjk
j0AsBVQZkIpzmSqJ0HAI/aM1t+CaccxGk8C8X+NCaYe7HRrM9HhgYaUZ7Es2r1V9qiyuMOzox/uj
XeZz6Tc5p10pUqt5cwCxlPjUqlUqnpRf56B+WxoSeuat/fscLpwUaJ5y8uPkOBdLFt5iMjdnjJR1
eBtHbPRWCk8Ec+ma3cqJuJyCKmmiZGlhd1kpJ1o7P95HdNT1hv6WPMRBe8LW3Q15RZUoCh1JgmQw
B+hlOfElPqjmJhhI7OpG5FwY8b4socIO9W6eaKo2FiHgj/xdyRThQkHtrJDA

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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 15:51       ` Nathan Trapuzzano
  2013-11-10 16:20         ` Jambunathan K
@ 2013-11-10 18:04         ` Stefan Monnier
  2013-11-10 22:12           ` Nathan Trapuzzano
  2013-11-11  2:57           ` Leo Liu
  1 sibling, 2 replies; 30+ messages in thread
From: Stefan Monnier @ 2013-11-10 18:04 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848, Jambunathan K

> Perhaps a cperl variable to disable imenu indexing of POD directives is
> what you want.  I might be able to implement something like that if it's
> not too hard.

If you do, please try and share the code between perl-mode and
cperl-mode (we could (require 'perl-mode) at the beginning of
cperl-mode for that).


        Stefan





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 16:48           ` Nathan Trapuzzano
@ 2013-11-10 18:14             ` Nathan Trapuzzano
  2013-11-11  7:20             ` Jambunathan K
  1 sibling, 0 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-10 18:14 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> I think you've misunderstood.  cperl-mode does exactly what it's
> supposed to do, which is more than what perl-mode tries to do.

Actually, perl-mode _does_ index pod directives for imenu.  My mistake.
The difference is where each mode considers one "function" to end and
another to begin.  Moreover, cperl-mode puts "= " in front in order to
distinguish the "function" as a pod directive.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 18:04         ` Stefan Monnier
@ 2013-11-10 22:12           ` Nathan Trapuzzano
  2013-11-11  2:57           ` Leo Liu
  1 sibling, 0 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-10 22:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15848, Jambunathan K

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> If you do, please try and share the code between perl-mode and
> cperl-mode (we could (require 'perl-mode) at the beginning of
> cperl-mode for that).

The two modes hook into imenu by different interfaces, so this is not
really feasible.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 18:04         ` Stefan Monnier
  2013-11-10 22:12           ` Nathan Trapuzzano
@ 2013-11-11  2:57           ` Leo Liu
  2013-11-11  4:18             ` Stefan Monnier
  2013-11-11 10:54             ` Nathan Trapuzzano
  1 sibling, 2 replies; 30+ messages in thread
From: Leo Liu @ 2013-11-11  2:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15848, Nathan Trapuzzano, Jambunathan K

On 2013-11-11 02:04 +0800, Stefan Monnier wrote:
> If you do, please try and share the code between perl-mode and
> cperl-mode (we could (require 'perl-mode) at the beginning of
> cperl-mode for that).

Why not get merge perl-mode into cperl-mode so that we can focus on
improving cperl-mode? There are buglets here and there in cperl-mode.

Having two modes provide no gains for anybody. Split development effort
and an extra decision for users to make.

Leo





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11  2:57           ` Leo Liu
@ 2013-11-11  4:18             ` Stefan Monnier
  2013-11-11 10:58               ` Nathan Trapuzzano
  2013-11-11 10:54             ` Nathan Trapuzzano
  1 sibling, 1 reply; 30+ messages in thread
From: Stefan Monnier @ 2013-11-11  4:18 UTC (permalink / raw)
  To: Leo Liu; +Cc: 15848, Nathan Trapuzzano, Jambunathan K

> Why not get merge perl-mode into cperl-mode so that we can focus on
> improving cperl-mode? There are buglets here and there in cperl-mode.

I find cperl-mode's code completely impenetrable and riddled with
irrelevant version checks.  And I don't like its behavior very much.

I do think, the two code bases should get closer, which is why
I encouraged Nathan in this direction.


        Stefan





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10 16:48           ` Nathan Trapuzzano
  2013-11-10 18:14             ` Nathan Trapuzzano
@ 2013-11-11  7:20             ` Jambunathan K
  2013-11-11 10:50               ` Nathan Trapuzzano
  1 sibling, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-11  7:20 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

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

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Try the attached patch.  

Thanks.

> Make sure you set cperl-imenu-index-pod to nil before invoking
> cperl-mode.  

Done.  See the screenshot.  

> If it does what you want

Pay particular attention to the hollow rectangle which tells you where
the cursor is.  Mode line is reporting the previous defun and NOT the
current defun.


[-- Attachment #2: which-function-with-nathans-patch.png --]
[-- Type: image/png, Size: 30239 bytes --]

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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11  7:20             ` Jambunathan K
@ 2013-11-11 10:50               ` Nathan Trapuzzano
  2013-11-11 11:09                 ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-11 10:50 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Mode line is reporting the previous defun and NOT the current defun.

I've already said that cperl-mode considers a "function" to begin at the
position immediately _following_ the subroutine's name.  Perhaps I
misunderstood you, but what that patch did was add an option for telling
cperl-mode not to count POD =head directives as "functions".





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11  2:57           ` Leo Liu
  2013-11-11  4:18             ` Stefan Monnier
@ 2013-11-11 10:54             ` Nathan Trapuzzano
  1 sibling, 0 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-11 10:54 UTC (permalink / raw)
  To: Leo Liu; +Cc: 15848, Jambunathan K

Leo Liu <sdl.web@gmail.com> writes:

> Having two modes provide no gains for anybody. Split development
> effort and an extra decision for users to make.

AFAIK, in terms of features, cperl-mode offers everything that perl-mode
offers plus a lot more.  Any effort to merge the two would have the
effect of replacing the latter with the former.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11  4:18             ` Stefan Monnier
@ 2013-11-11 10:58               ` Nathan Trapuzzano
  0 siblings, 0 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-11 10:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15848, Leo Liu, Jambunathan K

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I find cperl-mode's code completely impenetrable and riddled with
> irrelevant version checks.  And I don't like its behavior very much.

Changing some of the defaults helped me warm up to cperl-mode.  By
default, it tries to do way too much, especially with regard to
font-lock.  That said, the regex beutifying is quite impressive.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 10:50               ` Nathan Trapuzzano
@ 2013-11-11 11:09                 ` Jambunathan K
  2013-11-11 11:18                   ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-11 11:09 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> I've already said that cperl-mode considers a "function" to begin at
> the position immediately _following_ the subroutine's name.

I am not retracting my position.  The behaviour - with and without your
patch - is incorrect.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 11:09                 ` Jambunathan K
@ 2013-11-11 11:18                   ` Nathan Trapuzzano
  2013-11-11 11:31                     ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-11 11:18 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

>> I've already said that cperl-mode considers a "function" to begin at
>> the position immediately _following_ the subroutine's name.
>
> I am not retracting my position.  The behaviour - with and without your
> patch - is incorrect.

If that were true, I might fix it; but as it is, the determination of
where the text of one definition ends and another begins seems to admit
of some legitimate flexibility.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 11:18                   ` Nathan Trapuzzano
@ 2013-11-11 11:31                     ` Jambunathan K
  2013-11-11 11:43                       ` Jambunathan K
  2013-11-11 15:03                       ` Nathan Trapuzzano
  0 siblings, 2 replies; 30+ messages in thread
From: Jambunathan K @ 2013-11-11 11:31 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848


> If that were true, I might fix it; but as it is, the determination of
> where the text of one definition ends and another begins seems to admit
> of some legitimate flexibility.

From my standpoint, the sub has ended when it's '}' is seen.  And when I
am right on the sub's name it better be sub name. 

Instead of bickering :-), we should ask for a third party vote or a
veto. 

(Thanks for the patch, I appreciate it.)





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 11:31                     ` Jambunathan K
@ 2013-11-11 11:43                       ` Jambunathan K
  2013-11-11 15:03                       ` Nathan Trapuzzano
  1 sibling, 0 replies; 30+ messages in thread
From: Jambunathan K @ 2013-11-11 11:43 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Instead of bickering :-), we should ask for a third party vote or a
> veto. 

(Looks like I am having a bad today.  Sorry for multiple posts.)

Just move around in an .el file and you know what I am talking about.  I
am just asking for the standard behaviour. 





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 11:31                     ` Jambunathan K
  2013-11-11 11:43                       ` Jambunathan K
@ 2013-11-11 15:03                       ` Nathan Trapuzzano
  2013-11-12  5:23                         ` Jambunathan K
  1 sibling, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-11 15:03 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Instead of bickering :-), we should ask for a third party vote or a
> veto.

Tell you what: if you can convince the maintainers to accept such a
change, I'll write the patch.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-11 15:03                       ` Nathan Trapuzzano
@ 2013-11-12  5:23                         ` Jambunathan K
  2013-11-12 14:11                           ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-12  5:23 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> Instead of bickering :-), we should ask for a third party vote or a
>> veto.
>
> Tell you what: if you can convince the maintainers to accept such a
> change, I'll write the patch.

I am convinced that maintainers are unlikely to have any other opinion.

Did you look at the behaviour of `which-function-mode' on Emacs Lisp
files.  You can also look at the behaviour in C source files.

In my specific case, the cursor is "right on" the function name.  So the
the displayed value should be that function name and not the previous
function name.

On the buffer zone between two defuns, which-function-mode MAY return
nil.  But this case is a "don't care" for me.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-12  5:23                         ` Jambunathan K
@ 2013-11-12 14:11                           ` Nathan Trapuzzano
  2013-11-12 17:49                             ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-12 14:11 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

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

Jambunathan K <kjambunathan@gmail.com> writes:

Try this patch.  It includes the patch for the variable I added earlier.

Also, don't try to apply this on top of the patch I sent for the outline
problem.  You'll get conflicts.  I'll wait till that patch gets
installed and then resolve the conflicts with this patch and send an
updated one.


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

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nbtrap@nbtrap.com-20131112140320-if3f086us590vp5c
# target_branch: file:///home/nathan/opt/etc/bzr-repos/emacs/trunk/
# testament_sha1: 6e81494670e3d66dc1c7cb0abd95be7a9831a403
# timestamp: 2013-11-12 09:05:04 -0500
# base_revision_id: jan.h.d@swipnet.se-20131110121803-bv908hul7t8ji6c8
# 
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-11-10 08:35:04 +0000
+++ lisp/ChangeLog	2013-11-12 14:03:20 +0000
@@ -1,3 +1,17 @@
+2013-11-12  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+	* progmodes/cperl-mode.el (cperl-imenu--function-name-regexp-perl)
+	(cperl-outline-level, cperl-imeny--create-perl-index): Index imenu
+	definitions with the positions at which they begin instead of
+	their end positions.  (Bug#15848)
+
+2013-11-10  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+	* progmodes/cperl-mode.el (cperl-imenu-index-pod)
+	(cperl-imenu--create-perl-index): Define and implement
+	`cperl-imenu-index-pod' to optionally disable cperl's indexing of
+	POD directives for imenu.  (Bug#15848)
+
 2013-11-10  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (tramp-methods):

=== 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 13:26:52 +0000
@@ -511,6 +511,13 @@
   :type 'boolean
   :group 'cperl-help-system)
 
+(defcustom cperl-imenu-index-pod t
+  "*Whether POD `=head' directives should be indexed by imenu.
+Non-nil means `which-function-mode' won't count POD directives as
+top-level definitions."
+  :type 'boolean
+  :group 'cperl-help-system)
+
 (defcustom cperl-max-help-size 66
   "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents."
   :type '(choice integer (const nil))
@@ -844,7 +851,8 @@
                 interactive sweep over the buffer);
         d) Has support for imenu, including:
                 1) Separate unordered list of \"interesting places\";
-                2) Separate TOC of POD sections;
+                2) Separate TOC of POD sections by default
+                   (cf. `cperl-imenu-index-pod');
                 3) Separate list of packages;
                 4) Hierarchical view of methods in (sub)packages;
                 5) and functions (by the full name - with package);
@@ -1439,7 +1447,7 @@
 
 ;;; 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)
+;;;; Was: 2=sub|package; now 2=package-group, 5=package-name 9=sub-name (+4)
 (defvar cperl-imenu--function-name-regexp-perl
   (concat
    "^\\("				; 1 = all
@@ -1448,12 +1456,13 @@
 	    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
+          "\\([ \t]*sub"
+	  (cperl-after-sub-regexp 'named nil) ; 9=name 12=proto 15=attr-start
+	  cperl-maybe-white-and-comment-rex	; 16=pre-block
+          "\\)"
    "\\|"
-     "=head\\([1-4]\\)[ \t]+"		; 16=level
-     "\\([^\n]+\\)$"			; 17=text
+     "=head\\([1-4]\\)[ \t]+"		; 17=level
+     "\\([^\n]+\\)$"			; 18=text
    "\\)"))
 
 (defvar cperl-outline-regexp
@@ -5486,17 +5495,16 @@
       (while (re-search-forward
 	      (or regexp cperl-imenu--function-name-regexp-perl)
 	      nil t)
-	;; 2=package-group, 5=package-name 8=sub-name
+	;; 2=package-group, 5=package-name 9=sub-name
 	(cond
 	 ((and				; Skip some noise if building tags
 	   (match-beginning 5)		; package name
 	   ;;(eq (char-after (match-beginning 2)) ?p) ; package
-	   (not (save-match-data
-		  (looking-at "[ \t\n]*;")))) ; Plain text word 'package'
+	   (not (looking-at-p "[ \t\n]*;"))) ; Plain text word 'package'
 	  nil)
 	 ((and
 	   (or (match-beginning 2)
-	       (match-beginning 8))		; package or sub
+	       (match-beginning 9))		; package or sub
 	   ;; Skip if quoted (will not skip multi-line ''-strings :-():
 	   (null (get-text-property (match-beginning 1) 'syntax-table))
 	   (null (get-text-property (match-beginning 1) 'syntax-type))
@@ -5535,10 +5543,13 @@
 	  (if (and is-proto (not is-pack)) nil
 	    (or is-pack
 		(setq name
-		      (buffer-substring (match-beginning 8) (match-end 8)))
+		      (buffer-substring (match-beginning 9) (match-end 9)))
 		(set-text-properties 0 (length name) nil name))
 	    (setq marker (make-marker))
-	    (set-marker marker (match-end (if is-pack 2 8)))
+	    (set-marker marker (save-excursion
+                                 (goto-char (match-beginning (if is-pack 2 6)))
+                                 (skip-chars-forward " \t")
+                                 (point)))
 	    (cond (is-pack nil)
 		  ((string-match "[:']" name)
 		   (setq meth t))
@@ -5551,13 +5562,13 @@
 	      (push index index-alist))
 	    (if meth (push index index-meth-alist))
 	    (push index index-unsorted-alist)))
-	 ((match-beginning 16)		; POD section
-	  (setq name (buffer-substring (match-beginning 17) (match-end 17))
+	 ((and cperl-imenu-index-pod (match-beginning 17))	; POD section
+	  (setq name (buffer-substring (match-beginning 18) (match-end 18))
 		marker (make-marker))
-	  (set-marker marker (match-beginning 17))
+	  (set-marker marker (- (match-beginning 17) 5))
 	  (set-text-properties 0 (length name) nil name)
 	  (setq name (concat (make-string
-			      (* 3 (- (char-after (match-beginning 16)) ?1))
+			      (* 3 (- (char-after (match-beginning 17)) ?1))
 			      ?\ )
 			     name)
 		index (cons name marker))
@@ -5624,11 +5635,11 @@
 (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
+;;;; 2=package-group, 5=package-name 9=sub-name 17=head-level
 	((match-beginning 2) 0)		; package
-	((match-beginning 8) 1)		; sub
-	((match-beginning 16)
-	 (- (char-after (match-beginning 16)) ?0)) ; headN ==> N
+	((match-beginning 9) 1)		; sub
+	((match-beginning 17)
+	 (- (char-after (match-beginning 17)) ?0)) ; headN ==> N
 	(t 5)))				; should not happen
 
 \f

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWeeMVtkAD/D/gHk0gAL8////
/yXOj/////RgFD1b57t7R6N7ffN6x9WzU1kKA6+nVABUOfTc5vrbm93vbW+766PbdX1qWwkDQbbI
GglCEaammmk8U9GRT1T/SU2niU9T1D1Nqeo00eoeoAAaekBKTIAJo0UyRpPVM1PJM1NNAAGg0NAA
A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iYmm
onAE4nkTh9eErZJJfISp2iRfgQRtPaQq8BXPd2CiM2hDpArkJnpiJqY1XMVgA7hMFfRifaQJ63cc
RM/VJ+AlB9gmHDie0dJFQ5tBOcTnB+pNrnmK26tgcUjEVoMwEmOSGiGWJoJcEw8JoobBsCsHKJpE
8YnSJgFcAl0L0EfR3CaibRKB0CQKHaJGnfUGR0SBOwTehy6GX6RJ/ODqpkJiJoDj/8XckU4UJDnj
FbZA

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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-12 14:11                           ` Nathan Trapuzzano
@ 2013-11-12 17:49                             ` Jambunathan K
  2013-11-12 19:41                               ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-12 17:49 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848


Your patch looks good.  Thanks.

Before trying the patch, I had the "wrong" impression that headN lines
won't be displayed in 

    Perl->Tools->Imenu-POD headers menu entry.  

I see that Imenu still shows the perldoc headers.

So

    cperl-imenu-index-pod is a variable defined in `cperl-mode.el'.
    Its value is t

    Documentation:
    *Whether POD `=head' directives should be indexed by imenu.

the first line of the docstring is misleading.

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

Btw, if you are convinced that what this patch does is "the norm" rather
than "an exception", you may as well consider removing the variable.

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





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-12 17:49                             ` Jambunathan K
@ 2013-11-12 19:41                               ` Nathan Trapuzzano
  2013-11-13  5:14                                 ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-12 19:41 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Your patch looks good.  Thanks.
>
> Before trying the patch, I had the "wrong" impression that headN lines
> won't be displayed in 
>
>     Perl->Tools->Imenu-POD headers menu entry.  
>
> I see that Imenu still shows the perldoc headers.
>
> So
>
>     cperl-imenu-index-pod is a variable defined in `cperl-mode.el'.
>     Its value is t
>
>     Documentation:
>     *Whether POD `=head' directives should be indexed by imenu.
>
> the first line of the docstring is misleading.

Perhaps I misunderstand, but when I have that variable set to nil, the
POD imenu entries go away, which is what the docstring says.  Indeed,
which-function-mode uses the imenu index for determining which function
point is in.  I don't know how often which-function-mode calls the
indexing function, so make sure you have the variable set before
visiting the file.  Try again and let me know.

> ----------------------------------------------------------------
>
> Btw, if you are convinced that what this patch does is "the norm" rather
> than "an exception", you may as well consider removing the variable.
>
> ----------------------------------------------------------------

I do think it's better to say that the definitions begin earlier than
what cperl currently says (though it's not a "bug").  However, I think
indexing the POD entries by default is the better way for several
reasons:

1. cperl-mode already does it that way.
2. perl-mode does it.
3. There is no "pod-mode".  For editing pod files, perl-/cperl-mode is
   the best Emacs has.  Moreover, many people _do_ write plain pod
   files, in which case the entries should get indexed.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-12 19:41                               ` Nathan Trapuzzano
@ 2013-11-13  5:14                                 ` Jambunathan K
  2013-11-13 11:41                                   ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-13  5:14 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>>     Perl->Tools->Imenu-POD headers menu entry.  
>>     cperl-imenu-index-pod is a variable defined in `cperl-mode.el'.

> Perhaps I misunderstand, but when I have that variable set to nil, the
> POD imenu entries go away, which is what the docstring says. 

The behaviour is as documented.  I should have done something wrong
yesterday.

> However, I think indexing the POD entries by default is the better way
> for several reasons:
>
> 1. cperl-mode already does it that way.
> 2. perl-mode does it.
> 3. There is no "pod-mode".  For editing pod files, perl-/cperl-mode is
>    the best Emacs has.  Moreover, many people _do_ write plain pod
>    files, in which case the entries should get indexed.

Hmm.... Losing something to gain some thing else doesn't seem good to
me.

I cursorily looked at cperl-mode.  My gut feeling is that which-function
decides the box it is in by looking at the markers that is returned.  So
we may have to examine what value goes in to the marker.  

My recommendation would be to put the patch on hold.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-13  5:14                                 ` Jambunathan K
@ 2013-11-13 11:41                                   ` Nathan Trapuzzano
  2013-11-14  5:39                                     ` Jambunathan K
  0 siblings, 1 reply; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-13 11:41 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

> Hmm.... Losing something to gain some thing else doesn't seem good to
> me.

I don't follow. What's being lost?

> I cursorily looked at cperl-mode.  My gut feeling is that which-function
> decides the box it is in by looking at the markers that is returned.  So
> we may have to examine what value goes in to the marker.  

Yes, which-function just looks at the markers in the imenu index.
Changing those markers' positions is exactly what the patch does.





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-13 11:41                                   ` Nathan Trapuzzano
@ 2013-11-14  5:39                                     ` Jambunathan K
  2013-11-14 11:11                                       ` Nathan Trapuzzano
  0 siblings, 1 reply; 30+ messages in thread
From: Jambunathan K @ 2013-11-14  5:39 UTC (permalink / raw)
  To: Nathan Trapuzzano; +Cc: 15848

Nathan Trapuzzano <nbtrap@nbtrap.com> writes:

> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> Hmm.... Losing something to gain some thing else doesn't seem good to
>> me.
>
> I don't follow. What's being lost?

Indexing of =headNs

>> I cursorily looked at cperl-mode.  My gut feeling is that which-function
>> decides the box it is in by looking at the markers that is returned.  So
>> we may have to examine what value goes in to the marker.  
>
> Yes, which-function just looks at the markers in the imenu index.
> Changing those markers' positions is exactly what the patch does.

When POD headers are there, the Perl file is cut/segmented a certain
way.  When POD headers are not indexed, the Perl file is cut/segmented
differently.  Shouldn't we be cutting at the same spot with or without
perl headers?





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-14  5:39                                     ` Jambunathan K
@ 2013-11-14 11:11                                       ` Nathan Trapuzzano
  0 siblings, 0 replies; 30+ messages in thread
From: Nathan Trapuzzano @ 2013-11-14 11:11 UTC (permalink / raw)
  To: Jambunathan K; +Cc: 15848

Jambunathan K <kjambunathan@gmail.com> writes:

>> I don't follow. What's being lost?
>
> Indexing of =headNs

Optionally, and not by default.

> When POD headers are there, the Perl file is cut/segmented a certain
> way.  When POD headers are not indexed, the Perl file is cut/segmented
> differently.  Shouldn't we be cutting at the same spot with or without
> perl headers?

Can you give an example or another screenshot?  I'm not sure what you
mean about "segmenting".





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

* bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
  2013-11-10  6:58 bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case) Jambunathan K
  2013-11-10 11:51 ` Nathan Trapuzzano
@ 2013-11-15  5:16 ` Jambunathan K
  1 sibling, 0 replies; 30+ messages in thread
From: Jambunathan K @ 2013-11-15  5:16 UTC (permalink / raw)
  To: 15848-done


OP here.  Closed.





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

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

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10  6:58 bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case) Jambunathan K
2013-11-10 11:51 ` Nathan Trapuzzano
2013-11-10 13:06   ` Jambunathan K
2013-11-10 13:13     ` Jambunathan K
2013-11-10 15:51       ` Nathan Trapuzzano
2013-11-10 16:20         ` Jambunathan K
2013-11-10 16:48           ` Nathan Trapuzzano
2013-11-10 18:14             ` Nathan Trapuzzano
2013-11-11  7:20             ` Jambunathan K
2013-11-11 10:50               ` Nathan Trapuzzano
2013-11-11 11:09                 ` Jambunathan K
2013-11-11 11:18                   ` Nathan Trapuzzano
2013-11-11 11:31                     ` Jambunathan K
2013-11-11 11:43                       ` Jambunathan K
2013-11-11 15:03                       ` Nathan Trapuzzano
2013-11-12  5:23                         ` Jambunathan K
2013-11-12 14:11                           ` Nathan Trapuzzano
2013-11-12 17:49                             ` Jambunathan K
2013-11-12 19:41                               ` Nathan Trapuzzano
2013-11-13  5:14                                 ` Jambunathan K
2013-11-13 11:41                                   ` Nathan Trapuzzano
2013-11-14  5:39                                     ` Jambunathan K
2013-11-14 11:11                                       ` Nathan Trapuzzano
2013-11-10 18:04         ` Stefan Monnier
2013-11-10 22:12           ` Nathan Trapuzzano
2013-11-11  2:57           ` Leo Liu
2013-11-11  4:18             ` Stefan Monnier
2013-11-11 10:58               ` Nathan Trapuzzano
2013-11-11 10:54             ` Nathan Trapuzzano
2013-11-15  5:16 ` Jambunathan K

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