annotate etc/emacs-buffer.gdb @ 90325:9e9c44bc96d6

("Chinese-BIG5"): Set ctext-non-standard-encodings property to "big5-0". ("Chinese-GBK"): Set ctext-non-standard-encodings property to "gbk-0". Add sample-text property.
author Kenichi Handa <handa@m17n.org>
date Mon, 27 Feb 2006 01:27:35 +0000
parents b257be06d411
children 3d45362f1d38
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
1 # emacs-buffer.gdb --- gdb macros for recovering buffers from emacs coredumps
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
2
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
3 # Copyright (C) 2005, 2006 Free Software Foundation, Inc.
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
4
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
5 # Maintainer: Noah Friedman <friedman@splode.com>
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
6 # Status: Works with Emacs 22.0.51.1 (prerelease) as of 2006-01-12.
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
7 # Older cvs snapshots, and released versions, will not work due to
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
8 # changes in lisp data structures. But there are older versions of
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
9 # this gdb script which work with those versions.
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
10 # Created: 2005-04-28
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
11
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
12 # This file is part of GNU Emacs.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
13 #
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
14 # GNU Emacs is free software; you can redistribute it and/or modify
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
15 # it under the terms of the GNU General Public License as published by
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
16 # the Free Software Foundation; either version 2, or (at your option)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
17 # any later version.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
18 #
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
19 # GNU Emacs is distributed in the hope that it will be useful,
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
22 # GNU General Public License for more details.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
23 #
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
24 # You should have received a copy of the GNU General Public License
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
25 # along with GNU Emacs; see the file COPYING. If not, write to the
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
26 # Free Software Foundation, Inc.; 51 Franklin Street, Fifth Floor;
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
27 # Boston, MA 02110-1301, USA.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
28
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
29 # Commentary:
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
30
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
31 # This is a set of gdb macros for recovering the contents of buffers from
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
32 # an Emacs coredump; they may not always be file-backed or have a recent
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
33 # autosave.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
34 #
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
35 # The Emacs executable must have debugging symbols for this to work.
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
36 # But you never strip Emacs, right?
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
37 #
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
38 # The main commands of interest are `ybuffer-list', `yfile-buffers',
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
39 # `ysave-buffer', and `ybuffer-contents'. The `y' prefix avoids any
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
40 # namespace collisions with emacs/src/.gdbinit.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
41
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
42 # Example usage:
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
43 #
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
44 # $ gdb /export/src/emacs/2005-05-02--03-17/src/emacs core.emacs.6.9845
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
45 # Current directory is /u/noah/
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
46 # GNU gdb (6.1post-1.20040607.43rh)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
47 # ...
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
48 # #0 0x400007a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
49 # (gdb) source emacs-buffer.gdb
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
50 # (gdb) ybuffer-list
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
51 # B# M Size Name Mode File
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
52 # -- - ---- ---- ---- ----
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
53 # 0 * 556 mail to emacs-devel@gnu.org Mail
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
54 # 1 * 0 *Minibuf-1* Fundamental
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
55 # 2 145769 ChangeLog Change Log /u/noah/lib/elisp/noahf/ChangeLog
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
56 # 3 6619 ascii-table.el Elisp /u/noah/lib/elisp/noahf/ascii-table.el
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
57 # 4 * 48396 *Messages* Fundamental
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
58 # 5 3191 *Apropos* Apropos
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
59 # 6 17642 init-21.el Elisp /u/noah/etc/init/emacs/init-21.el
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
60 # 7 333 cpuid.c C /u/noah/cpuid.c
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
61 # 8 230 src Dired
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
62 # 9 218 noah Dired
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
63 # 10 * 21 *Echo Area 0* Fundamental
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
64 # 11 * 0 *Echo Area 1* Fundamental
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
65 # 12 319952 *bbdb data* Text /u/noah/.bbdb
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
66 # (gdb) ysave-buffer 0 mail.save
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
67 # [Wrote buffer "mail to emacs-devel@gnu.org" to file mail.save]
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
68 # (gdb) quit
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
69 # $ ls -l mail.save
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
70 # -rw-rw-rw- 1 noah user 556 May 2 04:05 mail.save
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
71 # $
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
72
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
73 # Code:
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
74
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
75 # Force loading of symbols, enough to give us gdb_valbits etc.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
76 set main
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
77
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
78 # When nonzero, display some extra diagnostics in various commands
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
79 set $yverbose = 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
80 set $yfile_buffers_only = 0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
81
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
82 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
83 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
84
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
85 define ygetptr
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
86 set $ptr = $arg0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
87 set $ptr = (gdb_use_union ? $ptr.u.val : $ptr & $valmask) | gdb_data_seg_bits
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
88 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
89
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
90 define ybuffer-list
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
91 set $files_only = $yfile_buffers_only
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
92 set $yfile_buffers_only = 0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
93
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
94 if $yverbose
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
95 printf "B# M Size Name Mode File\n"
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
96 printf "-- - ---- ---- ---- ----\n"
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
97 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
98
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
99 set $i = 0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
100 set $alist = Vbuffer_alist
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
101 while $alist != Qnil
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
102 ygetptr $alist
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
103 set $this = ((struct Lisp_Cons *) $ptr)->car
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
104 set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
105
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
106 # Vbuffer_alist elts are pairs of the form (name . buffer)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
107 ygetptr $this
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
108 set $buf = ((struct Lisp_Cons *) $ptr)->u.cdr
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
109 ygetptr $buf
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
110 set $buf = (struct buffer *) $ptr
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
111
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
112 if ! ($files_only && $buf->filename == Qnil)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
113 ygetptr $buf->name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
114 set $name = ((struct Lisp_String *) $ptr)->data
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
115 set $modp = ($buf->text->modiff > $buf->text->save_modiff) ? '*' : ' '
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
116
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
117 ygetptr $buf->mode_name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
118 set $mode = ((struct Lisp_String *) $ptr)->data
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
119
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
120 if $buf->filename != Qnil
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
121 ygetptr $buf->filename
63292
5ca9652ec98b (ybuffer-list): Don't use $filename; can't use char as placeholder when
Noah Friedman <friedman@splode.com>
parents: 62906
diff changeset
122 printf "%2d %c %9d %-20s %-10s %s\n", \
5ca9652ec98b (ybuffer-list): Don't use $filename; can't use char as placeholder when
Noah Friedman <friedman@splode.com>
parents: 62906
diff changeset
123 $i, $modp, ($buf->text->z_byte - 1), $name, $mode, \
5ca9652ec98b (ybuffer-list): Don't use $filename; can't use char as placeholder when
Noah Friedman <friedman@splode.com>
parents: 62906
diff changeset
124 ((struct Lisp_String *) $ptr)->data
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
125 else
63292
5ca9652ec98b (ybuffer-list): Don't use $filename; can't use char as placeholder when
Noah Friedman <friedman@splode.com>
parents: 62906
diff changeset
126 printf "%2d %c %9d %-20s %-10s\n", \
5ca9652ec98b (ybuffer-list): Don't use $filename; can't use char as placeholder when
Noah Friedman <friedman@splode.com>
parents: 62906
diff changeset
127 $i, $modp, ($buf->text->z_byte - 1), $name, $mode
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
128 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
129 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
130
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
131 set $i++
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
132 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
133 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
134 document ybuffer-list
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
135 Display a list of buffer names, sizes, and other attributes.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
136 The buffer number in the first column is used as an argument
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
137 to some other emacs-buffer recovery commands, e.g. `ysave-buffer'.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
138 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
139
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
140 define yfile-buffers
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
141 set $yfile_buffers_only = 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
142 ybuffer-list
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
143 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
144 document yfile-buffers
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
145 Display a list of buffers which are associated with files.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
146 This is like `ybuffer-list', but only buffers that were visiting files
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
147 are displayed.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
148 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
149
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
150 define yset-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
151 set $i = $arg0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
152
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
153 set $alist = Vbuffer_alist
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
154 while ($alist != Qnil && $i > 0)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
155 ygetptr $alist
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
156 set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
157 set $i--
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
158 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
159
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
160 # Get car of alist; this is a pair (name . buffer)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
161 ygetptr $alist
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
162 set $this = ((struct Lisp_Cons *) $ptr)->car
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
163
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
164 # Get the buffer object
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
165 ygetptr $this
68376
b257be06d411 Replace all references to `cdr' field of conses with `u.cdr',
Noah Friedman <friedman@splode.com>
parents: 63292
diff changeset
166 set $this = ((struct Lisp_Cons *) $ptr)->u.cdr
62894
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
167
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
168 ygetptr $this
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
169 set $ycurrent_buffer = (struct buffer *) $ptr
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
170 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
171 document yset-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
172 Set current buffer (for other emacs-buffer recovery commands) to the ARG'th
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
173 buffer as displayed by `ybuffer-list'.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
174 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
175
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
176 define yget-buffer-pointers
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
177 yset-buffer $arg0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
178 set $buf = $ycurrent_buffer->text
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
179
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
180 set $beg = $buf->beg
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
181 set $gap = $beg + $buf->gpt_byte
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
182 set $gap_end = $gap + $buf->gap_size - 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
183 set $end = $gap_end + ($buf->z_byte - $buf->gpt_byte)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
184
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
185 set $modp = $buf->modiff > $buf->save_modiff
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
186
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
187 #print *$beg@($gap - $beg)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
188 #print *$gap_end@($end - $gap_end)
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
189 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
190 document yget-buffer-pointers
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
191 Update convenience variables with address pointers for the ARG'th buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
192 as displayed by `ybuffer-list'.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
193
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
194 This also sets the current buffer using `yset-buffer' (which see).
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
195 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
196
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
197 define yget-current-buffer-name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
198 set $this = $ycurrent_buffer->name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
199 ygetptr $this
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
200 set $ycurrent_buffer_name = ((struct Lisp_String *) $ptr)->data
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
201 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
202 document yget-current-buffer-name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
203 Set $ycurrent_buffer_name to the name of the currently selected buffer.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
204 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
205
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
206 define ycurrent-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
207 yget-current-buffer-name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
208 printf "%s\n", $ycurrent_buffer_name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
209 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
210 document ycurrent-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
211 Display the currently selected buffer.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
212 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
213
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
214 define ydump-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
215 yget-buffer-pointers $arg0
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
216 if $buf->z_byte > 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
217 if $buf->z_byte <= $buf->gpt_byte
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
218 set $endptr = $beg + $buf->gpt_byte - 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
219 dump binary memory $arg1 $beg $endptr
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
220 else
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
221 dump binary memory $arg1 $beg $gap-1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
222 append binary memory $arg1 $gap_end $end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
223 set $endptr = $end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
224 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
225 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
226 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
227 document ydump-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
228 Write contents of buffer N (as numbered according to `ybuffer-list') to
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
229 file FILE.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
230
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
231 This is mainly used as an internal subroutine for `ysave-buffer' and
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
232 `ybuffer-contents', which see.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
233 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
234
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
235 define ysave-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
236 ydump-buffer $arg0 $arg1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
237 if $yverbose
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
238 yget-current-buffer-name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
239 if $buf->z_byte <= 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
240 printf "[Buffer \"%s\" is empty.]\n", $ycurrent_buffer_name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
241 else
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
242 # Output string broken into separate calls as necessary to avoid
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
243 # requiring a running process for evaluation.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
244 printf "[Wrote buffer \"%s\" to file ", $ycurrent_buffer_name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
245 echo $arg1]\n
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
246 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
247 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
248 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
249 document ysave-buffer
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
250 Save contents of buffer N (as numbered according to `ybuffer-list') to
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
251 file FILE.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
252 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
253
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
254 define ybuffer-contents
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
255 ydump-buffer $arg0 /dev/stdout
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
256 if $yverbose && $buf->z_byte <= 1
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
257 yget-current-buffer-name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
258 printf "[Buffer \"%s\" is empty.]\n", $ycurrent_buffer_name
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
259 else
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
260 if *($endptr-1) != '\n'
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
261 echo \n
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
262 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
263 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
264 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
265 document ybuffer-contents
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
266 Write contents of buffer N (numbered according to `ybuffer-list') to stdout.
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
267 end
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
268
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
269 # local variables:
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
270 # mode: gdb-script
62ff5829d7ff New file
Noah Friedman <friedman@splode.com>
parents:
diff changeset
271 # end:
62905
89c679e72586 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 62894
diff changeset
272
89c679e72586 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 62894
diff changeset
273 # arch-tag: 02087f62-2663-4868-977a-1fbb2fc2e7ef