Mercurial > emacs
annotate lisp/cedet/data-debug.el @ 104464:ee7637f5d6de
lisp/cedet/semantic/scope.el: Add local vars for autoloading.
(semantic-calculate-scope): Autoload.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 23:27:45 +0000 |
parents | da5b2513c225 |
children | 6ccad1511df1 |
rev | line source |
---|---|
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; data-debug.el --- Datastructure Debugger |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Version: 0.2 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: OO, lisp |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Provide a simple way to investigate particularly large and complex |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; data structures. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; The best way to get started is to bind M-: to 'data-debug-eval-expression. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; (global-set-key "\M-:" 'data-debug-eval-expression) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; If you write functions with complex output that need debugging, you |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; can make them interactive with data-debug-show-stuff. For example: |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; (defun my-complex-output-fcn () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; "Calculate something complicated at point, and return it." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; (interactive) ;; function not normally interactive |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; (let ((stuff (do-stuff))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; (when (interactive-p) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;; (data-debug-show-stuff stuff "myStuff")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;; stuff)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (require 'font-lock) |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104406
diff
changeset
|
45 (require 'ring) |
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104406
diff
changeset
|
46 (require 'eieio) |
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104406
diff
changeset
|
47 (eval-when-compile |
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104406
diff
changeset
|
48 (require 'semantic)) |
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104406
diff
changeset
|
49 |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;;; Code: |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;;; Compatibility |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (if (featurep 'xemacs) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (eval-and-compile |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (defalias 'data-debug-overlay-properties 'extent-properties) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 (defalias 'data-debug-overlay-p 'extentp) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (if (not (fboundp 'propertize)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (defun dd-propertize (string &rest properties) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "Mimic 'propertize' in from Emacs 23." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (add-text-properties 0 (length string) properties string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 string |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (defalias 'dd-propertize 'propertize)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 ;; Regular Emacs |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (eval-and-compile |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 (defalias 'data-debug-overlay-properties 'overlay-properties) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (defalias 'data-debug-overlay-p 'overlayp) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (defalias 'dd-propertize 'propertize) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ;;; GENERIC STUFF |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (defun data-debug-insert-property-list (proplist prefix &optional parent) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 "Insert the property list PROPLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 Each line starts with PREFIX. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 The attributes belong to the tag PARENT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (while proplist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (let ((pretext (concat (symbol-name (car proplist)) " : "))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (data-debug-insert-thing (car (cdr proplist)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 pretext |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 parent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (setq proplist (cdr (cdr proplist))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 ;;; overlays |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (defun data-debug-insert-overlay-props (overlay prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 "Insert all the parts of OVERLAY. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (proplist (data-debug-overlay-properties overlay))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (data-debug-insert-property-list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 proplist attrprefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (defun data-debug-insert-overlay-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 "Insert the overlay found at the overlay button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (let ((overlay (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (data-debug-insert-overlay-props overlay |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 "| ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (defun data-debug-insert-overlay-button (overlay prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 "Insert a button representing OVERLAY. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 PREBUTTONTEXT is some text between prefix and the overlay button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (str (format "%s" overlay)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (tip nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (put-text-property start end 'ddebug overlay) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 'data-debug-insert-overlay-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 ;;; overlay list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (defun data-debug-insert-overlay-list (overlaylist prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 "Insert all the parts of OVERLAYLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (while overlaylist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (data-debug-insert-overlay-button (car overlaylist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (setq overlaylist (cdr overlaylist)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (defun data-debug-insert-overlay-list-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 "Insert the overlay found at the overlay list button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (let ((overlaylist (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (data-debug-insert-overlay-list overlaylist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 "* ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (defun data-debug-insert-overlay-list-button (overlaylist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 "Insert a button representing OVERLAYLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 PREBUTTONTEXT is some text between prefix and the overlay list button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (str (format "#<overlay list: %d entries>" (length overlaylist))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (tip nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (put-text-property start end 'ddebug overlaylist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 'data-debug-insert-overlay-list-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 ;;; buffers |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (defun data-debug-insert-buffer-props (buffer prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 "Insert all the parts of BUFFER. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (proplist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (list :filename (buffer-file-name buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 :live (buffer-live-p buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 :modified (buffer-modified-p buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 :size (buffer-size buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 :process (get-buffer-process buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 :localvars (buffer-local-variables buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (data-debug-insert-property-list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 proplist attrprefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (defun data-debug-insert-buffer-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 "Insert the buffer found at the buffer button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (let ((buffer (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (data-debug-insert-buffer-props buffer |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 "| ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (defun data-debug-insert-buffer-button (buffer prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 "Insert a button representing BUFFER. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 PREBUTTONTEXT is some text between prefix and the buffer button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (str (format "%S" buffer)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (tip nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (put-text-property start end 'ddebug buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 'data-debug-insert-buffer-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 ;;; buffer list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (defun data-debug-insert-buffer-list (bufferlist prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 "Insert all the parts of BUFFERLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (while bufferlist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (data-debug-insert-buffer-button (car bufferlist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (setq bufferlist (cdr bufferlist)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (defun data-debug-insert-buffer-list-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 "Insert the buffer found at the buffer list button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (let ((bufferlist (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (data-debug-insert-buffer-list bufferlist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 "* ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (defun data-debug-insert-buffer-list-button (bufferlist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 "Insert a button representing BUFFERLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 PREBUTTONTEXT is some text between prefix and the buffer list button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (str (format "#<buffer list: %d entries>" (length bufferlist))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (tip nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (put-text-property start end 'ddebug bufferlist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 'data-debug-insert-buffer-list-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 ;;; processes |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (defun data-debug-insert-process-props (process prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 "Insert all the parts of PROCESS. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (let ((attrprefix (concat (make-string (length prefix) ? ) "# ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (id (process-id process)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (tty (process-tty-name process)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (pcontact (process-contact process t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (proplist (process-plist process))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (data-debug-insert-property-list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (append |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (if id (list 'id id)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (if tty (list 'tty tty)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (if pcontact pcontact) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 proplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 attrprefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (defun data-debug-insert-process-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 "Insert the process found at the process button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (let ((process (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (data-debug-insert-process-props process |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 "| ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (defun data-debug-insert-process-button (process prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 "Insert a button representing PROCESS. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 PREBUTTONTEXT is some text between prefix and the process button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (str (format "%S : %s" process (process-status process))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (tip nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (put-text-property (- end (length str)) end 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (put-text-property start end 'ddebug process) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 'data-debug-insert-process-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 ;;; Rings |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ;; A ring (like kill-ring, or whatever.) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (defun data-debug-insert-ring-contents (ring prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 "Insert all the parts of RING. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (let ((len (ring-length ring)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (idx 0) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (while (< idx len) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (data-debug-insert-thing (ring-ref ring idx) prefix "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (setq idx (1+ idx)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 ))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (defun data-debug-insert-ring-items-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 "Insert the ring found at the ring button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (let ((ring (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (data-debug-insert-ring-contents ring |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 "} ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (defun data-debug-insert-ring-button (ring |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 "Insert a button representing RING. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 PREBUTTONTEXT is some text between prefix and the stuff list button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 (let* ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (str (format "#<RING: %d, %d max>" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (ring-length ring) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (ring-size ring))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (ringthing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (if (= (ring-length ring) 0) nil (ring-ref ring 0))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (tip (format "Ring max-size %d, length %d. Full of: %S" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (ring-size ring) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (ring-length ring) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (cond ((stringp ringthing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 "strings") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 ((semantic-tag-p ringthing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 "tags") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 ((eieio-object-p ringthing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 "eieio objects") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 ((listp ringthing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 "List of somethin'") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (t "stuff")))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (put-text-property (- end (length str)) end 'face 'font-lock-type-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 (put-text-property start end 'ddebug ring) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 (put-text-property start end 'ddebug-indent(length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 'data-debug-insert-ring-items-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 ;;; Hash-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (defun data-debug-insert-hash-table (hash-table prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 "Insert the contents of HASH-TABLE inserting PREFIX before each element." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 (maphash |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (lambda (key value) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (data-debug-insert-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 key prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (dd-propertize "key " 'face font-lock-comment-face)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 (data-debug-insert-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 value prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (dd-propertize "val " 'face font-lock-comment-face))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 hash-table)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (defun data-debug-insert-hash-table-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 "Insert the contents of the hash-table button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (let ((hash-table (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (data-debug-insert-hash-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 hash-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (concat (make-string indent ? ) "> ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (goto-char start)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 (defun data-debug-insert-hash-table-button (hash-table prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 "Insert HASH-TABLE as expandable button with recursive prefix PREFIX and PREBUTTONTEXT in front of the button text." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 (let ((string (dd-propertize (format "%s" hash-table) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 'face 'font-lock-keyword-face))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 (insert (dd-propertize |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 (concat prefix prebuttontext string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 'ddebug hash-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 'ddebug-indent (length prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 'ddebug-prefix prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 'help-echo |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (format "Hash-table\nTest: %s\nWeakness: %s\nElements: %d (of %d)" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 (hash-table-test hash-table) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (if (hash-table-weakness hash-table) "yes" "no") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (hash-table-count hash-table) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (hash-table-size hash-table)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 'data-debug-insert-hash-table-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 "\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 ;;; Widget |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 ;; Widgets have a long list of properties |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (defun data-debug-insert-widget-properties (widget prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 "Insert the contents of WIDGET inserting PREFIX before each element." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (let ((type (car widget)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (rest (cdr widget))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (while rest |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (data-debug-insert-thing (car (cdr rest)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 (concat |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (dd-propertize (format "%s" (car rest)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 'face font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 " : ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (setq rest (cdr (cdr rest)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 (defun data-debug-insert-widget-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 "Insert the contents of the widget button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (let ((widget (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 (data-debug-insert-widget-properties |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 widget (concat (make-string indent ? ) "# ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (goto-char start)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (defun data-debug-insert-widget (widget prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 "Insert one WIDGET. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 A Symbol is a simple thing, but this provides some face and prefix rules. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 PREBUTTONTEXT is some text between prefix and the thing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (let ((string (dd-propertize (format "#<WIDGET %s>" (car widget)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 'face 'font-lock-keyword-face))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (insert (dd-propertize |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 (concat prefix prebuttontext string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 'ddebug widget |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 'ddebug-indent (length prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 'ddebug-prefix prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 'help-echo |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (format "Widget\nType: %s\n# Properties: %d" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (car widget) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (/ (1- (length widget)) 2)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 'data-debug-insert-widget-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 "\n"))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 ;;; list of stuff |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 ;; just a list. random stuff inside. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (defun data-debug-insert-stuff-list (stufflist prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 "Insert all the parts of STUFFLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (while stufflist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (data-debug-insert-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 ;; Some lists may put a value in the CDR |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (if (listp stufflist) (car stufflist) stufflist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (setq stufflist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (if (listp stufflist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (cdr-safe stufflist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 nil)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 (defun data-debug-insert-stuff-list-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 "Insert the stuff found at the stuff list button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 (let ((stufflist (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (data-debug-insert-stuff-list stufflist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 "> ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 (defun data-debug-insert-stuff-list-button (stufflist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 "Insert a button representing STUFFLIST. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 PREBUTTONTEXT is some text between prefix and the stuff list button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (str |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (condition-case nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 (format "#<list o' stuff: %d entries>" (safe-length stufflist)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (error "#<list o' stuff>"))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (tip (if (or (listp (car stufflist)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (vectorp (car stufflist))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 "" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (format "%s" stufflist)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 (put-text-property (- end (length str)) end 'face 'font-lock-variable-name-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (put-text-property start end 'ddebug stufflist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 (put-text-property start end 'ddebug-indent (length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 'data-debug-insert-stuff-list-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 ;;; vector of stuff |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 ;; just a vector. random stuff inside. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 (defun data-debug-insert-stuff-vector (stuffvector prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 "Insert all the parts of STUFFVECTOR. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 PREFIX specifies what to insert at the start of each line." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 (let ((idx 0)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 (while (< idx (length stuffvector)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 (data-debug-insert-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 ;; Some vectors may put a value in the CDR |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 (aref stuffvector idx) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (setq idx (1+ idx))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (defun data-debug-insert-stuff-vector-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 "Insert the stuff found at the stuff vector button at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (let ((stuffvector (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 start |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (data-debug-insert-stuff-vector stuffvector |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (concat (make-string indent ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 "[ ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (goto-char start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (defun data-debug-insert-stuff-vector-button (stuffvector |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 "Insert a button representing STUFFVECTOR. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 PREBUTTONTEXT is some text between prefix and the stuff vector button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 (let* ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 (str (format "#<vector o' stuff: %d entries>" (length stuffvector))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 (tip str)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 (insert prefix prebuttontext str) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 (put-text-property (- end (length str)) end 'face 'font-lock-variable-name-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 (put-text-property start end 'ddebug stuffvector) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 (put-text-property start end 'ddebug-indent (length prefix)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 (put-text-property start end 'ddebug-prefix prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 (put-text-property start end 'help-echo tip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 (put-text-property start end 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 'data-debug-insert-stuff-vector-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 ;;; Symbol |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (defun data-debug-insert-symbol-from-point (point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 "Insert attached properties and possibly the value of symbol at POINT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 (let ((symbol (get-text-property point 'ddebug)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 (indent (get-text-property point 'ddebug-indent)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 start) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 (setq start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 (when (and (not (fboundp symbol)) (boundp symbol)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 (data-debug-insert-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (symbol-value symbol) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 (concat (make-string indent ? ) "> ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (concat |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 (dd-propertize "value" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 'face 'font-lock-comment-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 " "))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 (data-debug-insert-property-list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 (symbol-plist symbol) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 (concat (make-string indent ? ) "> ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 (goto-char start)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 (defun data-debug-insert-symbol-button (symbol prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 "Insert a button representing SYMBOL. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 PREBUTTONTEXT is some text between prefix and the symbol button." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 (let ((string |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 (cond ((fboundp symbol) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (dd-propertize (concat "#'" (symbol-name symbol)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 'face 'font-lock-function-name-face)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 ((boundp symbol) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 (dd-propertize (concat "'" (symbol-name symbol)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 'face 'font-lock-variable-name-face)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 (t (format "'%s" symbol))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 (insert (dd-propertize |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 (concat prefix prebuttontext string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 'ddebug symbol |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 'ddebug-indent (length prefix) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 'ddebug-prefix prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 'help-echo "" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 'ddebug-function |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 'data-debug-insert-symbol-from-point) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 "\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 ;;; String |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 (defun data-debug-insert-string (thing prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 "Insert one symbol THING. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 A Symbol is a simple thing, but this provides some face and prefix rules. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 PREBUTTONTEXT is some text between prefix and the thing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 (let ((newstr thing)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (while (string-match "\n" newstr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 (setq newstr (replace-match "\\n" t t newstr))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 (while (string-match "\t" newstr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (setq newstr (replace-match "\\t" t t newstr))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (insert prefix prebuttontext |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 (dd-propertize (format "\"%s\"" newstr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 'face font-lock-string-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 "\n" ))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 ;;; Number |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 (defun data-debug-insert-number (thing prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 "Insert one symbol THING. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 A Symbol is a simple thing, but this provides some face and prefix rules. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 PREBUTTONTEXT is some text between prefix and the thing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 (insert prefix prebuttontext |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 (dd-propertize (format "%S" thing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 'face font-lock-string-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 "\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 ;;; Lambda Expression |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 (defun data-debug-insert-lambda-expression (thing prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 "Insert one lambda expression THING. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 A Symbol is a simple thing, but this provides some face and prefix rules. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 PREBUTTONTEXT is some text between prefix and the thing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 (let ((txt (prin1-to-string thing))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 (data-debug-insert-simple-thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 txt prefix prebuttontext 'font-lock-keyword-face)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 ;;; nil thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 (defun data-debug-insert-nil (thing prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 "Insert one simple THING with a face. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 PREBUTTONTEXT is some text between prefix and the thing. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 FACE is the face to use." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 (insert prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 (insert ": ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 (end nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 (insert "nil") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 (insert "\n" ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
726 (put-text-property start end 'face 'font-lock-variable-name-face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 ;;; simple thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 (defun data-debug-insert-simple-thing (thing prefix prebuttontext face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 "Insert one simple THING with a face. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 PREBUTTONTEXT is some text between prefix and the thing. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 FACE is the face to use." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 (insert prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 (end nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 (insert (format "%s" thing)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 (insert "\n" ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 (put-text-property start end 'face face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 ;;; custom thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 (defun data-debug-insert-custom (thingstring prefix prebuttontext face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 "Insert one simple THINGSTRING with a face. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 Use for simple items that need a custom insert. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 PREFIX is the text that preceeds the button. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 PREBUTTONTEXT is some text between prefix and the thing. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 FACE is the face to use." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 (insert prefix prebuttontext) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 (end nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 (insert thingstring) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 (insert "\n" ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 (put-text-property start end 'face face) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 (defvar data-debug-thing-alist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 '( |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 ;; nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 (null . data-debug-insert-nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 ;; eieio object |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 ((lambda (thing) (object-p thing)) . data-debug-insert-object-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 ;; tag |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 (semantic-tag-p . data-debug-insert-tag) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 ;; taglist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 ((lambda (thing) (and (listp thing) (semantic-tag-p (car thing)))) . |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 data-debug-insert-tag-list-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 ;; find results |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 (semanticdb-find-results-p . data-debug-insert-find-results-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 ;; Elt of a find-results |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 ((lambda (thing) (and (listp thing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 (semanticdb-abstract-table-child-p (car thing)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 (semantic-tag-p (cdr thing)))) . |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 data-debug-insert-db-and-tag-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 ;; Overlay |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 (data-debug-overlay-p . data-debug-insert-overlay-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 ;; Overlay list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 ((lambda (thing) (and (consp thing) (data-debug-overlay-p (car thing)))) . |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 data-debug-insert-overlay-list-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 ;; Buffer |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 (bufferp . data-debug-insert-buffer-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 ;; Buffer list |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 ((lambda (thing) (and (consp thing) (bufferp (car thing)))) . |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 data-debug-insert-buffer-list-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 ;; Process |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 (processp . data-debug-insert-process-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 ;; String |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (stringp . data-debug-insert-string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 ;; Number |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (numberp . data-debug-insert-number) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 ;; Symbol |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 (symbolp . data-debug-insert-symbol-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 ;; Ring |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 (ring-p . data-debug-insert-ring-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 ;; Lambda Expression |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 ((lambda (thing) (and (consp thing) (eq (car thing) 'lambda))) . |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 data-debug-insert-lambda-expression) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 ;; Hash-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 (hash-table-p . data-debug-insert-hash-table-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 ;; Widgets |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 (widgetp . data-debug-insert-widget) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 ;; List of stuff |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 (listp . data-debug-insert-stuff-list-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 ;; Vector of stuff |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 (vectorp . data-debug-insert-stuff-vector-button) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 "Alist of methods used to insert things into an Ddebug buffer.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 ;; uber insert method |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 (defun data-debug-insert-thing (thing prefix prebuttontext &optional parent) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
834 "Insert THING with PREFIX. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
835 PREBUTTONTEXT is some text to insert between prefix and the thing |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
836 that is not included in the indentation calculation of any children. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
837 If PARENT is non-nil, it is somehow related as a parent to thing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
838 (when (catch 'done |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
839 (dolist (test data-debug-thing-alist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 (when (funcall (car test) thing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
841 (condition-case nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 (funcall (cdr test) thing prefix prebuttontext parent) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 (error |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
844 (funcall (cdr test) thing prefix prebuttontext))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
845 (throw 'done nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
846 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
847 nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 (data-debug-insert-simple-thing (format "%S" thing) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
849 prefix |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
850 prebuttontext |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
851 'bold))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
852 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
853 ;;; MAJOR MODE |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
854 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
855 ;; The Ddebug major mode provides an interactive space to explore |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
856 ;; the current state of semantic's parsing and analysis |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
857 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
858 (defgroup data-debug nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
859 "data-debug group." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
860 :group 'langauges) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
861 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
862 (defvar data-debug-mode-syntax-table |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
863 (let ((table (make-syntax-table (standard-syntax-table)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
864 (modify-syntax-entry ?\; ". 12" table) ;; SEMI, Comment start ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
865 (modify-syntax-entry ?\n ">" table) ;; Comment end |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
866 (modify-syntax-entry ?\" "\"" table) ;; String |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
867 (modify-syntax-entry ?\- "_" table) ;; Symbol |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
868 (modify-syntax-entry ?\\ "\\" table) ;; Quote |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
869 (modify-syntax-entry ?\` "'" table) ;; Prefix ` (backquote) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
870 (modify-syntax-entry ?\' "'" table) ;; Prefix ' (quote) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
871 (modify-syntax-entry ?\, "'" table) ;; Prefix , (comma) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
872 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
873 table) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
874 "Syntax table used in data-debug macro buffers.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
875 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
876 (defvar data-debug-map |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
877 (let ((km (make-sparse-keymap))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
878 (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
879 (define-key km " " 'data-debug-expand-or-contract) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
880 (define-key km "\C-m" 'data-debug-expand-or-contract) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 (define-key km "n" 'data-debug-next) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 (define-key km "p" 'data-debug-prev) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 (define-key km "N" 'data-debug-next-expando) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 (define-key km "P" 'data-debug-prev-expando) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 km) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 "Keymap used in data-debug.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
887 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 (defcustom data-debug-mode-hook nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 "*Hook run when data-debug starts." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 :group 'data-debug |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 :type 'hook) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 (defun data-debug-mode () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 "Major-mode for the Analyzer debugger. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 \\{data-debug-map}" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
898 (kill-all-local-variables) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
899 (setq major-mode 'data-debug-mode |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 mode-name "DATA-DEBUG" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
901 comment-start ";;" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
902 comment-end "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 (set (make-local-variable 'comment-start-skip) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (set-syntax-table data-debug-mode-syntax-table) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 (use-local-map data-debug-map) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 (run-hooks 'data-debug-hook) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
908 (buffer-disable-undo) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 (set (make-local-variable 'font-lock-global-modes) nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
910 (font-lock-mode -1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 ;;;###autoload |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 (defun data-debug-new-buffer (name) |
104406
399d233ddb97
data-debug.el: Remove unnecessary autoloads.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
915 "Create a new data-debug buffer with NAME." |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 (let ((b (get-buffer-create name))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 (pop-to-buffer b) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
918 (set-buffer b) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
919 (erase-buffer) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
920 (data-debug-mode) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
921 b)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 ;;; Ddebug mode commands |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
924 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
925 (defun data-debug-next () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
926 "Go to the next line in the Ddebug buffer." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
927 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
928 (forward-line 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
929 (beginning-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
930 (skip-chars-forward " *-><[]" (point-at-eol))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
931 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
932 (defun data-debug-prev () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
933 "Go to the next line in the Ddebug buffer." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
934 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
935 (forward-line -1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
936 (beginning-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
937 (skip-chars-forward " *-><[]" (point-at-eol))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
938 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
939 (defun data-debug-next-expando () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
940 "Go to the next line in the Ddebug buffer. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
941 Contract the current line (if open) and expand the line |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
942 we move to." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
943 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
944 (data-debug-contract-current-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
945 (data-debug-next) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
946 (data-debug-expand-current-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
947 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
948 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
949 (defun data-debug-prev-expando () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
950 "Go to the previous line in the Ddebug buffer. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
951 Contract the current line (if open) and expand the line |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 we move to." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
953 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 (data-debug-contract-current-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 (data-debug-prev) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 (data-debug-expand-current-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 (defun data-debug-current-line-expanded-p () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 "Return non-nil if the current line is expanded." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (let ((ti (current-indentation)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 (ni (condition-case nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 (save-excursion |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
965 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
966 (current-indentation)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 (error 0)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
968 (> ni ti))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
970 (defun data-debug-line-expandable-p () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 "Return non-nil if the current line is expandable. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 Lines that are not expandable are assumed to not be contractable." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 (not (get-text-property (point) 'ddebug-noexpand))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 (defun data-debug-expand-current-line () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
976 "Expand the current line (if possible). |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 Do nothing if already expanded." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
978 (when (or (not (data-debug-line-expandable-p)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
979 (not (data-debug-current-line-expanded-p))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
980 ;; If the next line is the same or less indentation, expand. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
981 (let ((fcn (get-text-property (point) 'ddebug-function))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
982 (when fcn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
983 (funcall fcn (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
984 (beginning-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
985 )))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
986 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
987 (defun data-debug-contract-current-line () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
988 "Contract the current line (if possible). |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
989 Do nothing if already expanded." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 (when (and (data-debug-current-line-expanded-p) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 ;; Don't contract if the current line is not expandable. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 (get-text-property (point) 'ddebug-function)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 (let ((ti (current-indentation)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
995 ;; If next indentation is larger, collapse. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
996 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 (forward-char 1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
998 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
999 (end nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 (condition-case nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1001 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 ;; Keep checking indentation |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 (while (or (> (current-indentation) ti) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1004 (looking-at "^\\s-*$")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1005 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1006 (forward-char 1)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1007 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1008 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1009 (error (setq end (point-max)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1010 (delete-region start end) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1011 (forward-char -1) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1012 (beginning-of-line))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1013 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1014 (defun data-debug-expand-or-contract () |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1015 "Expand or contract anything at the current point." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1016 (interactive) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1017 (if (and (data-debug-line-expandable-p) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1018 (data-debug-current-line-expanded-p)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1019 (data-debug-contract-current-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1020 (data-debug-expand-current-line)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1021 (skip-chars-forward " *-><[]" (point-at-eol))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1022 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1023 (defun data-debug-expand-or-contract-mouse (event) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1024 "Expand or contract anything at event EVENT." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1025 (interactive "e") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1026 (let* ((win (car (car (cdr event)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1027 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1028 (select-window win t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1029 (save-excursion |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1030 ;(goto-char (window-start win)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1031 (mouse-set-point event) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1032 (data-debug-expand-or-contract)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1033 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1034 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1035 ;;; GENERIC STRUCTURE DUMP |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1036 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1037 (defun data-debug-show-stuff (stuff name) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1038 "Data debug STUFF in a buffer named *NAME DDebug*." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1039 (data-debug-new-buffer (concat "*" name " DDebug*")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1040 (data-debug-insert-thing stuff "?" "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1041 (goto-char (point-min)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1042 (when (data-debug-line-expandable-p) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1043 (data-debug-expand-current-line))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1044 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1045 ;;; DEBUG COMMANDS |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1046 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1047 ;; Various commands to output aspects of the current semantic environment. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1048 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1049 (defun data-debug-edebug-expr (expr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1050 "Dump out the contets of some expression EXPR in edebug with ddebug." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1051 (interactive |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1052 (list (let ((minibuffer-completing-symbol t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1053 (read-from-minibuffer "Eval: " |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1054 nil read-expression-map t |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1055 'read-expression-history)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1056 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1057 (let ((v (eval expr))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1058 (if (not v) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1059 (message "Expression %s is nil." expr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1060 (data-debug-show-stuff v "expression")))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1061 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1062 (defun data-debug-eval-expression (expr) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1063 "Evaluate EXPR and display the value. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1064 If the result is something simple, show it in the echo area. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1065 If the result is a list or vector, then use the data debugger to display it." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1066 (interactive |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1067 (list (let ((minibuffer-completing-symbol t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1068 (read-from-minibuffer "Eval: " |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1069 nil read-expression-map t |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1070 'read-expression-history)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1071 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1072 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1073 (if (null eval-expression-debug-on-error) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1074 (setq values (cons (eval expr) values)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1075 (let ((old-value (make-symbol "t")) new-value) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1076 ;; Bind debug-on-error to something unique so that we can |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1077 ;; detect when evaled code changes it. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1078 (let ((debug-on-error old-value)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1079 (setq values (cons (eval expr) values)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1080 (setq new-value debug-on-error)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1081 ;; If evaled code has changed the value of debug-on-error, |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1082 ;; propagate that change to the global binding. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1083 (unless (eq old-value new-value) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1084 (setq debug-on-error new-value)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1085 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1086 (if (or (consp (car values)) (vectorp (car values))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1087 (let ((v (car values))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1088 (data-debug-show-stuff v "Expression")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1089 ;; Old style |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1090 (prog1 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1091 (prin1 (car values) t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1092 (let ((str (eval-expression-print-format (car values)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1093 (if str (princ str t)))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1094 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1095 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1096 (provide 'data-debug) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1097 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1098 ;;; data-debug.el ends here |