Subject: Re: bug#13455: 24.2.91; profiler.el: missing documentation, menu stuff etc

From: [email-masked]
Date: Sun, 17 Jul 2016 01:14:16 -0400

tags 13455 patch
quit

Michael Heerdegen <[email-masked]> writes:

> (1) Add the main commands to the Emacs-Lisp -> Profiling menu
>   (presumably into a new submenu), so that people can find it.

It seems this was added in 24.4.

>
> (2) Missing commentary header.  At least say that it's documented in the
>   elisp manual.

There is now a comment pointing to the manual.

>
> (4) Add a menu for the profiler report.

As mentioned by Glenn, this is also present.

>
> (3) "If a given line has a `+' symbol at the left-hand side, you can
> expand that line by typing <RET>, in order to see the function(s) called
> by the higher-level function.  Pressing <RET> again will collapse back
> to the original state."
>
> Why not make mouse-1 do this, too?

This is still not the case, though it's easy enough to add.  Also, I'd
like to add mention of prefix arg for profiler-report-toggle-entry, I
was about make a feature request for an expand-all command, until I
realized this already worked.  Here's a patch:

>From c0100625ce2ab45f6980a221a02c7fc106818218 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Sun, 17 Jul 2016 00:21:42 -0400
Subject: [PATCH v1] Make profiler a bit friendier.

* doc/lispref/debugging.texi (Profiling):
* lisp/profiler.el (profiler-report-toggle-entry): Document use of
prefix argument to expand whole call trees.
(profiler-report-mode-map): Add mouse-1 binding for
profiler-report-toggle-entry (Bug #13455).
---
 doc/lispref/debugging.texi | 5 +++--
 lisp/profiler.el           | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 98c4705..2f83b40 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -840,8 +840,9 @@ Profiling
 absolute and percentage times since profiling started.  If a given
 line has a @samp{+} symbol at the left-hand side, you can expand that
 line by typing @key{RET}, in order to see the function(s) called by
-the higher-level function.  Pressing @key{RET} again will collapse
-back to the original state.
+the higher-level function.  Use a prefix argument (@key{C-u RET}) to
+see the whole call tree below a function.  Pressing @key{RET} again
+will collapse back to the original state.
 
 Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function.
 Press @kbd{d} to view a function's documentation.
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 401cae5..dac42fe 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -534,6 +534,7 @@ profiler-report-mode-map
     (define-key map "\r"    'profiler-report-toggle-entry)
     (define-key map "\t"    'profiler-report-toggle-entry)
     (define-key map "i"     'profiler-report-toggle-entry)
+    (define-key map [mouse-1] 'profiler-report-toggle-entry)
     (define-key map "f"     'profiler-report-find-entry)
     (define-key map "j"     'profiler-report-find-entry)
     (define-key map [mouse-2] 'profiler-report-find-entry)
@@ -692,7 +693,8 @@ profiler-report-collapse-entry
 
 (defun profiler-report-toggle-entry (&optional arg)
   "Expand entry at point if the tree is collapsed,
-otherwise collapse."
+otherwise collapse.  With prefix argument, expand all subentries
+below entry at point."
   (interactive "P")
   (or (profiler-report-expand-entry arg)
       (profiler-report-collapse-entry)))
-- 
2.8.0