[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud da2f39d 011/140: Improve Debugger Info org-mode
From: |
Rocky Bernstein |
Subject: |
[elpa] externals/realgud da2f39d 011/140: Improve Debugger Info org-mode buffer |
Date: |
Sat, 25 May 2019 19:35:21 -0400 (EDT) |
branch: externals/realgud
commit da2f39d608cfc14fc2895e43bf9e4815bc96f7c6
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Improve Debugger Info org-mode buffer
- Elide entries initially
- Disable things that aren't set (for now)
- Format hash tables better
---
realgud/common/buffer/command.el | 84 ++++++++++++++++++++++++++++++++--------
1 file changed, 67 insertions(+), 17 deletions(-)
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index bd8aaca..7316c89 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -156,6 +156,40 @@
(insert "\n")
)))
+;;; JSON encoder
+
+(defun realgud:org-mode-encode (header object)
+ "Return an org-mode representation of OBJECT as an org-mode string."
+ (format "%s\n%s" header
+ (cond ((not object) "nil\n")
+ ;; ((stringp object) (realgud:org-mode-encodestring
object))
+ ;; ((keywordp object) (realgud:org-mode-encodestring
+ ;; (substring (symbol-name object) 1)))
+ ;;((symbolp object) (realgud:org-mode-encodestring
+ ;; (symbol-name object)))
+ ;; ((numberp object) (realgud:org-mode-encodenumber
object))
+ ;; ((arrayp object) (realgud:org-mode-encodearray object))
+ ((hash-table-p object) (realgud:org-mode-encode-htable object))
+ ;; ((listp object) (realgud:org-mode-encodelist object))
+ (t (signal 'error (list object))))))
+
+(defun realgud:org-mode-encode-htable (hash-table)
+ "Return an org-mode representation of HASH-TABLE as a s."
+ (format "%s"
+ (json-join
+ (let (r)
+ (maphash
+ (lambda (k v)
+ (push (format
+ " - %s\t: %s" k v)
+ r))
+ hash-table)
+ r)
+ "\n")))
+
+
+
+
(defun realgud:cmdbuf-info-describe (&optional buffer)
"Display realgud-cmdcbuf-info fields of BUFFER.
BUFFER is either a debugger command or source buffer. If BUFFER is not given
@@ -172,21 +206,25 @@ Information is put in an internal buffer called
*Describe*."
(switch-to-buffer (get-buffer-create "*Describe*"))
(setq buffer-read-only 'nil)
(delete-region (point-min) (point-max))
- (insert "#+STARTUP: showall\n")
;;(insert "#+OPTIONS: H:2 num:nil toc:t \\n:nil ::t |:t
^:nil -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc\n")
- (insert (format "#+TITLE: Debugger info for %s\n" cmdbuf-name))
- (insert "** General Information (")
- (insert-text-button
- "realgud-cmdbuf-info"
- ;; FIXME figure out how to set buffer to cmdbuf so we get
cmdbuf value
- 'action (lambda(button) (describe-variable
'realgud-cmdbuf-info))
- 'help-echo "mouse-2: help-on-variable")
- (insert ")\n")
+ (insert (format "#+TITLE: Debugger info for %s
+
+This is based on an org-mode buffer. Hit tab to expand/contract sections.
+\n"
+ cmdbuf-name))
+ (insert "** General Information (realgud-cmdbuf-info)\n")
+ ;; (insert "** General Information (")
+ ;; (insert-text-button
+ ;; "realgud-cmdbuf-info"
+ ;; ;; FIXME figure out how to set buffer to cmdbuf so we get
cmdbuf value
+ ;; 'action (lambda(button) (describe-variable
'realgud-cmdbuf-info))
+ ;; 'help-echo "mouse-2: help-on-variable")
+ ;; (insert ")\n")
(mapc 'insert
(list
(format " - Debugger name ::\t%s\n"
- (json-encode (realgud-cmdbuf-info-debugger-name
info)))
+ (realgud-cmdbuf-info-debugger-name info))
(format " - Command-line args ::\t%s\n"
(json-encode (realgud-cmdbuf-info-cmd-args
info)))
(format " - Starting directory ::\t%s\n"
@@ -197,19 +235,31 @@ Information is put in an internal buffer called
*Describe*."
(realgud-cmdbuf-info-last-input-end info))
(format " - Source should go into short-key mode? ::
%s\n"
(realgud-cmdbuf-info-src-shortkey? info))
- (format " - Breakpoint list ::\t %s\n"
- (realgud-cmdbuf-info-bp-list info))
- (format " - Remap table for debugger commands
::\n\t%s\n"
- (json-encode (realgud-cmdbuf-info-cmd-hash
info)))
- (format " - Backtrace buffer ::\t%s\n"
- (realgud-cmdbuf-info-bt-buf info))
+
(format " - In debugger? ::\t%s\n"
(realgud-cmdbuf-info-in-debugger? info))
+
+ ;; FIXME populate bp-list!
+ ;; (format " - Breakpoint list ::\t %s\n"
+ ;; (realgud-cmdbuf-info-bp-list info))
+ (realgud:org-mode-encode "\n*** Remap table for debugger
commands"
+
(realgud-cmdbuf-info-cmd-hash info))
+ ;; (format " - Remap table for debugger commands
::\n\t%s\n"
+ ;; (json-encode (realgud-cmdbuf-info-cmd-hash info)))
+ ;; (realgud:org-mode-encode "\n*** Backtrace buffer"
+ ;;
(realgud-cmdbuf-info-bt-buf info))
+ ;; (format " - Backtrace buffer ::\t%s\n"
+ ;; (realgud-cmdbuf-info-bt-buf info))
))
(insert "\n")
(realgud:cmdbuf-buffers-describe info)
- (insert "\n")
(realgud:loc-hist-describe (realgud-cmdbuf-info-loc-hist info))
+ (insert "
+#+STARTUP: overview
+ #+STARTUP: content
+ #+STARTUP: showall
+ #+STARTUP: showeverything
+")
(goto-char (point-min))
(realgud:info-mode)
)
- [elpa] externals/realgud 3f1b98f 010/140: (realgud:load-features) now features loaded, (continued)
- [elpa] externals/realgud 3f1b98f 010/140: (realgud:load-features) now features loaded, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 50dc7db 022/140: Info ..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud c7594f0 032/140: wrong 'let' syntax - caught thanks to the jodonnell's test!, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 37ba671 037/140: Comment better a track test, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud eeb4c2f 013/140: Bug in last commit., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 811e7b9 036/140: < -> <=. See comment before, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 2295d94 024/140: making eval print to the message area, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 83d471f 008/140: return the set of features removed, in realgud:unload-features(), Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f41b7a7 017/140: When a breakpoint is seen, add source..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 1f59502 021/140: Merge pull request #192 from dvzubarev/master, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud da2f39d 011/140: Improve Debugger Info org-mode buffer,
Rocky Bernstein <=
- [elpa] externals/realgud ecc78f1 012/140: Fix up breakpoint display, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 4a7f6ef 019/140: Fix infinite loop in realgud:backtrace-init, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 081f7ed 018/140: Expand script path where appropriate, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 1180d9f 028/140: add eval at point and bind it to E in shortkey mode, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f20f1e3 043/140: change E to put the thing at point in the eval buffer, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud e47abfb 044/140: Merge pull request #197 from jodonnell/eval-command, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud ce45b16 025/140: making join string not emacs 25 only, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud dc0e131 031/140: Guard against nil (realgud:get-command-name "eval"), Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud c64a4fd 039/140: Merge branch 'print', Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 2327213 026/140: adding tests for print to message area, Rocky Bernstein, 2019/05/25