branch: externals/emacs-gc-stats
commit 9687e1d80ae1f2aa6ef72d10e46c4db93cababfb
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    New customization: emacs-gc-stats-inhibit-command-name-logging
    
    * emacs-gc-stats.el (emacs-gc-stats-inhibit-command-name-logging): New
    custom variable.
    (emacs-gc-stats--collect): Avoid logging command names when the new
    variable is set.
---
 emacs-gc-stats.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/emacs-gc-stats.el b/emacs-gc-stats.el
index 7ff9f12fc9..bae18626d1 100644
--- a/emacs-gc-stats.el
+++ b/emacs-gc-stats.el
@@ -61,6 +61,11 @@ This setting, when non-nil, will override the existing 
values of
          (const :tag "Do not change existing GC settings" nil)
           (const :tag "Force emacs defaults" emacs-defaults)))
 
+(defcustom emacs-gc-stats-inhibit-command-name-logging nil
+  "When non-nil, do not collect command names (`this-command')."
+  :type 'boolean
+  :package-version '(emacs-gc-stats . 1.3))
+
 (defcustom emacs-gc-stats-setting-vars
   '(gc-cons-threshold
     gc-cons-percentage
@@ -116,7 +121,10 @@ Otherwise, collect symbol."
       (pcase var
         ((pred keywordp) (push var data))
         ((and (pred symbolp) (pred boundp))
-         (push (cons var (symbol-value var)) data))
+         (unless (and emacs-gc-stats-inhibit-command-name-logging
+                     (memq var '( this-command real-this-command
+                                  last-command real-last-command)))
+           (push (cons var (symbol-value var)) data)))
         ((pred functionp)
          (push (cons var (funcall var)) data))
         ((pred listp)

Reply via email to