branch: elpa/flamegraph
commit 46d94e2a063d67a0bd63443e4e4b99f31766ad95
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
flamegraph--echo: Don't, unless the current message was from us as well
(It's on post-command-hook)
---
flamegraph.el | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/flamegraph.el b/flamegraph.el
index 2e13396771..dbf9845174 100644
--- a/flamegraph.el
+++ b/flamegraph.el
@@ -345,17 +345,24 @@ outermost frames.")
(interactive)
(flamegraph--draw))
+(defvar-local flamegraph--last-echo nil
+ "Last message shown by `flamegraph--echo'.")
+
(defun flamegraph--echo ()
- "Show information about the frame at point in the echo area."
- (let ((frame (flamegraph--frame-at-point)))
- (when frame
+ "Show information about the frame at point in the echo area.
+Do nothing when the echo area already shows an unrelated message."
+ (let ((current (current-message))
+ (frame (flamegraph--frame-at-point)))
+ (when (and frame (or (null current) (equal current flamegraph--last-echo)))
(let* ((node (flamegraph-frame-node frame))
- (count (profiler-calltree-count node)))
- (message "%s %s %s (%s of total)"
- (flamegraph--entry-name (profiler-calltree-entry node))
- (profiler-format-number count)
- flamegraph--unit
- (flamegraph--percent count flamegraph--grand-total))))))
+ (count (profiler-calltree-count node))
+ (msg (format "%s %s %s (%s of total)"
+ (flamegraph--entry-name (profiler-calltree-entry
node))
+ (profiler-format-number count)
+ flamegraph--unit
+ (flamegraph--percent count
flamegraph--grand-total))))
+ (setq flamegraph--last-echo msg)
+ (message "%s" msg)))))
;;; Mode