Mercurial > hg > xemacs-beta
diff src/buffer.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 3742ea8250b5 b604d235f028 |
children | d1247f3cc363 |
line wrap: on
line diff
--- a/src/buffer.c Sat Dec 26 00:20:27 2009 -0600 +++ b/src/buffer.c Sat Dec 26 21:18:49 2009 -0600 @@ -233,6 +233,12 @@ { XD_END } }; +#ifdef NEW_GC +DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("buffer-text", buffer_text, + 0, buffer_text_description_1, + Lisp_Buffer_Text); +#endif /* NEW_GC */ + static const struct sized_memory_description buffer_text_description = { sizeof (struct buffer_text), buffer_text_description_1 @@ -244,10 +250,16 @@ { XD_LISP_OBJECT, offsetof (struct buffer, extent_info) }, +#ifdef NEW_GC + { XD_BLOCK_PTR, offsetof (struct buffer, text), + 1, { &buffer_text_description } }, + { XD_LISP_OBJECT, offsetof (struct buffer, syntax_cache) }, +#else /* not NEW_GC */ { XD_BLOCK_PTR, offsetof (struct buffer, text), 1, { &buffer_text_description } }, { XD_BLOCK_PTR, offsetof (struct buffer, syntax_cache), 1, { &syntax_cache_description } }, +#endif /* not NEW_GC */ { XD_LISP_OBJECT, offsetof (struct buffer, indirect_children) }, { XD_LISP_OBJECT, offsetof (struct buffer, base_buffer) }, @@ -319,7 +331,7 @@ /* We do not need a finalize method to handle a buffer's children list because all buffers have `kill-buffer' applied to them before they disappear, and the children removal happens then. */ -DEFINE_NONDUMPABLE_LISP_OBJECT ("buffer", buffer, mark_buffer, +DEFINE_NODUMP_LISP_OBJECT ("buffer", buffer, mark_buffer, print_buffer, 0, 0, 0, buffer_description, struct buffer); @@ -1498,6 +1510,12 @@ if (old_buf) { + /* synchronize window point */ + Lisp_Object current_window = Fselected_window (Qnil); + if (!NILP (current_window) + && EQ(Fwindow_buffer (current_window), wrap_buffer (old_buf))) + Fset_window_point (current_window, make_int (BUF_PT (old_buf))); + /* Put the undo list back in the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (old_buf->base_buffer) @@ -1696,8 +1714,8 @@ Switch to Fundamental mode by killing current buffer's local variables. Most local variable bindings are eliminated so that the default values become effective once more. Also, the syntax table is set from -`standard-syntax-table', the category table is set from -`standard-category-table' (if support for Mule exists), local keymap is set +the standard syntax table, the category table is set from the +standard category table (if support for Mule exists), local keymap is set to nil, the abbrev table is set from `fundamental-mode-abbrev-table', and all specifier specifications whose locale is the current buffer are removed. This function also forces redisplay of the modeline. @@ -1889,6 +1907,9 @@ syms_of_buffer (void) { INIT_LISP_OBJECT (buffer); +#ifdef NEW_GC + INIT_LISP_OBJECT (buffer_text); +#endif /* NEW_GC */ DEFSYMBOL (Qbuffer_live_p); DEFSYMBOL (Qbuffer_or_string_p); @@ -2113,7 +2134,7 @@ /* The docstrings for DEFVAR_* are recorded externally by make-docfile. */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magic_fun) \ do \ { \ @@ -2138,7 +2159,7 @@ } \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes a bogus extra arg, which confuses an otherwise identical make-docfile.c */ #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magicfun) \ @@ -2172,7 +2193,7 @@ = intern (lname); \ } \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ DEFVAR_BUFFER_LOCAL_1 (lname, field_name, \ @@ -2620,6 +2641,8 @@ DEFVAR_BUFFER_LOCAL ("buffer-file-name", filename /* Name of file visited in current buffer, or nil if not visiting a file. Each buffer has its own value of this variable. +Code that changes this variable must maintain the invariant +`(equal buffer-file-truename (file-truename buffer-file-name))'. */ ); #if 0 /* FSFmacs */ @@ -2632,12 +2655,11 @@ #endif /* FSFmacs */ DEFVAR_BUFFER_LOCAL ("buffer-file-truename", file_truename /* -The real name of the file visited in the current buffer, -or nil if not visiting a file. This is the result of passing -buffer-file-name to the `file-truename' function. Every buffer has -its own value of this variable. This variable is automatically -maintained by the functions that change the file name associated -with a buffer. +The real name of the file visited in the current buffer, or nil if not +visiting a file. This is the result of passing `buffer-file-name' to the +`file-truename' function. Every buffer has its own value of this variable. +Code that changes the file name associated with a buffer maintains the +invariant `(equal buffer-file-truename (file-truename buffer-file-name))'. */ ); DEFVAR_BUFFER_LOCAL ("buffer-auto-save-file-name", auto_save_file_name /* @@ -2910,7 +2932,19 @@ { Ibyte *errmess; GET_STRERROR (errmess, errno); - fatal ("`getcwd' failed: %s\n", errmess); + stderr_out ("`getcwd' failed: %s: changing default directory to %s\n", + errmess, DEFAULT_DIRECTORY_FALLBACK); + + if (qxe_chdir ((Ibyte *)DEFAULT_DIRECTORY_FALLBACK) < 0) + { + GET_STRERROR (errmess, errno); + + fatal ("could not `chdir' to `%s': %s\n", + DEFAULT_DIRECTORY_FALLBACK, errmess); + } + + initial_directory = qxe_allocating_getcwd(); + assert (initial_directory != NULL); } /* Make sure pwd is DIRECTORY_SEP-terminated.