Commit | Line | Data |
---|---|---|
a6ffc6a2 JB |
1 | # Set up something to print out s-expressions. |
2 | define pr | |
3 | set Fprin1 ($, Qexternal_debugging_output) | |
4 | echo \n | |
5 | end | |
a6ffc6a2 JB |
6 | document pr |
7 | Print the emacs s-expression which is $. | |
8 | Works only when an inferior emacs is executing. | |
9 | end | |
10 | ||
11 | define xtype | |
ef15f270 JB |
12 | output (enum Lisp_Type) (($ >> 24) & 0x7f) |
13 | echo \n | |
a6ffc6a2 | 14 | end |
e065a56e JB |
15 | document xtype |
16 | Print the type of $, assuming it is an Elisp value. | |
17 | end | |
a6ffc6a2 JB |
18 | |
19 | define xint | |
20 | print (($ & 0x00ffffff) << 8) >> 8 | |
21 | end | |
e065a56e JB |
22 | document xint |
23 | Print $, assuming it is an Elisp integer. This gets the sign right. | |
24 | end | |
a6ffc6a2 JB |
25 | |
26 | define xptr | |
27 | print (void *) ($ & 0x00ffffff) | |
28 | end | |
e065a56e JB |
29 | document xptr |
30 | Print the pointer portion of $, assuming it is an Elisp value. | |
31 | end | |
a6ffc6a2 JB |
32 | |
33 | define xwindow | |
34 | print (struct window *) ($ & 0x00ffffff) | |
ef15f270 | 35 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top |
a6ffc6a2 | 36 | end |
e065a56e JB |
37 | document xwindow |
38 | Print $ as a window pointer, assuming it is an Elisp window value. | |
ef15f270 | 39 | Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". |
e065a56e | 40 | end |
a6ffc6a2 JB |
41 | |
42 | define xmarker | |
43 | print (struct Lisp_Marker *) ($ & 0x00ffffff) | |
44 | end | |
e065a56e JB |
45 | document xmarker |
46 | Print $ as a marker pointer, assuming it is an Elisp marker value. | |
47 | end | |
a6ffc6a2 JB |
48 | |
49 | define xbuffer | |
50 | print (struct buffer *) ($ & 0x00ffffff) | |
ef15f270 JB |
51 | output &((struct Lisp_String *) (($->name) & 0x00ffffff))->data |
52 | echo \n | |
a6ffc6a2 | 53 | end |
e065a56e | 54 | document xbuffer |
daa37602 JB |
55 | Set $ as a buffer pointer, assuming it is an Elisp buffer value. |
56 | Print the name of the buffer. | |
e065a56e | 57 | end |
a6ffc6a2 JB |
58 | |
59 | define xsymbol | |
60 | print (struct Lisp_Symbol *) ($ & 0x00ffffff) | |
ef15f270 JB |
61 | output &$->name->data |
62 | echo \n | |
a6ffc6a2 | 63 | end |
e065a56e JB |
64 | document xsymbol |
65 | Print the name and address of the symbol $. | |
66 | This command assumes that $ is an Elisp symbol value. | |
67 | end | |
a6ffc6a2 JB |
68 | |
69 | define xstring | |
70 | print (struct Lisp_String *) ($ & 0x00ffffff) | |
ef15f270 JB |
71 | output ($->size > 10000) ? "big string" : ($->data[0])@($->size) |
72 | echo \n | |
a6ffc6a2 | 73 | end |
a6ffc6a2 | 74 | document xstring |
e065a56e JB |
75 | Print the contents and address of the string $. |
76 | This command assumes that $ is an Elisp string value. | |
a6ffc6a2 JB |
77 | end |
78 | ||
79 | define xvector | |
ef15f270 JB |
80 | print (struct Lisp_Vector *) ($ & 0x00ffffff) |
81 | output ($->size > 1000) ? "big vector" : ($->contents[0])@($->size) | |
82 | echo \n | |
a6ffc6a2 | 83 | end |
a6ffc6a2 | 84 | document xvector |
e065a56e JB |
85 | Print the contents and address of the vector $. |
86 | This command assumes that $ is an Elisp vector value. | |
a6ffc6a2 JB |
87 | end |
88 | ||
89 | define xscreen | |
90 | print (struct screen *) ($ & 0x00ffffff) | |
91 | end | |
e065a56e JB |
92 | document xwindow |
93 | Print $ as a screen pointer, assuming it is an Elisp screen value. | |
94 | end | |
a6ffc6a2 JB |
95 | |
96 | define xcons | |
97 | print (struct Lisp_Cons *) ($ & 0x00ffffff) | |
bd307392 | 98 | output *(struct Lisp_Cons *) ($ & 0x00ffffff) |
ef15f270 | 99 | echo \n |
a6ffc6a2 | 100 | end |
e065a56e JB |
101 | document xcons |
102 | Print the contents of $, assuming it is an Elisp cons. | |
103 | end | |
a6ffc6a2 JB |
104 | |
105 | define xcar | |
106 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->car : 0) | |
107 | end | |
e065a56e JB |
108 | document xcar |
109 | Print the car of $, assuming it is an Elisp pair. | |
110 | end | |
a6ffc6a2 JB |
111 | |
112 | define xcdr | |
113 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->cdr : 0) | |
114 | end | |
e065a56e JB |
115 | document xcdr |
116 | Print the cdr of $, assuming it is an Elisp pair. | |
117 | end | |
a6ffc6a2 | 118 | |
e065a56e | 119 | set print pretty on |
a6ffc6a2 | 120 | |
e5d77022 JB |
121 | unset environment TERMCAP |
122 | unset environment TERM | |
ef15f270 | 123 | echo TERMCAP and TERM environment variables unset.\n |
e5d77022 JB |
124 | show environment DISPLAY |
125 | set args -q | |
126 | ||
a6ffc6a2 JB |
127 | # Don't let abort actually run, as it will make |
128 | # stdio stop working and therefore the `pr' command below as well. | |
129 | break abort | |
130 | ||
131 | # If we are running in synchronous mode, we want a chance to look around | |
132 | # before Emacs exits. Perhaps we should put the break somewhere else | |
133 | # instead... | |
134 | break _XPrintDefaultError | |
135 |