[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud 1cc5ddc 59/72: add ability to show all locals i
From: |
Stefan Monnier |
Subject: |
[elpa] externals/realgud 1cc5ddc 59/72: add ability to show all locals in one command |
Date: |
Fri, 26 Mar 2021 22:49:13 -0400 (EDT) |
branch: externals/realgud
commit 1cc5ddc34cfc52ee3fb54642451ae445b5da2683
Author: 813 <813gan@protonmail.com>
Commit: 813 <813gan@protonmail.com>
add ability to show all locals in one command
This commits introduces
var realgud-immediately-show-all-locals,
realgud-locals-show-all-values and
realgud-locals-hide-all-values
---
realgud/common/buffer/locals.el | 35 +++++++++++++++++++++++++++++++----
realgud/common/custom.el | 5 +++++
realgud/common/locals-mode.el | 6 ++++--
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/realgud/common/buffer/locals.el b/realgud/common/buffer/locals.el
index 33ca741..3e918cd 100644
--- a/realgud/common/buffer/locals.el
+++ b/realgud/common/buffer/locals.el
@@ -98,16 +98,24 @@ LOCAL-VAR-NAME - variable to inspect"
(car (realgud-run-command-get-output 'realgud:cmd-info-type local-var-name))
(mapconcat 'identity (realgud-run-command-get-output
'realgud:cmd-info-value local-var-name) "\n") ))
-(defun realgud-locals-register-reload ()
- "Get list of local variables and load values selected by user."
+(defun realgud-locals-register-reload (&optional action)
+ "Get list of local variables and load values selected by user.
+
+If ACTION is set to 'showall unconditionally show all values.
+If ACTION is set to 'hideall hide all values."
(let* ((locals-names-list (realgud-run-command-get-output
'realgud:cmd-info-locals-name-list))
(frame-id 'frame_id_placeholder)
(locals-data-hash (realgud-get-info 'locals-data))
(frame-data-hash (gethash frame-id locals-data-hash))
(new-frame-data-hash (make-hash-table :test 'equal)))
+ ;; Iterate over list of variables and get values if user expanded values
in past
+ ;; or we are in this frame for first time, but
"realgud-immediately-show-all-locals" is t
+ ;; or function is called with ACTION argument
(dolist (local-var-name locals-names-list)
- (if (and frame-data-hash
- (gethash local-var-name frame-data-hash))
+ (if (and (not (eq action 'hideall))
+ (or (and frame-data-hash (gethash local-var-name frame-data-hash))
+ (and (not frame-data-hash) realgud-immediately-show-all-locals)
+ (eq action 'showall) ))
(puthash local-var-name
(realgud-locals-get-variable-data local-var-name)
new-frame-data-hash)
@@ -128,6 +136,25 @@ LOCAL-VAR-NAME - variable to toggle"
(puthash local-var-name value frame-data-hash) )
(realgud-locals-insert) )
+(defun realgud:locals-show-all-values ()
+ "Expand values of all variables."
+ ;; TODO in future this function should use separated debugger command that
would get all values
+ ;; in single call. Current implementation may be painful to use during
remote debugging
+ ;; in high latency networks.
+ (interactive)
+ (with-current-buffer-safe (realgud-get-cmdbuf)
+ (realgud-locals-register-reload 'showall)
+ (realgud-locals-insert) )
+ )
+
+(defun realgud:locals-hide-all-values ()
+ "Collapse values of all variables."
+ (interactive)
+ (with-current-buffer-safe (realgud-get-cmdbuf)
+ (realgud-locals-register-reload 'hideall)
+ (realgud-locals-insert) )
+ )
+
(defun realgud-locals-insert ()
"Serialize and format locales data."
(let ((frame-data-hash
diff --git a/realgud/common/custom.el b/realgud/common/custom.el
index 771bc31..ea69c3d 100644
--- a/realgud/common/custom.el
+++ b/realgud/common/custom.el
@@ -25,6 +25,11 @@ A setting of `nil` allows editing, but Short-Key-mode use
may inhibit this."
:type 'boolean
:group 'realgud)
+(defcustom realgud-immediately-show-all-locals t
+ "Immediately expand all values in locals window."
+ :type 'boolean
+ :group 'realgud)
+
(defcustom realgud-update-hook nil
"List of hooks to be run when debugger hits breakpoint"
:type 'hook
diff --git a/realgud/common/locals-mode.el b/realgud/common/locals-mode.el
index 4b3ec81..badc3b6 100644
--- a/realgud/common/locals-mode.el
+++ b/realgud/common/locals-mode.el
@@ -24,8 +24,10 @@
(let ((map (realgud-populate-debugger-menu (make-sparse-keymap))))
(suppress-keymap map)
(realgud-populate-common-keys map)
- (define-key map "q" 'realgud:cmd-quit)
- (define-key map "L" 'realgud:window-locals)
+ (define-key map "q" 'realgud:cmd-quit)
+ (define-key map "L" 'realgud:window-locals)
+ (define-key map "s" 'realgud:locals-show-all-values)
+ (define-key map "h" 'realgud:locals-hide-all-values)
map)
)
- [elpa] externals/realgud b0ff316 24/72: Travis has changed - attempted fix #6, (continued)
- [elpa] externals/realgud b0ff316 24/72: Travis has changed - attempted fix #6, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 9814710 25/72: Travis has changed - attempted fix #7, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 94f2835 31/72: Just another remake test, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 51f55ce 35/72: Try to fix travisCI, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 1238d8e 37/72: Fix bug when invalid debugger name ..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud e03446f 36/72: Merge pull request #265 from realgud/feature/comint-truncate-buffer, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 31a99d3 42/72: debbugers: Fix duplicate require-relative-list for ../../common/run., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 24c02f0 43/72: Merge pull request #272 from Apteryks/fix-unbound-realgud-run-process, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 96dada0 47/72: fix buffer type detection for locals., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 48c2562 54/72: Fix compilation error., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 1cc5ddc 59/72: add ability to show all locals in one command,
Stefan Monnier <=
- [elpa] externals/realgud 4a9c658 62/72: Add option to control orientation when splitting window., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 5abc55c 63/72: Merge pull request #285 from yangyingchao/feature/split-orientation, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 66f22b9 64/72: Avoid running y-n-prompt from inside minubuffer..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 5d83013 65/72: Add proper cleanup for locals. Fix broken logic from b5ee91c., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud a92335e 67/72: trepan2/3k re prompts & locals require..., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 4e4d1d2 70/72: fix issue: failed to load file buffer/locals., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud ff66001 71/72: Merge pull request #288 from yangyingchao/hotfix_failed_to_load_helper, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud b5ee91c 51/72: Introduce realgud-update-hook and add locals auto-refresh, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 42bb9af 53/72: Remove circular-causing require, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud bd1942e 60/72: Use list of variables as ID for frames, Stefan Monnier, 2021/03/26