Mercurial > emacs
changeset 85011:1d35aa875508
* buffer.c (syms_of_buffer) <local-abbrev-table>: Move from abbrev.c.
(DEFVAR_PER_BUFFER, defvar_per_buffer): Move from lisp.h and lread.c.
* lisp.h (defvar_per_buffer, DEFVAR_PER_BUFFER):
* lread.c (defvar_per_buffer):
* abbrev.c (syms_of_abbrev) <local-abbrev-tabl>: Move to buffer.c.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 02 Oct 2007 20:51:02 +0000 |
parents | a3defcbdb064 |
children | 3a31b2cfe77f |
files | src/ChangeLog src/abbrev.c src/buffer.c src/lisp.h src/lread.c |
diffstat | 5 files changed, 62 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Tue Oct 02 20:43:54 2007 +0000 +++ b/src/ChangeLog Tue Oct 02 20:51:02 2007 +0000 @@ -1,3 +1,16 @@ +2007-10-02 Stefan Monnier <monnier@iro.umontreal.ca> + + * buffer.c (syms_of_buffer) <local-abbrev-table>: Move from abbrev.c. + (DEFVAR_PER_BUFFER, defvar_per_buffer): Move from lisp.h and lread.c. + * lisp.h (defvar_per_buffer, DEFVAR_PER_BUFFER): + * lread.c (defvar_per_buffer): + * abbrev.c (syms_of_abbrev) <local-abbrev-tabl>: Move to buffer.c. + + * window.c (candidate_window_p): Only consider as visible frames that + are on the same terminal. + + * m/ibms390x.h (MARKBIT): Remove unused macro. + 2007-10-01 Juanma Barranquero <lekktu@gmail.com> * lread.c (Fload): Fix typo in docstring.
--- a/src/abbrev.c Tue Oct 02 20:43:54 2007 +0000 +++ b/src/abbrev.c Tue Oct 02 20:51:02 2007 +0000 @@ -769,9 +769,6 @@ Trying to expand an abbrev in any other buffer clears `abbrev-start-location'. */); Vabbrev_start_location_buffer = Qnil; - DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, - doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_BOOL ("abbrevs-changed", &abbrevs_changed, doc: /* Set non-nil by defining or altering any word abbrevs. This causes `save-some-buffers' to offer to save the abbrevs. */);
--- a/src/buffer.c Tue Oct 02 20:43:54 2007 +0000 +++ b/src/buffer.c Tue Oct 02 20:51:02 2007 +0000 @@ -5275,6 +5275,46 @@ free (pwd); } +/* Similar to defvar_lisp but define a variable whose value is the Lisp + Object stored in the current buffer. address is the address of the slot + in the buffer that is current now. */ + +/* TYPE is nil for a general Lisp variable. + An integer specifies a type; then only LIsp values + with that type code are allowed (except that nil is allowed too). + LNAME is the LIsp-level variable name. + VNAME is the name of the buffer slot. + DOC is a dummy where you write the doc string as a comment. */ +#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ + defvar_per_buffer (lname, vname, type, 0) + +static void +defvar_per_buffer (namestring, address, type, doc) + char *namestring; + Lisp_Object *address; + Lisp_Object type; + char *doc; +{ + Lisp_Object sym, val; + int offset; + + sym = intern (namestring); + val = allocate_misc (); + offset = (char *)address - (char *)current_buffer; + + XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; + XBUFFER_OBJFWD (val)->offset = offset; + SET_SYMBOL_VALUE (sym, val); + PER_BUFFER_SYMBOL (offset) = sym; + PER_BUFFER_TYPE (offset) = type; + + if (PER_BUFFER_IDX (offset) == 0) + /* Did a DEFVAR_PER_BUFFER without initializing the corresponding + slot of buffer_local_flags */ + abort (); +} + + /* initialize the buffer routines */ void syms_of_buffer () @@ -5560,6 +5600,9 @@ Qnil, doc: /* Pretty name of current buffer's major mode (a string). */); + DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, + doc: /* Local (mode-specific) abbrev table of current buffer. */); + DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */);
--- a/src/lisp.h Tue Oct 02 20:43:54 2007 +0000 +++ b/src/lisp.h Tue Oct 02 20:51:02 2007 +0000 @@ -1145,6 +1145,8 @@ /* For markers that point somewhere, this is used to chain of all the markers in a given buffer. */ + /* We could remove it and use an array in buffer_text instead. + That would also allow to preserve it ordered. */ struct Lisp_Marker *next; /* This is the char position where the marker points. */ EMACS_INT charpos; @@ -1242,6 +1244,10 @@ unsigned int found_for_frame : 1; Lisp_Object realvalue; /* The buffer and frame for which the loaded binding was found. */ + /* Having both is only needed if we want to allow variables that are + both buffer local and frame local (in which case, we currently give + precedence to the buffer-local binding). I don't think such + a combination is desirable. --Stef */ Lisp_Object buffer, frame; /* A cons cell, (LOADED-BINDING . DEFAULT-VALUE). @@ -1723,7 +1729,6 @@ extern void defvar_lisp_nopro P_ ((char *, Lisp_Object *)); extern void defvar_bool P_ ((char *, int *)); extern void defvar_int P_ ((char *, EMACS_INT *)); -extern void defvar_per_buffer P_ ((char *, Lisp_Object *, Lisp_Object, char *)); extern void defvar_kboard P_ ((char *, int)); /* Macros we use to define forwarded Lisp variables. @@ -1734,15 +1739,6 @@ #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) -/* TYPE is nil for a general Lisp variable. - An integer specifies a type; then only LIsp values - with that type code are allowed (except that nil is allowed too). - LNAME is the LIsp-level variable name. - VNAME is the name of the buffer slot. - DOC is a dummy where you write the doc string as a comment. */ -#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ - defvar_per_buffer (lname, vname, type, 0) - #define DEFVAR_KBOARD(lname, vname, doc) \ defvar_kboard (lname, \ (int)((char *)(¤t_kboard->vname) \
--- a/src/lread.c Tue Oct 02 20:43:54 2007 +0000 +++ b/src/lread.c Tue Oct 02 20:51:02 2007 +0000 @@ -3746,37 +3746,6 @@ staticpro (address); } -/* Similar but define a variable whose value is the Lisp Object stored in - the current buffer. address is the address of the slot in the buffer - that is current now. */ - -void -defvar_per_buffer (namestring, address, type, doc) - char *namestring; - Lisp_Object *address; - Lisp_Object type; - char *doc; -{ - Lisp_Object sym, val; - int offset; - - sym = intern (namestring); - val = allocate_misc (); - offset = (char *)address - (char *)current_buffer; - - XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; - XBUFFER_OBJFWD (val)->offset = offset; - SET_SYMBOL_VALUE (sym, val); - PER_BUFFER_SYMBOL (offset) = sym; - PER_BUFFER_TYPE (offset) = type; - - if (PER_BUFFER_IDX (offset) == 0) - /* Did a DEFVAR_PER_BUFFER without initializing the corresponding - slot of buffer_local_flags */ - abort (); -} - - /* Similar but define a variable whose value is the Lisp Object stored at a particular offset in the current kboard object. */