annotate lisp/cedet/data-debug.el @ 112414:4b27e6d58d2c

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