diff options
| author | Richard M. Stallman | 1998-03-28 21:50:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-28 21:50:59 +0000 |
| commit | 4c315bdabd2270964b4054dce2d9f52f018bcb3a (patch) | |
| tree | 7468748b29cf0430d34898605292da53fcd11e76 /src/alloc.c | |
| parent | b50f6283db965303f3c7d2ac0950e0a725af8c05 (diff) | |
| download | emacs-4c315bdabd2270964b4054dce2d9f52f018bcb3a.tar.gz emacs-4c315bdabd2270964b4054dce2d9f52f018bcb3a.zip | |
(mark_buffer): Mark the undo_list slot specially;
don't mark a marker just cause it is in this list.
(Fgarbage_collect): Discard from all undo-lists
all elements that adjust markers that were not marked.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 47fa6820102..be4c82d0a1e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1816,6 +1816,46 @@ Garbage collection happens automatically if you cons more than\n\ | |||
| 1816 | } | 1816 | } |
| 1817 | mark_kboards (); | 1817 | mark_kboards (); |
| 1818 | 1818 | ||
| 1819 | /* Look thru every buffer's undo list | ||
| 1820 | for elements that update markers that were not marked, | ||
| 1821 | and delete them. */ | ||
| 1822 | { | ||
| 1823 | register struct buffer *nextb = all_buffers; | ||
| 1824 | |||
| 1825 | while (nextb) | ||
| 1826 | { | ||
| 1827 | /* If a buffer's undo list is Qt, that means that undo is | ||
| 1828 | turned off in that buffer. Calling truncate_undo_list on | ||
| 1829 | Qt tends to return NULL, which effectively turns undo back on. | ||
| 1830 | So don't call truncate_undo_list if undo_list is Qt. */ | ||
| 1831 | if (! EQ (nextb->undo_list, Qt)) | ||
| 1832 | { | ||
| 1833 | Lisp_Object tail, prev; | ||
| 1834 | tail = nextb->undo_list; | ||
| 1835 | prev = Qnil; | ||
| 1836 | while (CONSP (tail)) | ||
| 1837 | { | ||
| 1838 | if (GC_CONSP (XCONS (tail)->car) | ||
| 1839 | && GC_MARKERP (XCONS (XCONS (tail)->car)->car) | ||
| 1840 | && ! XMARKBIT (XMARKER (XCONS (XCONS (tail)->car)->car)->chain)) | ||
| 1841 | { | ||
| 1842 | if (NILP (prev)) | ||
| 1843 | nextb->undo_list = tail = XCONS (tail)->cdr; | ||
| 1844 | else | ||
| 1845 | tail = XCONS (prev)->cdr = XCONS (tail)->cdr; | ||
| 1846 | } | ||
| 1847 | else | ||
| 1848 | { | ||
| 1849 | prev = tail; | ||
| 1850 | tail = XCONS (tail)->cdr; | ||
| 1851 | } | ||
| 1852 | } | ||
| 1853 | } | ||
| 1854 | |||
| 1855 | nextb = nextb->next; | ||
| 1856 | } | ||
| 1857 | } | ||
| 1858 | |||
| 1819 | gc_sweep (); | 1859 | gc_sweep (); |
| 1820 | 1860 | ||
| 1821 | /* Clear the mark bits that we set in certain root slots. */ | 1861 | /* Clear the mark bits that we set in certain root slots. */ |
| @@ -2228,6 +2268,39 @@ mark_buffer (buf) | |||
| 2228 | 2268 | ||
| 2229 | MARK_INTERVAL_TREE (BUF_INTERVALS (buffer)); | 2269 | MARK_INTERVAL_TREE (BUF_INTERVALS (buffer)); |
| 2230 | 2270 | ||
| 2271 | if (CONSP (buffer->undo_list)) | ||
| 2272 | { | ||
| 2273 | Lisp_Object tail; | ||
| 2274 | tail = buffer->undo_list; | ||
| 2275 | |||
| 2276 | while (CONSP (tail)) | ||
| 2277 | { | ||
| 2278 | register struct Lisp_Cons *ptr = XCONS (tail); | ||
| 2279 | |||
| 2280 | if (XMARKBIT (ptr->car)) | ||
| 2281 | break; | ||
| 2282 | XMARK (ptr->car); | ||
| 2283 | if (GC_CONSP (ptr->car) | ||
| 2284 | && ! XMARKBIT (XCONS (ptr->car)->car) | ||
| 2285 | && GC_MARKERP (XCONS (ptr->car)->car)) | ||
| 2286 | { | ||
| 2287 | XMARK (XCONS (ptr->car)->car); | ||
| 2288 | mark_object (&XCONS (ptr->car)->cdr); | ||
| 2289 | } | ||
| 2290 | else | ||
| 2291 | mark_object (&ptr->car); | ||
| 2292 | |||
| 2293 | if (CONSP (ptr->cdr)) | ||
| 2294 | tail = ptr->cdr; | ||
| 2295 | else | ||
| 2296 | break; | ||
| 2297 | } | ||
| 2298 | |||
| 2299 | mark_object (&XCONS (tail)->cdr); | ||
| 2300 | } | ||
| 2301 | else | ||
| 2302 | mark_object (&buffer->undo_list); | ||
| 2303 | |||
| 2231 | #if 0 | 2304 | #if 0 |
| 2232 | mark_object (buffer->syntax_table); | 2305 | mark_object (buffer->syntax_table); |
| 2233 | 2306 | ||