unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nathan Trapuzzano <nbtrap@nbtrap.com>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: 15848@debbugs.gnu.org
Subject: bug#15848: 24.3.50; cperl-mode + which-function: Improve reporting (corner case)
Date: Sun, 10 Nov 2013 11:48:50 -0500	[thread overview]
Message-ID: <87d2m8w6bx.fsf@nbtrap.com> (raw)
In-Reply-To: <87txfkp6si.fsf@gmail.com> (Jambunathan K.'s message of "Sun, 10 Nov 2013 21:50:45 +0530")

[-- 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))
 		mar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8KHZOzjxc/FQ3k8bEukn8YNPbke
XHu8STVGBmNA7JobGsIpLICiHSadXDBzi02kDfRuJB5N0ApozSby0hIWzqakWWamqYsL+oeJLdA/
c8TtL467QcQOohYKQzsNyQxUg1hBkJk+OLg9KLa0upZvsl3gFZo/dZ+7Hfmfy6k/DJth5zVDqSXG
McyPdKR+eHWt+d5sPwSi2J3izvJfI7TMKnyiXSLF82Z/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

  reply	other threads:[~2013-11-10 16:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87d2m8w6bx.fsf@nbtrap.com \
    --to=nbtrap@nbtrap.com \
    --cc=15848@debbugs.gnu.org \
    --cc=kjambunathan@gmail.com \
    /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.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).