aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStefan Monnier2007-10-02 20:51:02 +0000
committerStefan Monnier2007-10-02 20:51:02 +0000
commitd6aa1876eb29c086ef190c46d488d391db062f50 (patch)
treee809e1bbd31b4dc7958049774229273873e38828 /src/buffer.c
parentde509a6071aa4d046e666860468bb7d8bf134e02 (diff)
downloademacs-d6aa1876eb29c086ef190c46d488d391db062f50.tar.gz
emacs-d6aa1876eb29c086ef190c46d488d391db062f50.zip
* 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.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 8cd13b07855..bdb13adcba8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5275,6 +5275,46 @@ init_buffer ()
5275 free (pwd); 5275 free (pwd);
5276} 5276}
5277 5277
5278/* Similar to defvar_lisp but define a variable whose value is the Lisp
5279 Object stored in the current buffer. address is the address of the slot
5280 in the buffer that is current now. */
5281
5282/* TYPE is nil for a general Lisp variable.
5283 An integer specifies a type; then only LIsp values
5284 with that type code are allowed (except that nil is allowed too).
5285 LNAME is the LIsp-level variable name.
5286 VNAME is the name of the buffer slot.
5287 DOC is a dummy where you write the doc string as a comment. */
5288#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
5289 defvar_per_buffer (lname, vname, type, 0)
5290
5291static void
5292defvar_per_buffer (namestring, address, type, doc)
5293 char *namestring;
5294 Lisp_Object *address;
5295 Lisp_Object type;
5296 char *doc;
5297{
5298 Lisp_Object sym, val;
5299 int offset;
5300
5301 sym = intern (namestring);
5302 val = allocate_misc ();
5303 offset = (char *)address - (char *)current_buffer;
5304
5305 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
5306 XBUFFER_OBJFWD (val)->offset = offset;
5307 SET_SYMBOL_VALUE (sym, val);
5308 PER_BUFFER_SYMBOL (offset) = sym;
5309 PER_BUFFER_TYPE (offset) = type;
5310
5311 if (PER_BUFFER_IDX (offset) == 0)
5312 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
5313 slot of buffer_local_flags */
5314 abort ();
5315}
5316
5317
5278/* initialize the buffer routines */ 5318/* initialize the buffer routines */
5279void 5319void
5280syms_of_buffer () 5320syms_of_buffer ()
@@ -5560,6 +5600,9 @@ its hooks should not expect certain variables such as
5560 Qnil, 5600 Qnil,
5561 doc: /* Pretty name of current buffer's major mode (a string). */); 5601 doc: /* Pretty name of current buffer's major mode (a string). */);
5562 5602
5603 DEFVAR_PER_BUFFER ("local-abbrev-table", &current_buffer->abbrev_table, Qnil,
5604 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5605
5563 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5606 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil,
5564 doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); 5607 doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */);
5565 5608