Now on revision 109678. ------------------------------------------------------------ revno: 109678 fixes bug: http://debbugs.gnu.org/12228 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-08-19 14:37:15 +0800 message: * xml.el (xml-escape-string): Don't refer to xml-entity-alist. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-18 05:11:38 +0000 +++ lisp/ChangeLog 2012-08-19 06:37:15 +0000 @@ -1,3 +1,8 @@ +2012-08-19 Chong Yidong + + * xml.el (xml-escape-string): Don't refer to xml-entity-alist + (Bug#12228). + 2012-08-18 Chong Yidong * simple.el (yank-handled-properties): New defcustom. === modified file 'lisp/xml.el' --- lisp/xml.el 2012-07-28 09:19:53 +0000 +++ lisp/xml.el 2012-08-19 06:37:15 +0000 @@ -1011,13 +1011,25 @@ (defalias 'xml-print 'xml-debug-print) (defun xml-escape-string (string) - "Return STRING with entity substitutions made from `xml-entity-alist'." - (mapconcat (lambda (byte) - (let ((char (char-to-string byte))) - (if (rassoc char xml-entity-alist) - (concat "&" (car (rassoc char xml-entity-alist)) ";") - char))) - string "")) + "Convert STRING into a string containing valid XML character data. +Replace occurrences of &<>'\" in STRING with their default XML +entity references (e.g. replace each & with &). + +XML character data must not contain & or < characters, nor the > +character under some circumstances. The XML spec does not impose +restriction on \" or ', but we just substitute for these too +\(as is permitted by the spec)." + (with-temp-buffer + (insert string) + (dolist (substitution '(("&" . "&") + ("<" . "<") + (">" . ">") + ("'" . "'") + ("\"" . """))) + (goto-char (point-min)) + (while (search-forward (car substitution) nil t) + (replace-match (cdr substitution) t t nil))) + (buffer-string))) (defun xml-debug-print-internal (xml indent-string) "Outputs the XML tree in the current buffer. ------------------------------------------------------------ revno: 109677 committer: Alp Aker branch nick: trunk timestamp: Sat 2012-08-18 20:53:29 -0400 message: * nsfont.m (ns_ascii_average_width): Ensure the string ascii_printable is initialized with a null-terminated character array. Otherwise, it can contain undesired extra characters. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 23:53:43 +0000 +++ src/ChangeLog 2012-08-19 00:53:29 +0000 @@ -1,3 +1,9 @@ +2012-08-18 Alp Aker + + * nsfont.m (ns_ascii_average_width): Ensure the string + ascii_printable is initialized with a null-terminated character + array. Otherwise, it can contain undesired extra characters. + 2012-08-18 Paul Eggert port new setting code to Sun C 5.8 2005/10/13 === modified file 'src/nsfont.m' --- src/nsfont.m 2012-08-17 04:12:50 +0000 +++ src/nsfont.m 2012-08-19 00:53:29 +0000 @@ -270,10 +270,11 @@ if (!ascii_printable) { - char chars[95]; + char chars[96]; int ch; for (ch = 0; ch < 95; ch++) chars[ch] = ' ' + ch; + chars[95] = '\0'; ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; } ------------------------------------------------------------ revno: 109676 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-08-18 16:53:43 -0700 message: port new setting code to Sun C 5.8 2005/10/13 * chartab.c, lisp.h (char_table_set, char_table_set_range): Return void, not Lisp_Object. Otherwise, the compiler complains about (A?B:C) where B is void and C is Lisp_Object when compiling CHAR_TABLE_SET, due to the recent change to the API of sub_char_table_set_contents. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 07:23:30 +0000 +++ src/ChangeLog 2012-08-18 23:53:43 +0000 @@ -1,3 +1,12 @@ +2012-08-18 Paul Eggert + + port new setting code to Sun C 5.8 2005/10/13 + * chartab.c, lisp.h (char_table_set, char_table_set_range): + Return void, not Lisp_Object. Otherwise, the compiler + complains about (A?B:C) where B is void and C is Lisp_Object + when compiling CHAR_TABLE_SET, due to the recent change to + the API of sub_char_table_set_contents. + 2012-08-18 Chong Yidong * xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE === modified file 'src/chartab.c' --- src/chartab.c 2012-08-17 17:08:30 +0000 +++ src/chartab.c 2012-08-18 23:53:43 +0000 @@ -411,7 +411,7 @@ } } -Lisp_Object +void char_table_set (Lisp_Object table, int c, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); @@ -434,7 +434,6 @@ if (ASCII_CHAR_P (c)) set_char_table_ascii (table, char_table_ascii (table)); } - return val; } static void @@ -476,7 +475,7 @@ } -Lisp_Object +void char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) { struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); @@ -510,7 +509,6 @@ if (ASCII_CHAR_P (from)) set_char_table_ascii (table, char_table_ascii (table)); } - return val; } === modified file 'src/lisp.h' --- src/lisp.h 2012-08-17 21:12:11 +0000 +++ src/lisp.h 2012-08-18 23:53:43 +0000 @@ -2915,9 +2915,8 @@ extern Lisp_Object char_table_ref (Lisp_Object, int); extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, int *, int *); -extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object); -extern Lisp_Object char_table_set_range (Lisp_Object, int, int, - Lisp_Object); +extern void char_table_set (Lisp_Object, int, Lisp_Object); +extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object); extern int char_table_translate (Lisp_Object, int); extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, Lisp_Object), ------------------------------------------------------------ revno: 109675 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-08-18 14:36:13 -0700 message: * lib/sigprocmask.c, m4/signalblocking.m4: Remove. These files have been unused since the 2012-06-22 patch that introduced high-resolution time stamps. diff: === modified file 'ChangeLog' --- ChangeLog 2012-08-17 07:20:10 +0000 +++ ChangeLog 2012-08-18 21:36:13 +0000 @@ -1,3 +1,9 @@ +2012-08-18 Paul Eggert + + * lib/sigprocmask.c, m4/signalblocking.m4: Remove. + These files have been unused since the 2012-06-22 patch that + introduced high-resolution time stamps. + 2012-08-17 Jan Beich (tiny change) * configure.ac (PTY_OPEN): Try posix_openpt on gnu-linux, === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-08-15 07:01:17 +0000 +++ admin/CPP-DEFINES 2012-08-18 21:36:13 +0000 @@ -508,9 +508,6 @@ lib/signal.h: signal -lib/sigprocmask.c: -signal - lib/stdio.h: fdopen fopen === removed file 'lib/sigprocmask.c' --- lib/sigprocmask.c 2012-05-26 23:14:36 +0000 +++ lib/sigprocmask.c 1970-01-01 00:00:00 +0000 @@ -1,349 +0,0 @@ -/* POSIX compatible signal blocking. - Copyright (C) 2006-2012 Free Software Foundation, Inc. - Written by Bruno Haible , 2006. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -/* Specification. */ -#include - -#include -#include -#include - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -# include "msvc-inval.h" -#endif - -/* We assume that a platform without POSIX signal blocking functions - also does not have the POSIX sigaction() function, only the - signal() function. We also assume signal() has SysV semantics, - where any handler is uninstalled prior to being invoked. This is - true for native Windows platforms. */ - -/* We use raw signal(), but also provide a wrapper rpl_signal() so - that applications can query or change a blocked signal. */ -#undef signal - -/* Provide invalid signal numbers as fallbacks if the uncatchable - signals are not defined. */ -#ifndef SIGKILL -# define SIGKILL (-1) -#endif -#ifndef SIGSTOP -# define SIGSTOP (-1) -#endif - -/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias - for the signal SIGABRT. Only one signal handler is stored for both - SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# undef SIGABRT_COMPAT -# define SIGABRT_COMPAT 6 -#endif -#ifdef SIGABRT_COMPAT -# define SIGABRT_COMPAT_MASK (1U << SIGABRT_COMPAT) -#else -# define SIGABRT_COMPAT_MASK 0 -#endif - -typedef void (*handler_t) (int); - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -static inline handler_t -signal_nothrow (int sig, handler_t handler) -{ - handler_t result; - - TRY_MSVC_INVAL - { - result = signal (sig, handler); - } - CATCH_MSVC_INVAL - { - result = SIG_ERR; - errno = EINVAL; - } - DONE_MSVC_INVAL; - - return result; -} -# define signal signal_nothrow -#endif - -/* Handling of gnulib defined signals. */ - -#if GNULIB_defined_SIGPIPE -static handler_t SIGPIPE_handler = SIG_DFL; -#endif - -#if GNULIB_defined_SIGPIPE -static handler_t -ext_signal (int sig, handler_t handler) -{ - switch (sig) - { - case SIGPIPE: - { - handler_t old_handler = SIGPIPE_handler; - SIGPIPE_handler = handler; - return old_handler; - } - default: /* System defined signal */ - return signal (sig, handler); - } -} -# undef signal -# define signal ext_signal -#endif - -int -sigismember (const sigset_t *set, int sig) -{ - if (sig >= 0 && sig < NSIG) - { - #ifdef SIGABRT_COMPAT - if (sig == SIGABRT_COMPAT) - sig = SIGABRT; - #endif - - return (*set >> sig) & 1; - } - else - return 0; -} - -int -sigemptyset (sigset_t *set) -{ - *set = 0; - return 0; -} - -int -sigaddset (sigset_t *set, int sig) -{ - if (sig >= 0 && sig < NSIG) - { - #ifdef SIGABRT_COMPAT - if (sig == SIGABRT_COMPAT) - sig = SIGABRT; - #endif - - *set |= 1U << sig; - return 0; - } - else - { - errno = EINVAL; - return -1; - } -} - -int -sigdelset (sigset_t *set, int sig) -{ - if (sig >= 0 && sig < NSIG) - { - #ifdef SIGABRT_COMPAT - if (sig == SIGABRT_COMPAT) - sig = SIGABRT; - #endif - - *set &= ~(1U << sig); - return 0; - } - else - { - errno = EINVAL; - return -1; - } -} - - -int -sigfillset (sigset_t *set) -{ - *set = ((2U << (NSIG - 1)) - 1) & ~ SIGABRT_COMPAT_MASK; - return 0; -} - -/* Set of currently blocked signals. */ -static volatile sigset_t blocked_set /* = 0 */; - -/* Set of currently blocked and pending signals. */ -static volatile sig_atomic_t pending_array[NSIG] /* = { 0 } */; - -/* Signal handler that is installed for blocked signals. */ -static void -blocked_handler (int sig) -{ - /* Reinstall the handler, in case the signal occurs multiple times - while blocked. There is an inherent race where an asynchronous - signal in between when the kernel uninstalled the handler and - when we reinstall it will trigger the default handler; oh - well. */ - signal (sig, blocked_handler); - if (sig >= 0 && sig < NSIG) - pending_array[sig] = 1; -} - -int -sigpending (sigset_t *set) -{ - sigset_t pending = 0; - int sig; - - for (sig = 0; sig < NSIG; sig++) - if (pending_array[sig]) - pending |= 1U << sig; - *set = pending; - return 0; -} - -/* The previous signal handlers. - Only the array elements corresponding to blocked signals are relevant. */ -static volatile handler_t old_handlers[NSIG]; - -int -sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) -{ - if (old_set != NULL) - *old_set = blocked_set; - - if (set != NULL) - { - sigset_t new_blocked_set; - sigset_t to_unblock; - sigset_t to_block; - - switch (operation) - { - case SIG_BLOCK: - new_blocked_set = blocked_set | *set; - break; - case SIG_SETMASK: - new_blocked_set = *set; - break; - case SIG_UNBLOCK: - new_blocked_set = blocked_set & ~*set; - break; - default: - errno = EINVAL; - return -1; - } - to_unblock = blocked_set & ~new_blocked_set; - to_block = new_blocked_set & ~blocked_set; - - if (to_block != 0) - { - int sig; - - for (sig = 0; sig < NSIG; sig++) - if ((to_block >> sig) & 1) - { - pending_array[sig] = 0; - if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) - blocked_set |= 1U << sig; - } - } - - if (to_unblock != 0) - { - sig_atomic_t received[NSIG]; - int sig; - - for (sig = 0; sig < NSIG; sig++) - if ((to_unblock >> sig) & 1) - { - if (signal (sig, old_handlers[sig]) != blocked_handler) - /* The application changed a signal handler while the signal - was blocked, bypassing our rpl_signal replacement. - We don't support this. */ - abort (); - received[sig] = pending_array[sig]; - blocked_set &= ~(1U << sig); - pending_array[sig] = 0; - } - else - received[sig] = 0; - - for (sig = 0; sig < NSIG; sig++) - if (received[sig]) - raise (sig); - } - } - return 0; -} - -/* Install the handler FUNC for signal SIG, and return the previous - handler. */ -handler_t -rpl_signal (int sig, handler_t handler) -{ - /* We must provide a wrapper, so that a user can query what handler - they installed even if that signal is currently blocked. */ - if (sig >= 0 && sig < NSIG && sig != SIGKILL && sig != SIGSTOP - && handler != SIG_ERR) - { - #ifdef SIGABRT_COMPAT - if (sig == SIGABRT_COMPAT) - sig = SIGABRT; - #endif - - if (blocked_set & (1U << sig)) - { - /* POSIX states that sigprocmask and signal are both - async-signal-safe. This is not true of our - implementation - there is a slight data race where an - asynchronous interrupt on signal A can occur after we - install blocked_handler but before we have updated - old_handlers for signal B, such that handler A can see - stale information if it calls signal(B). Oh well - - signal handlers really shouldn't try to manipulate the - installed handlers of unrelated signals. */ - handler_t result = old_handlers[sig]; - old_handlers[sig] = handler; - return result; - } - else - return signal (sig, handler); - } - else - { - errno = EINVAL; - return SIG_ERR; - } -} - -#if GNULIB_defined_SIGPIPE -/* Raise the signal SIGPIPE. */ -int -_gl_raise_SIGPIPE (void) -{ - if (blocked_set & (1U << SIGPIPE)) - pending_array[SIGPIPE] = 1; - else - { - handler_t handler = SIGPIPE_handler; - if (handler == SIG_DFL) - exit (128 + SIGPIPE); - else if (handler != SIG_IGN) - (*handler) (SIGPIPE); - } - return 0; -} -#endif === removed file 'm4/signalblocking.m4' --- m4/signalblocking.m4 2012-05-26 23:14:36 +0000 +++ m4/signalblocking.m4 1970-01-01 00:00:00 +0000 @@ -1,27 +0,0 @@ -# signalblocking.m4 serial 13 -dnl Copyright (C) 2001-2002, 2006-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# Determine available signal blocking primitives. Three different APIs exist: -# 1) POSIX: sigemptyset, sigaddset, sigprocmask -# 2) SYSV: sighold, sigrelse -# 3) BSD: sigblock, sigsetmask -# For simplicity, here we check only for the POSIX signal blocking. -AC_DEFUN([gl_SIGNALBLOCKING], -[ - AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) - AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) - if test $gl_cv_type_sigset_t = yes; then - AC_CHECK_FUNC([sigprocmask], [gl_cv_func_sigprocmask=1]) - fi - if test -z "$gl_cv_func_sigprocmask"; then - HAVE_POSIX_SIGNALBLOCKING=0 - fi -]) - -# Prerequisites of lib/sigprocmask.c. -AC_DEFUN([gl_PREREQ_SIGPROCMASK], [ - AC_REQUIRE([AC_C_INLINE]) -]) ------------------------------------------------------------ revno: 109674 fixes bug: http://debbugs.gnu.org/3874 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-08-18 15:23:30 +0800 message: Make display strings obey buffer-invisibility-spec. * src/xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE for the string case. * redisplay-testsuite.el (test-redisplay-4): New test. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 06:06:39 +0000 +++ src/ChangeLog 2012-08-18 07:23:30 +0000 @@ -1,3 +1,8 @@ +2012-08-18 Chong Yidong + + * xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE + for the string case (Bug#3874). + 2012-08-18 Paul Eggert * buffer.h (BSET): Remove (Bug#12215). === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-18 06:06:39 +0000 +++ src/xdisp.c 2012-08-18 07:23:30 +0000 @@ -4069,38 +4069,56 @@ handle_invisible_prop (struct it *it) { enum prop_handled handled = HANDLED_NORMALLY; + int invis_p; + Lisp_Object prop; if (STRINGP (it->string)) { - Lisp_Object prop, end_charpos, limit, charpos; + Lisp_Object end_charpos, limit, charpos; /* Get the value of the invisible text property at the current position. Value will be nil if there is no such property. */ charpos = make_number (IT_STRING_CHARPOS (*it)); prop = Fget_text_property (charpos, Qinvisible, it->string); + invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); - if (!NILP (prop) - && IT_STRING_CHARPOS (*it) < it->end_charpos) + if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos) { + /* Record whether we have to display an ellipsis for the + invisible text. */ + int display_ellipsis_p = (invis_p == 2); ptrdiff_t endpos; handled = HANDLED_RECOMPUTE_PROPS; - /* Get the position at which the next change of the - invisible text property can be found in IT->string. - Value will be nil if the property value is the same for - all the rest of IT->string. */ + /* Get the position at which the next visible text can be + found in IT->string, if any. */ XSETINT (limit, SCHARS (it->string)); - end_charpos = Fnext_single_property_change (charpos, Qinvisible, - it->string, limit); - - /* Text at current position is invisible. The next - change in the property is at position end_charpos. - Move IT's current position to that position. */ + do + { + end_charpos = Fnext_single_property_change (charpos, Qinvisible, + it->string, limit); + if (!NILP (end_charpos)) + { + prop = Fget_text_property (end_charpos, Qinvisible, it->string); + invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); + if (invis_p == 2) + display_ellipsis_p = 1; + } + } + while (!NILP (end_charpos) && invis_p); + + if (display_ellipsis_p) + { + it->ellipsis_p = 1; + handled = HANDLED_RETURN; + } + if (INTEGERP (end_charpos) && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) { + /* Text at END_CHARPOS is visible. Move IT there. */ struct text_pos old; ptrdiff_t oldpos; @@ -4153,9 +4171,8 @@ } else { - int invis_p; ptrdiff_t newpos, next_stop, start_charpos, tem; - Lisp_Object pos, prop, overlay; + Lisp_Object pos, overlay; /* First of all, is there invisible text at this position? */ tem = start_charpos = IT_CHARPOS (*it); @@ -6032,7 +6049,7 @@ { Lisp_Object prop; prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), - Qinvisible, it->window); + Qinvisible, it->window); if (TEXT_PROP_MEANS_INVISIBLE (prop)) continue; } === modified file 'test/ChangeLog' --- test/ChangeLog 2012-08-14 12:38:11 +0000 +++ test/ChangeLog 2012-08-18 07:23:30 +0000 @@ -1,3 +1,7 @@ +2012-08-18 Chong Yidong + + * redisplay-testsuite.el (test-redisplay-4): New test (Bug#3874). + 2012-08-14 Dmitry Gutov * indent/ruby.rb: Rearrange examples, add new ones. === modified file 'test/redisplay-testsuite.el' --- test/redisplay-testsuite.el 2012-01-19 07:21:25 +0000 +++ test/redisplay-testsuite.el 2012-08-18 07:23:30 +0000 @@ -113,7 +113,7 @@ (insert "\n\n")) (defun test-redisplay-3 () - (insert "Test 3: Overlay with before/after strings and images:\n\n") + (insert "Test 3: Overlay with strings and images:\n\n") (let ((img-data "#define x_width 8 #define x_height 8 static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) @@ -165,6 +165,95 @@ (overlay-put ov2 'before-string "C") (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) +(defun test-redisplay-4 () + (insert "Test 4: Overlay strings and invisibility:\n\n") + ;; Before and after strings with non-nil `invisibility'. + (insert " Expected: ABC\n") + (insert " Result: ") + (let ((opoint (point))) + (insert "ABC\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'before-string + (propertize "XX" 'invisible + 'test-redisplay--simple-invis)) + (overlay-put ov 'after-string + (propertize "XX" 'invisible + 'test-redisplay--simple-invis)))) + + ;; Before and after strings bogus `invisibility' property (value is + ;; not listed in `buffer-invisibility-spec'). + (insert "\n Expected: ABC") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "B\n") + (let ((ov (make-overlay opoint (1+ opoint)))) + (overlay-put ov 'before-string + (propertize "A" 'invisible 'bogus-invis-spec)) + (overlay-put ov 'after-string + (propertize "C" 'invisible 'bogus-invis-spec)))) + + ;; Before/after string with ellipsis `invisibility' property. + (insert "\n Expected: ...B...") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "B\n") + (let ((ov (make-overlay opoint (1+ opoint)))) + (overlay-put ov 'before-string + (propertize "A" 'invisible 'test-redisplay--ellipsis-invis)) + (overlay-put ov 'after-string + (propertize "C" 'invisible 'test-redisplay--ellipsis-invis)))) + + ;; Before/after string with partial ellipsis `invisibility' property. + (insert "\n Expected: A...ABC...C") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "B\n") + (let ((ov (make-overlay opoint (1+ opoint))) + (a "AAA") + (c "CCC")) + (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis a) + (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis c) + (overlay-put ov 'before-string a) + (overlay-put ov 'after-string c))) + + ;; Display string with `invisibility' property. + (insert "\n Expected: ABC") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "AYBC\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'display + (propertize "XX" 'invisible + 'test-redisplay--simple-invis)))) + ;; Display string with bogus `invisibility' property. + (insert "\n Expected: ABC") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "AXC\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'display + (propertize "B" 'invisible 'bogus-invis-spec)))) + ;; Display string with ellipsis `invisibility' property. + (insert "\n Expected: A...C") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "AXC\n") + (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) + (overlay-put ov 'display + (propertize "B" 'invisible + 'test-redisplay--ellipsis-invis)))) + ;; Display string with partial `invisibility' property. + (insert "\n Expected: A...C") + (insert "\n Result: ") + (let ((opoint (point))) + (insert "X\n") + (let ((ov (make-overlay opoint (1+ opoint))) + (str "ABC")) + (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str) + (overlay-put ov 'display str))) + + (insert "\n")) + (defun test-redisplay () (interactive) @@ -173,8 +262,12 @@ (kill-buffer buf)) (pop-to-buffer (get-buffer-create "*Redisplay Test*")) (erase-buffer) + (setq buffer-invisibility-spec + '(test-redisplay--simple-invis + (test-redisplay--ellipsis-invis . t))) (test-redisplay-1) (test-redisplay-2) (test-redisplay-3) + (test-redisplay-4) (goto-char (point-min)))) ------------------------------------------------------------ revno: 109673 fixes bug: http://debbugs.gnu.org/12215 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-17 23:06:39 -0700 message: * buffer.h (BSET): Remove. Replace all uses with calls to new setter functions. (bset_bidi_paragraph_direction, bset_case_canon_table) (bset_case_eqv_table, bset_directory, bset_display_count) (bset_display_time, bset_downcase_table) (bset_enable_multibyte_characters, bset_filename, bset_keymap) (bset_last_selected_window, bset_local_var_alist) (bset_mark_active, bset_point_before_scroll, bset_read_only) (bset_truncate_lines, bset_undo_list, bset_upcase_table) (bset_width_table): * buffer.c (bset_abbrev_mode, bset_abbrev_table) (bset_auto_fill_function, bset_auto_save_file_format) (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) (bset_bidi_display_reordering, bset_buffer_file_coding_system) (bset_cache_long_line_scans, bset_case_fold_search) (bset_ctl_arrow, bset_cursor_in_non_selected_windows) (bset_cursor_type, bset_display_table, bset_extra_line_spacing) (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) (bset_fringe_indicator_alist, bset_fringes_outside_margins) (bset_header_line_format, bset_indicate_buffer_boundaries) (bset_indicate_empty_lines, bset_invisibility_spec) (bset_left_fringe_width, bset_major_mode, bset_mark) (bset_minor_modes, bset_mode_line_format, bset_mode_name) (bset_name, bset_overwrite_mode, bset_pt_marker) (bset_right_fringe_width, bset_save_length) (bset_scroll_bar_width, bset_scroll_down_aggressively) (bset_scroll_up_aggressively, bset_selective_display) (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) (bset_word_wrap, bset_zv_marker): * category.c (bset_category_table): * syntax.c (bset_syntax_table): New setter functions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-18 02:49:24 +0000 +++ src/ChangeLog 2012-08-18 06:06:39 +0000 @@ -1,5 +1,38 @@ 2012-08-18 Paul Eggert + * buffer.h (BSET): Remove (Bug#12215). + Replace all uses with calls to new setter functions. + (bset_bidi_paragraph_direction, bset_case_canon_table) + (bset_case_eqv_table, bset_directory, bset_display_count) + (bset_display_time, bset_downcase_table) + (bset_enable_multibyte_characters, bset_filename, bset_keymap) + (bset_last_selected_window, bset_local_var_alist) + (bset_mark_active, bset_point_before_scroll, bset_read_only) + (bset_truncate_lines, bset_undo_list, bset_upcase_table) + (bset_width_table): + * buffer.c (bset_abbrev_mode, bset_abbrev_table) + (bset_auto_fill_function, bset_auto_save_file_format) + (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) + (bset_bidi_display_reordering, bset_buffer_file_coding_system) + (bset_cache_long_line_scans, bset_case_fold_search) + (bset_ctl_arrow, bset_cursor_in_non_selected_windows) + (bset_cursor_type, bset_display_table, bset_extra_line_spacing) + (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) + (bset_fringe_indicator_alist, bset_fringes_outside_margins) + (bset_header_line_format, bset_indicate_buffer_boundaries) + (bset_indicate_empty_lines, bset_invisibility_spec) + (bset_left_fringe_width, bset_major_mode, bset_mark) + (bset_minor_modes, bset_mode_line_format, bset_mode_name) + (bset_name, bset_overwrite_mode, bset_pt_marker) + (bset_right_fringe_width, bset_save_length) + (bset_scroll_bar_width, bset_scroll_down_aggressively) + (bset_scroll_up_aggressively, bset_selective_display) + (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) + (bset_word_wrap, bset_zv_marker): + * category.c (bset_category_table): + * syntax.c (bset_syntax_table): + New setter functions. + * process.h (PSET): Remove (Bug#12215). Replace all uses with calls to new setter functions. Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. === modified file 'src/buffer.c' --- src/buffer.c 2012-08-17 21:52:15 +0000 +++ src/buffer.c 2012-08-18 06:06:39 +0000 @@ -157,6 +157,228 @@ static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); +/* These setters are used only in this file, so they can be private. */ +static inline void +bset_abbrev_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (abbrev_mode) = val; +} +static inline void +bset_abbrev_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (abbrev_table) = val; +} +static inline void +bset_auto_fill_function (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_fill_function) = val; +} +static inline void +bset_auto_save_file_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_save_file_format) = val; +} +static inline void +bset_auto_save_file_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (auto_save_file_name) = val; +} +static inline void +bset_backed_up (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (backed_up) = val; +} +static inline void +bset_begv_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (begv_marker) = val; +} +static inline void +bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (bidi_display_reordering) = val; +} +static inline void +bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (buffer_file_coding_system) = val; +} +static inline void +bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cache_long_line_scans) = val; +} +static inline void +bset_case_fold_search (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_fold_search) = val; +} +static inline void +bset_ctl_arrow (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (ctl_arrow) = val; +} +static inline void +bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; +} +static inline void +bset_cursor_type (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (cursor_type) = val; +} +static inline void +bset_display_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_table) = val; +} +static inline void +bset_extra_line_spacing (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (extra_line_spacing) = val; +} +static inline void +bset_file_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (file_format) = val; +} +static inline void +bset_file_truename (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (file_truename) = val; +} +static inline void +bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringe_cursor_alist) = val; +} +static inline void +bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringe_indicator_alist) = val; +} +static inline void +bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (fringes_outside_margins) = val; +} +static inline void +bset_header_line_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (header_line_format) = val; +} +static inline void +bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; +} +static inline void +bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (indicate_empty_lines) = val; +} +static inline void +bset_invisibility_spec (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (invisibility_spec) = val; +} +static inline void +bset_left_fringe_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (left_fringe_width) = val; +} +static inline void +bset_major_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (major_mode) = val; +} +static inline void +bset_mark (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mark) = val; +} +static inline void +bset_minor_modes (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (minor_modes) = val; +} +static inline void +bset_mode_line_format (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mode_line_format) = val; +} +static inline void +bset_mode_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mode_name) = val; +} +static inline void +bset_name (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (name) = val; +} +static inline void +bset_overwrite_mode (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (overwrite_mode) = val; +} +static inline void +bset_pt_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (pt_marker) = val; +} +static inline void +bset_right_fringe_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (right_fringe_width) = val; +} +static inline void +bset_save_length (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (save_length) = val; +} +static inline void +bset_scroll_bar_width (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_bar_width) = val; +} +static inline void +bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_down_aggressively) = val; +} +static inline void +bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (scroll_up_aggressively) = val; +} +static inline void +bset_selective_display (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (selective_display) = val; +} +static inline void +bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (selective_display_ellipses) = val; +} +static inline void +bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; +} +static inline void +bset_word_wrap (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (word_wrap) = val; +} +static inline void +bset_zv_marker (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (zv_marker) = val; +} + /* For debugging; temporary. See set_buffer_internal. */ /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ @@ -370,7 +592,7 @@ b->newline_cache = 0; b->width_run_cache = 0; - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -379,20 +601,20 @@ /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - BSET (b, pt_marker, Qnil); - BSET (b, begv_marker, Qnil); - BSET (b, zv_marker, Qnil); + bset_pt_marker (b, Qnil); + bset_begv_marker (b, Qnil); + bset_zv_marker (b, Qnil); name = Fcopy_sequence (buffer_or_name); set_string_intervals (name, NULL); - BSET (b, name, name); + bset_name (b, name); - BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); + bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt); reset_buffer (b); reset_buffer_local_variables (b, 1); - BSET (b, mark, Fmake_marker ()); + bset_mark (b, Fmake_marker ()); BUF_MARKERS (b) = NULL; /* Put this in the alist of all live buffers. */ @@ -492,7 +714,7 @@ /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1)); + bset_local_var_alist (to, buffer_lisp_local_variables (from, 1)); } @@ -595,7 +817,7 @@ b->newline_cache = 0; b->width_run_cache = 0; - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); /* Put this on the chain of all buffers including killed ones. */ b->header.next.buffer = all_buffers; @@ -603,7 +825,7 @@ name = Fcopy_sequence (name); set_string_intervals (name, NULL); - BSET (b, name, name); + bset_name (b, name); reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -612,10 +834,11 @@ XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - BSET (b, mark, Fmake_marker ()); + bset_mark (b, Fmake_marker ()); /* The multibyte status belongs to the base buffer. */ - BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters)); + bset_enable_multibyte_characters + (b, BVAR (b->base_buffer, enable_multibyte_characters)); /* Make sure the base buffer has markers for its narrowing. */ if (NILP (BVAR (b->base_buffer, pt_marker))) @@ -623,14 +846,17 @@ eassert (NILP (BVAR (b->base_buffer, begv_marker))); eassert (NILP (BVAR (b->base_buffer, zv_marker))); - BSET (b->base_buffer, pt_marker, - build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte)); - - BSET (b->base_buffer, begv_marker, - build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte)); - - BSET (b->base_buffer, zv_marker, - build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte)); + bset_pt_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->pt, + b->base_buffer->pt_byte)); + + bset_begv_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->begv, + b->base_buffer->begv_byte)); + + bset_zv_marker (b->base_buffer, + build_marker (b->base_buffer, b->base_buffer->zv, + b->base_buffer->zv_byte)); XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } @@ -638,9 +864,9 @@ if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte)); - BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte)); - BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte)); + bset_pt_marker (b, build_marker (b, b->pt, b->pt_byte)); + bset_begv_marker (b, build_marker (b, b->begv, b->begv_byte)); + bset_zv_marker (b, build_marker (b, b->zv, b->zv_byte)); XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else @@ -648,11 +874,11 @@ struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - BSET (b, filename, Qnil); - BSET (b, file_truename, Qnil); - BSET (b, display_count, make_number (0)); - BSET (b, backed_up, Qnil); - BSET (b, auto_save_file_name, Qnil); + bset_filename (b, Qnil); + bset_file_truename (b, Qnil); + bset_display_count (b, make_number (0)); + bset_backed_up (b, Qnil); + bset_auto_save_file_name (b, Qnil); set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -715,10 +941,9 @@ void reset_buffer (register struct buffer *b) { - BSET (b, filename, Qnil); - BSET (b, file_truename, Qnil); - BSET (b, directory, - (current_buffer) ? BVAR (current_buffer, directory) : Qnil); + bset_filename (b, Qnil); + bset_file_truename (b, Qnil); + bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); b->modtime_size = -1; XSETFASTINT (BVAR (b, save_length), 0); @@ -726,25 +951,25 @@ /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; b->prevent_redisplay_optimizations_p = 1; - BSET (b, backed_up, Qnil); + bset_backed_up (b, Qnil); BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = 0; - BSET (b, auto_save_file_name, Qnil); - BSET (b, read_only, Qnil); + bset_auto_save_file_name (b, Qnil); + bset_read_only (b, Qnil); set_buffer_overlays_before (b, NULL); set_buffer_overlays_after (b, NULL); b->overlay_center = BEG; - BSET (b, mark_active, Qnil); - BSET (b, point_before_scroll, Qnil); - BSET (b, file_format, Qnil); - BSET (b, auto_save_file_format, Qt); - BSET (b, last_selected_window, Qnil); - BSET (b, display_count, make_number (0)); - BSET (b, display_time, Qnil); - BSET (b, enable_multibyte_characters, - BVAR (&buffer_defaults, enable_multibyte_characters)); - BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type)); - BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing)); + bset_mark_active (b, Qnil); + bset_point_before_scroll (b, Qnil); + bset_file_format (b, Qnil); + bset_auto_save_file_format (b, Qt); + bset_last_selected_window (b, Qnil); + bset_display_count (b, make_number (0)); + bset_display_time (b, Qnil); + bset_enable_multibyte_characters + (b, BVAR (&buffer_defaults, enable_multibyte_characters)); + bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type)); + bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing)); b->display_error_modiff = 0; } @@ -768,10 +993,10 @@ things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - BSET (b, major_mode, Qfundamental_mode); - BSET (b, keymap, Qnil); - BSET (b, mode_name, QSFundamental); - BSET (b, minor_modes, Qnil); + bset_major_mode (b, Qfundamental_mode); + bset_keymap (b, Qnil); + bset_mode_name (b, QSFundamental); + bset_minor_modes (b, Qnil); /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -780,15 +1005,15 @@ && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - BSET (b, downcase_table, Vascii_downcase_table); - BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); - BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); - BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); - BSET (b, invisibility_spec, Qt); + bset_downcase_table (b, Vascii_downcase_table); + bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); + bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); + bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); + bset_invisibility_spec (b, Qt); /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - BSET (b, local_var_alist, Qnil); + bset_local_var_alist (b, Qnil); else { Lisp_Object tmp, prop, last = Qnil; @@ -822,7 +1047,7 @@ } /* Delete this local variable. */ else if (NILP (last)) - BSET (b, local_var_alist, XCDR (tmp)); + bset_local_var_alist (b, XCDR (tmp)); else XSETCDR (last, XCDR (tmp)); } @@ -1299,7 +1524,7 @@ error ("Buffer name `%s' is in use", SDATA (newname)); } - BSET (current_buffer, name, newname); + bset_name (current_buffer, newname); /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1444,7 +1669,7 @@ } if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) - BSET (XBUFFER (real_buffer), undo_list, Qnil); + bset_undo_list (XBUFFER (real_buffer), Qnil); return Qnil; } @@ -1716,7 +1941,7 @@ swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - BSET (b, name, Qnil); + bset_name (b, Qnil); BLOCK_INPUT; if (b->base_buffer) @@ -1740,9 +1965,9 @@ free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - BSET (b, width_table, Qnil); + bset_width_table (b, Qnil); UNBLOCK_INPUT; - BSET (b, undo_list, Qnil); + bset_undo_list (b, Qnil); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) @@ -1923,7 +2148,7 @@ /* 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) - BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list)); + bset_undo_list (old_buf->base_buffer, BVAR (old_buf, undo_list)); /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ @@ -1933,7 +2158,7 @@ /* Get the undo list from the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (b->base_buffer) - BSET (b, undo_list, BVAR (b->base_buffer, undo_list)); + bset_undo_list (b, BVAR (b->base_buffer, undo_list)); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ @@ -2131,8 +2356,8 @@ #define swapfield_(field, type) \ do { \ type tmp##field = BVAR (other_buffer, field); \ - BSET (other_buffer, field, BVAR (current_buffer, field)); \ - BSET (current_buffer, field, tmp##field); \ + bset_##field (other_buffer, BVAR (current_buffer, field)); \ + bset_##field (current_buffer, tmp##field); \ } while (0) swapfield (own_text, struct buffer_text); @@ -2172,8 +2397,8 @@ swapfield_ (pt_marker, Lisp_Object); swapfield_ (begv_marker, Lisp_Object); swapfield_ (zv_marker, Lisp_Object); - BSET (current_buffer, point_before_scroll, Qnil); - BSET (other_buffer, point_before_scroll, Qnil); + bset_point_before_scroll (current_buffer, Qnil); + bset_point_before_scroll (other_buffer, Qnil); current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2262,7 +2487,7 @@ /* Don't record these buffer changes. We will put a special undo entry instead. */ - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2284,7 +2509,7 @@ to calculate the old correspondences. */ set_intervals_multibyte (0); - BSET (current_buffer, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (current_buffer, Qnil); Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2422,7 +2647,7 @@ /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - BSET (current_buffer, enable_multibyte_characters, Qt); + bset_enable_multibyte_characters (current_buffer, Qt); GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2480,11 +2705,11 @@ if (!EQ (old_undo, Qt)) { /* Represent all the above changes by a special undo entry. */ - BSET (current_buffer, undo_list, - Fcons (list3 (Qapply, - intern ("set-buffer-multibyte"), - NILP (flag) ? Qt : Qnil), - old_undo)); + bset_undo_list (current_buffer, + Fcons (list3 (Qapply, + intern ("set-buffer-multibyte"), + NILP (flag) ? Qt : Qnil), + old_undo)); } UNGCPRO; @@ -4937,55 +5162,55 @@ /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-")); - BSET (&buffer_defaults, header_line_format, Qnil); - BSET (&buffer_defaults, abbrev_mode, Qnil); - BSET (&buffer_defaults, overwrite_mode, Qnil); - BSET (&buffer_defaults, case_fold_search, Qt); - BSET (&buffer_defaults, auto_fill_function, Qnil); - BSET (&buffer_defaults, selective_display, Qnil); - BSET (&buffer_defaults, selective_display_ellipses, Qt); - BSET (&buffer_defaults, abbrev_table, Qnil); - BSET (&buffer_defaults, display_table, Qnil); - BSET (&buffer_defaults, undo_list, Qnil); - BSET (&buffer_defaults, mark_active, Qnil); - BSET (&buffer_defaults, file_format, Qnil); - BSET (&buffer_defaults, auto_save_file_format, Qt); + bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); + bset_header_line_format (&buffer_defaults, Qnil); + bset_abbrev_mode (&buffer_defaults, Qnil); + bset_overwrite_mode (&buffer_defaults, Qnil); + bset_case_fold_search (&buffer_defaults, Qt); + bset_auto_fill_function (&buffer_defaults, Qnil); + bset_selective_display (&buffer_defaults, Qnil); + bset_selective_display_ellipses (&buffer_defaults, Qt); + bset_abbrev_table (&buffer_defaults, Qnil); + bset_display_table (&buffer_defaults, Qnil); + bset_undo_list (&buffer_defaults, Qnil); + bset_mark_active (&buffer_defaults, Qnil); + bset_file_format (&buffer_defaults, Qnil); + bset_auto_save_file_format (&buffer_defaults, Qt); set_buffer_overlays_before (&buffer_defaults, NULL); set_buffer_overlays_after (&buffer_defaults, NULL); buffer_defaults.overlay_center = BEG; XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); - BSET (&buffer_defaults, truncate_lines, Qnil); - BSET (&buffer_defaults, word_wrap, Qnil); - BSET (&buffer_defaults, ctl_arrow, Qt); - BSET (&buffer_defaults, bidi_display_reordering, Qt); - BSET (&buffer_defaults, bidi_paragraph_direction, Qnil); - BSET (&buffer_defaults, cursor_type, Qt); - BSET (&buffer_defaults, extra_line_spacing, Qnil); - BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt); + bset_truncate_lines (&buffer_defaults, Qnil); + bset_word_wrap (&buffer_defaults, Qnil); + bset_ctl_arrow (&buffer_defaults, Qt); + bset_bidi_display_reordering (&buffer_defaults, Qt); + bset_bidi_paragraph_direction (&buffer_defaults, Qnil); + bset_cursor_type (&buffer_defaults, Qt); + bset_extra_line_spacing (&buffer_defaults, Qnil); + bset_cursor_in_non_selected_windows (&buffer_defaults, Qt); - BSET (&buffer_defaults, enable_multibyte_characters, Qt); - BSET (&buffer_defaults, buffer_file_coding_system, Qnil); + bset_enable_multibyte_characters (&buffer_defaults, Qt); + bset_buffer_file_coding_system (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); - BSET (&buffer_defaults, cache_long_line_scans, Qnil); - BSET (&buffer_defaults, file_truename, Qnil); + bset_cache_long_line_scans (&buffer_defaults, Qnil); + bset_file_truename (&buffer_defaults, Qnil); XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); - BSET (&buffer_defaults, left_fringe_width, Qnil); - BSET (&buffer_defaults, right_fringe_width, Qnil); - BSET (&buffer_defaults, fringes_outside_margins, Qnil); - BSET (&buffer_defaults, scroll_bar_width, Qnil); - BSET (&buffer_defaults, vertical_scroll_bar_type, Qt); - BSET (&buffer_defaults, indicate_empty_lines, Qnil); - BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil); - BSET (&buffer_defaults, fringe_indicator_alist, Qnil); - BSET (&buffer_defaults, fringe_cursor_alist, Qnil); - BSET (&buffer_defaults, scroll_up_aggressively, Qnil); - BSET (&buffer_defaults, scroll_down_aggressively, Qnil); - BSET (&buffer_defaults, display_time, Qnil); + bset_left_fringe_width (&buffer_defaults, Qnil); + bset_right_fringe_width (&buffer_defaults, Qnil); + bset_fringes_outside_margins (&buffer_defaults, Qnil); + bset_scroll_bar_width (&buffer_defaults, Qnil); + bset_vertical_scroll_bar_type (&buffer_defaults, Qt); + bset_indicate_empty_lines (&buffer_defaults, Qnil); + bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); + bset_fringe_indicator_alist (&buffer_defaults, Qnil); + bset_fringe_cursor_alist (&buffer_defaults, Qnil); + bset_scroll_up_aggressively (&buffer_defaults, Qnil); + bset_scroll_down_aggressively (&buffer_defaults, Qnil); + bset_display_time (&buffer_defaults, Qnil); /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -4997,24 +5222,24 @@ /* 0 means not a lisp var, -1 means always local, else mask */ memset (&buffer_local_flags, 0, sizeof buffer_local_flags); - BSET (&buffer_local_flags, filename, make_number (-1)); - BSET (&buffer_local_flags, directory, make_number (-1)); - BSET (&buffer_local_flags, backed_up, make_number (-1)); - BSET (&buffer_local_flags, save_length, make_number (-1)); - BSET (&buffer_local_flags, auto_save_file_name, make_number (-1)); - BSET (&buffer_local_flags, read_only, make_number (-1)); - BSET (&buffer_local_flags, major_mode, make_number (-1)); - BSET (&buffer_local_flags, mode_name, make_number (-1)); - BSET (&buffer_local_flags, undo_list, make_number (-1)); - BSET (&buffer_local_flags, mark_active, make_number (-1)); - BSET (&buffer_local_flags, point_before_scroll, make_number (-1)); - BSET (&buffer_local_flags, file_truename, make_number (-1)); - BSET (&buffer_local_flags, invisibility_spec, make_number (-1)); - BSET (&buffer_local_flags, file_format, make_number (-1)); - BSET (&buffer_local_flags, auto_save_file_format, make_number (-1)); - BSET (&buffer_local_flags, display_count, make_number (-1)); - BSET (&buffer_local_flags, display_time, make_number (-1)); - BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1)); + bset_filename (&buffer_local_flags, make_number (-1)); + bset_directory (&buffer_local_flags, make_number (-1)); + bset_backed_up (&buffer_local_flags, make_number (-1)); + bset_save_length (&buffer_local_flags, make_number (-1)); + bset_auto_save_file_name (&buffer_local_flags, make_number (-1)); + bset_read_only (&buffer_local_flags, make_number (-1)); + bset_major_mode (&buffer_local_flags, make_number (-1)); + bset_mode_name (&buffer_local_flags, make_number (-1)); + bset_undo_list (&buffer_local_flags, make_number (-1)); + bset_mark_active (&buffer_local_flags, make_number (-1)); + bset_point_before_scroll (&buffer_local_flags, make_number (-1)); + bset_file_truename (&buffer_local_flags, make_number (-1)); + bset_invisibility_spec (&buffer_local_flags, make_number (-1)); + bset_file_format (&buffer_local_flags, make_number (-1)); + bset_auto_save_file_format (&buffer_local_flags, make_number (-1)); + bset_display_count (&buffer_local_flags, make_number (-1)); + bset_display_time (&buffer_local_flags, make_number (-1)); + bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); idx = 1; XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; @@ -5070,7 +5295,7 @@ QSFundamental = build_pure_c_string ("Fundamental"); Qfundamental_mode = intern_c_string ("fundamental-mode"); - BSET (&buffer_defaults, major_mode, Qfundamental_mode); + bset_major_mode (&buffer_defaults, Qfundamental_mode); Qmode_class = intern_c_string ("mode-class"); @@ -5133,13 +5358,13 @@ len++; } - BSET (current_buffer, directory, make_unibyte_string (pwd, len)); + bset_directory (current_buffer, make_unibyte_string (pwd, len)); if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) /* At this moment, we still don't know how to decode the directory name. So, we keep the bytes in multibyte form so that ENCODE_FILE correctly gets the original bytes. */ - BSET (current_buffer, directory, - string_to_multibyte (BVAR (current_buffer, directory))); + bset_directory + (current_buffer, string_to_multibyte (BVAR (current_buffer, directory))); /* Add /: to the front of the name if it would otherwise be treated as magic. */ @@ -5150,11 +5375,12 @@ However, it is not necessary to turn / into /:/. So avoid doing that. */ && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) - BSET (current_buffer, directory, - concat2 (build_string ("/:"), BVAR (current_buffer, directory))); + bset_directory + (current_buffer, + concat2 (build_string ("/:"), BVAR (current_buffer, directory))); temp = get_minibuffer (0); - BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory)); + bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); free (pwd); } === modified file 'src/buffer.h' --- src/buffer.h 2012-08-17 21:12:11 +0000 +++ src/buffer.h 2012-08-18 06:06:39 +0000 @@ -477,7 +477,6 @@ /* Most code should use this macro to access Lisp fields in struct buffer. */ #define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) -#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value)) /* This is the structure that the buffer Lisp object points to. */ @@ -862,6 +861,104 @@ Lisp_Object INTERNAL_FIELD (undo_list); }; +/* Most code should use these functions to set Lisp fields in struct + buffer. */ +BUFFER_INLINE void +bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (bidi_paragraph_direction) = val; +} +BUFFER_INLINE void +bset_case_canon_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_canon_table) = val; +} +BUFFER_INLINE void +bset_case_eqv_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (case_eqv_table) = val; +} +BUFFER_INLINE void +bset_directory (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (directory) = val; +} +BUFFER_INLINE void +bset_display_count (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_count) = val; +} +BUFFER_INLINE void +bset_display_time (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (display_time) = val; +} +BUFFER_INLINE void +bset_downcase_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (downcase_table) = val; +} +BUFFER_INLINE void +bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (enable_multibyte_characters) = val; +} +BUFFER_INLINE void +bset_filename (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (filename) = val; +} +BUFFER_INLINE void +bset_keymap (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (keymap) = val; +} +BUFFER_INLINE void +bset_last_selected_window (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (last_selected_window) = val; +} +BUFFER_INLINE void +bset_local_var_alist (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (local_var_alist) = val; +} +BUFFER_INLINE void +bset_mark_active (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (mark_active) = val; +} +BUFFER_INLINE void +bset_point_before_scroll (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (point_before_scroll) = val; +} +BUFFER_INLINE void +bset_read_only (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (read_only) = val; +} +BUFFER_INLINE void +bset_truncate_lines (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (truncate_lines) = val; +} +BUFFER_INLINE void +bset_undo_list (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (undo_list) = val; +} +BUFFER_INLINE void +bset_upcase_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (upcase_table) = val; +} +BUFFER_INLINE void +bset_width_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (width_table) = val; +} + /* Chain of all buffers, including killed ones. */ === modified file 'src/casetab.c' --- src/casetab.c 2012-08-17 17:08:30 +0000 +++ src/casetab.c 2012-08-18 06:06:39 +0000 @@ -158,10 +158,10 @@ } else { - BSET (current_buffer, downcase_table, table); - BSET (current_buffer, upcase_table, up); - BSET (current_buffer, case_canon_table, canon); - BSET (current_buffer, case_eqv_table, eqv); + bset_downcase_table (current_buffer, table); + bset_upcase_table (current_buffer, up); + bset_case_canon_table (current_buffer, canon); + bset_case_eqv_table (current_buffer, eqv); } return table; === modified file 'src/category.c' --- src/category.c 2012-08-17 17:08:30 +0000 +++ src/category.c 2012-08-18 06:06:39 +0000 @@ -40,6 +40,13 @@ #include "category.h" #include "keymap.h" +/* This setter is used only in this file, so it can be private. */ +static inline void +bset_category_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (category_table) = val; +} + /* The version number of the latest category table. Each category table has a unique version number. It is assigned a new number also when it is modified. When a regular expression is compiled @@ -285,7 +292,7 @@ { int idx; table = check_category_table (table); - BSET (current_buffer, category_table, table); + bset_category_table (current_buffer, table); /* Indicate that this buffer now has a specified category table. */ idx = PER_BUFFER_VAR_IDX (category_table); SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); === modified file 'src/cmds.c' --- src/cmds.c 2012-08-13 03:39:07 +0000 +++ src/cmds.c 2012-08-18 06:06:39 +0000 @@ -301,7 +301,7 @@ added be explicit calls to undo-boundary. */ && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) /* Remove the undo_boundary that was just pushed. */ - BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, XCDR (BVAR (current_buffer, undo_list))); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_event)) === modified file 'src/coding.c' --- src/coding.c 2012-08-18 00:07:52 +0000 +++ src/coding.c 2012-08-18 06:06:39 +0000 @@ -7112,7 +7112,7 @@ record_first_change (); undo_list = BVAR (current_buffer, undo_list); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); } coding->consumed = coding->consumed_char = 0; @@ -7209,7 +7209,7 @@ decode_eol (coding); if (BUFFERP (coding->dst_object)) { - BSET (current_buffer, undo_list, undo_list); + bset_undo_list (current_buffer, undo_list); record_insert (coding->dst_pos, coding->produced_char); } return coding->result; @@ -7577,8 +7577,8 @@ doesn't compile new regexps. */ Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); Ferase_buffer (); - BSET (current_buffer, undo_list, Qt); - BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil); + bset_undo_list (current_buffer, Qt); + bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil); set_buffer_internal (current); return workbuf; } === modified file 'src/data.c' --- src/data.c 2012-08-17 14:24:43 +0000 +++ src/data.c 2012-08-18 06:06:39 +0000 @@ -1213,8 +1213,9 @@ bindings, not for frame-local bindings. */ eassert (!blv->frame_local); tem1 = Fcons (symbol, XCDR (blv->defcell)); - BSET (XBUFFER (where), local_var_alist, - Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); + bset_local_var_alist + (XBUFFER (where), + Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); } } @@ -1653,9 +1654,10 @@ default value. */ find_symbol_value (variable); - BSET (current_buffer, local_var_alist, - Fcons (Fcons (variable, XCDR (blv->defcell)), - BVAR (current_buffer, local_var_alist))); + bset_local_var_alist + (current_buffer, + Fcons (Fcons (variable, XCDR (blv->defcell)), + BVAR (current_buffer, local_var_alist))); /* Make sure symbol does not think it is set up for this buffer; force it to look once again for this buffer's value. */ @@ -1721,8 +1723,9 @@ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); if (!NILP (tem)) - BSET (current_buffer, local_var_alist, - Fdelq (tem, BVAR (current_buffer, local_var_alist))); + bset_local_var_alist + (current_buffer, + Fdelq (tem, BVAR (current_buffer, local_var_alist))); /* If the symbol is set up with the current buffer's binding loaded, recompute its value. We have to do it now, or else === modified file 'src/editfns.c' --- src/editfns.c 2012-08-17 21:12:11 +0000 +++ src/editfns.c 2012-08-18 06:06:39 +0000 @@ -881,7 +881,7 @@ info = XCDR (info); tem = XCAR (info); tem1 = BVAR (current_buffer, mark_active); - BSET (current_buffer, mark_active, tem); + bset_mark_active (current_buffer, tem); /* If mark is active now, and either was not active or was at a different place, run the activate hook. */ @@ -2815,13 +2815,15 @@ static Lisp_Object subst_char_in_region_unwind (Lisp_Object arg) { - return BSET (current_buffer, undo_list, arg); + bset_undo_list (current_buffer, arg); + return arg; } static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object arg) { - return BSET (current_buffer, filename, arg); + bset_filename (current_buffer, arg); + return arg; } DEFUN ("subst-char-in-region", Fsubst_char_in_region, @@ -2895,11 +2897,11 @@ { record_unwind_protect (subst_char_in_region_unwind, BVAR (current_buffer, undo_list)); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); /* Don't do file-locking. */ record_unwind_protect (subst_char_in_region_unwind_1, BVAR (current_buffer, filename)); - BSET (current_buffer, filename, Qnil); + bset_filename (current_buffer, Qnil); } if (pos_byte < GPT_BYTE) @@ -2981,7 +2983,7 @@ INC_POS (pos_byte_next); if (! NILP (noundo)) - BSET (current_buffer, undo_list, tem); + bset_undo_list (current_buffer, tem); UNGCPRO; } === modified file 'src/fileio.c' --- src/fileio.c 2012-08-17 21:12:11 +0000 +++ src/fileio.c 2012-08-18 06:06:39 +0000 @@ -3150,8 +3150,8 @@ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); /* Now we are safe to change the buffer's multibyteness directly. */ - BSET (current_buffer, enable_multibyte_characters, multibyte); - BSET (current_buffer, undo_list, undo_list); + bset_enable_multibyte_characters (current_buffer, multibyte); + bset_undo_list (current_buffer, undo_list); return Qnil; } @@ -3487,16 +3487,16 @@ buf = XBUFFER (workbuf); delete_all_overlays (buf); - BSET (buf, directory, BVAR (current_buffer, directory)); - BSET (buf, read_only, Qnil); - BSET (buf, filename, Qnil); - BSET (buf, undo_list, Qt); + bset_directory (buf, BVAR (current_buffer, directory)); + bset_read_only (buf, Qnil); + bset_filename (buf, Qnil); + bset_undo_list (buf, Qt); eassert (buf->overlays_before == NULL); eassert (buf->overlays_after == NULL); set_buffer_internal (buf); Ferase_buffer (); - BSET (buf, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (buf, Qnil); insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -4105,8 +4105,8 @@ unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), Fcons (BVAR (current_buffer, undo_list), Fcurrent_buffer ())); - BSET (current_buffer, enable_multibyte_characters, Qnil); - BSET (current_buffer, undo_list, Qt); + bset_enable_multibyte_characters (current_buffer, Qnil); + bset_undo_list (current_buffer, Qt); record_unwind_protect (decide_coding_unwind, unwind_data); if (inserted > 0 && ! NILP (Vset_auto_coding_function)) @@ -4154,7 +4154,7 @@ && NILP (replace)) /* Visiting a file with these coding system makes the buffer unibyte. */ - BSET (current_buffer, enable_multibyte_characters, Qnil); + bset_enable_multibyte_characters (current_buffer, Qnil); } coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); @@ -4197,13 +4197,13 @@ if (!NILP (visit)) { if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) - BSET (current_buffer, undo_list, Qnil); + bset_undo_list (current_buffer, Qnil); if (NILP (handler)) { current_buffer->modtime = mtime; current_buffer->modtime_size = st.st_size; - BSET (current_buffer, filename, orig_filename); + bset_filename (current_buffer, orig_filename); } SAVE_MODIFF = MODIFF; @@ -4248,7 +4248,7 @@ /* Save old undo list and don't record undo for decoding. */ old_undo = BVAR (current_buffer, undo_list); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); if (NILP (replace)) { @@ -4340,7 +4340,7 @@ if (NILP (visit)) { - BSET (current_buffer, undo_list, old_undo); + bset_undo_list (current_buffer, old_undo); if (CONSP (old_undo) && inserted != old_inserted) { /* Adjust the last undo record for the size change during @@ -4355,7 +4355,7 @@ else /* If undo_list was Qt before, keep it that way. Otherwise start with an empty undo_list. */ - BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil); + bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil); unbind_to (count1, Qnil); } @@ -4595,7 +4595,7 @@ { SAVE_MODIFF = MODIFF; XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); - BSET (current_buffer, filename, visit_file); + bset_filename (current_buffer, visit_file); } UNGCPRO; return val; @@ -4811,7 +4811,7 @@ { SAVE_MODIFF = MODIFF; XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); - BSET (current_buffer, filename, visit_file); + bset_filename (current_buffer, visit_file); update_mode_lines++; } else if (quietly) === modified file 'src/frame.c' --- src/frame.c 2012-08-18 01:42:52 +0000 +++ src/frame.c 2012-08-18 06:06:39 +0000 @@ -1700,7 +1700,7 @@ w = XWINDOW (window); if (!NILP (w->buffer)) - BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ()); + bset_display_time (XBUFFER (w->buffer), Fcurrent_time ()); if (!NILP (w->vchild)) make_frame_visible_1 (w->vchild); === modified file 'src/indent.c' --- src/indent.c 2012-08-18 01:42:52 +0000 +++ src/indent.c 2012-08-18 06:06:39 +0000 @@ -141,7 +141,7 @@ struct Lisp_Vector *widthtab; if (!VECTORP (BVAR (buf, width_table))) - BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0))); + bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); widthtab = XVECTOR (BVAR (buf, width_table)); if (widthtab->header.size != 256) abort (); @@ -166,7 +166,7 @@ { free_region_cache (current_buffer->width_run_cache); current_buffer->width_run_cache = 0; - BSET (current_buffer, width_table, Qnil); + bset_width_table (current_buffer, Qnil); } } else === modified file 'src/insdel.c' --- src/insdel.c 2012-08-17 21:12:11 +0000 +++ src/insdel.c 2012-08-18 06:06:39 +0000 @@ -1792,7 +1792,7 @@ if (! preserve_chars_modiff) CHARS_MODIFF = MODIFF; - BSET (buffer, point_before_scroll, Qnil); + bset_point_before_scroll (buffer, Qnil); if (buffer != old_buffer) set_buffer_internal (old_buffer); === modified file 'src/intervals.c' --- src/intervals.c 2012-08-17 21:12:11 +0000 +++ src/intervals.c 2012-08-18 06:06:39 +0000 @@ -1887,7 +1887,7 @@ int have_overlays; ptrdiff_t original_position; - BSET (current_buffer, point_before_scroll, Qnil); + bset_point_before_scroll (current_buffer, Qnil); if (charpos == PT) return; === modified file 'src/keymap.c' --- src/keymap.c 2012-08-13 03:39:07 +0000 +++ src/keymap.c 2012-08-18 06:06:39 +0000 @@ -1854,7 +1854,7 @@ if (!NILP (keymap)) keymap = get_keymap (keymap, 1, 1); - BSET (current_buffer, keymap, keymap); + bset_keymap (current_buffer, keymap); return Qnil; } === modified file 'src/minibuf.c' --- src/minibuf.c 2012-08-15 04:02:14 +0000 +++ src/minibuf.c 2012-08-18 06:06:39 +0000 @@ -565,11 +565,11 @@ /* Defeat (setq-default truncate-lines t), since truncated lines do not work correctly in minibuffers. (Bug#5715, etc) */ - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ if (inherit_input_method) - BSET (current_buffer, enable_multibyte_characters, enable_multibyte); + bset_enable_multibyte_characters (current_buffer, enable_multibyte); /* The current buffer's default directory is usually the right thing for our minibuffer here. However, if you're typing a command at @@ -580,7 +580,7 @@ you think of something better to do? Find another buffer with a better directory, and use that one instead. */ if (STRINGP (ambient_dir)) - BSET (current_buffer, directory, ambient_dir); + bset_directory (current_buffer, ambient_dir); else { Lisp_Object buf_list; @@ -594,8 +594,8 @@ other_buf = XCDR (XCAR (buf_list)); if (STRINGP (BVAR (XBUFFER (other_buf), directory))) { - BSET (current_buffer, directory, - BVAR (XBUFFER (other_buf), directory)); + bset_directory (current_buffer, + BVAR (XBUFFER (other_buf), directory)); break; } } @@ -672,7 +672,7 @@ } clear_message (1, 1); - BSET (current_buffer, keymap, map); + bset_keymap (current_buffer, map); /* Turn on an input method stored in INPUT_METHOD if any. */ if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) @@ -681,7 +681,7 @@ Frun_hooks (1, &Qminibuffer_setup_hook); /* Don't allow the user to undo past this point. */ - BSET (current_buffer, undo_list, Qnil); + bset_undo_list (current_buffer, Qnil); recursive_edit_1 (); === modified file 'src/print.c' --- src/print.c 2012-08-17 21:12:11 +0000 +++ src/print.c 2012-08-18 06:06:39 +0000 @@ -494,14 +494,14 @@ Fkill_all_local_variables (); delete_all_overlays (current_buffer); - BSET (current_buffer, directory, BVAR (old, directory)); - BSET (current_buffer, read_only, Qnil); - BSET (current_buffer, filename, Qnil); - BSET (current_buffer, undo_list, Qt); + bset_directory (current_buffer, BVAR (old, directory)); + bset_read_only (current_buffer, Qnil); + bset_filename (current_buffer, Qnil); + bset_undo_list (current_buffer, Qt); eassert (current_buffer->overlays_before == NULL); eassert (current_buffer->overlays_after == NULL); - BSET (current_buffer, enable_multibyte_characters, - BVAR (&buffer_defaults, enable_multibyte_characters)); + bset_enable_multibyte_characters + (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters)); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); === modified file 'src/process.c' --- src/process.c 2012-08-18 02:49:24 +0000 +++ src/process.c 2012-08-18 06:06:39 +0000 @@ -5330,7 +5330,7 @@ old_begv_byte = BEGV_BYTE; old_zv_byte = ZV_BYTE; - BSET (current_buffer, read_only, Qnil); + bset_read_only (current_buffer, Qnil); /* Insert new output into buffer at the current end-of-output marker, @@ -5421,7 +5421,7 @@ Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); - BSET (current_buffer, read_only, old_read_only); + bset_read_only (current_buffer, old_read_only); SET_PT_BOTH (opoint, opoint_byte); } /* Handling the process output should not deactivate the mark. */ @@ -6755,13 +6755,13 @@ before_byte = PT_BYTE; tem = BVAR (current_buffer, read_only); - BSET (current_buffer, read_only, Qnil); + bset_read_only (current_buffer, Qnil); insert_string ("\nProcess "); { /* FIXME: temporary kludge */ Lisp_Object tem2 = p->name; Finsert (1, &tem2); } insert_string (" "); Finsert (1, &msg); - BSET (current_buffer, read_only, tem); + bset_read_only (current_buffer, tem); set_marker_both (p->mark, p->buffer, PT, PT_BYTE); if (opoint >= before) === modified file 'src/syntax.c' --- src/syntax.c 2012-08-17 16:48:22 +0000 +++ src/syntax.c 2012-08-18 06:06:39 +0000 @@ -149,6 +149,13 @@ ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, int, Lisp_Object, int); static int in_classes (int, Lisp_Object); + +/* This setter is used only in this file, so it can be private. */ +static inline void +bset_syntax_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (syntax_table) = val; +} /* Whether the syntax of the character C has the prefix flag set. */ int syntax_prefix_flag_p (int c) @@ -835,7 +842,7 @@ { int idx; check_syntax_table (table); - BSET (current_buffer, syntax_table, table); + bset_syntax_table (current_buffer, table); /* Indicate that this buffer now has a specified syntax table. */ idx = PER_BUFFER_VAR_IDX (syntax_table); SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); === modified file 'src/undo.c' --- src/undo.c 2012-08-13 03:39:07 +0000 +++ src/undo.c 2012-08-18 06:06:39 +0000 @@ -104,9 +104,9 @@ if (at_boundary && current_buffer == last_boundary_buffer && last_boundary_position != pt) - BSET (current_buffer, undo_list, - Fcons (make_number (last_boundary_position), - BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (make_number (last_boundary_position), + BVAR (current_buffer, undo_list))); } /* Record an insertion that just happened or is about to happen, @@ -142,8 +142,8 @@ XSETFASTINT (lbeg, beg); XSETINT (lend, beg + length); - BSET (current_buffer, undo_list, - Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); } /* Record that a deletion is about to take place, @@ -168,8 +168,9 @@ record_point (beg); } - BSET (current_buffer, undo_list, - Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); } /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. @@ -191,9 +192,10 @@ Fundo_boundary (); last_undo_buffer = current_buffer; - BSET (current_buffer, undo_list, - Fcons (Fcons (marker, make_number (adjustment)), - BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (marker, make_number (adjustment)), + BVAR (current_buffer, undo_list))); } /* Record that a replacement is about to take place, @@ -226,9 +228,10 @@ if (base_buffer->base_buffer) base_buffer = base_buffer->base_buffer; - BSET (current_buffer, undo_list, - Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), - BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), + BVAR (current_buffer, undo_list))); } /* Record a change in property PROP (whose old value was VAL) @@ -266,8 +269,8 @@ XSETINT (lbeg, beg); XSETINT (lend, beg + length); entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); - BSET (current_buffer, undo_list, - Fcons (entry, BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (entry, BVAR (current_buffer, undo_list))); current_buffer = obuf; } @@ -290,11 +293,12 @@ /* If we have preallocated the cons cell to use here, use that one. */ XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); - BSET (current_buffer, undo_list, pending_boundary); + bset_undo_list (current_buffer, pending_boundary); pending_boundary = Qnil; } else - BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list))); + bset_undo_list (current_buffer, + Fcons (Qnil, BVAR (current_buffer, undo_list))); } last_boundary_position = PT; last_boundary_buffer = current_buffer; @@ -435,7 +439,7 @@ XSETCDR (last_boundary, Qnil); /* There's nothing we decided to keep, so clear it out. */ else - BSET (b, undo_list, Qnil); + bset_undo_list (b, Qnil); unbind_to (count, Qnil); } @@ -650,8 +654,9 @@ will work right. */ if (did_apply && EQ (oldlist, BVAR (current_buffer, undo_list))) - BSET (current_buffer, undo_list, - Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); + bset_undo_list + (current_buffer, + Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); UNGCPRO; return unbind_to (count, list); === modified file 'src/w32fns.c' --- src/w32fns.c 2012-08-18 01:42:52 +0000 +++ src/w32fns.c 2012-08-18 06:06:39 +0000 @@ -5242,7 +5242,7 @@ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5672,7 +5672,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); === modified file 'src/window.c' --- src/window.c 2012-08-18 01:42:52 +0000 +++ src/window.c 2012-08-18 06:06:39 +0000 @@ -512,7 +512,7 @@ Fset_buffer (w->buffer); - BSET (XBUFFER (w->buffer), last_selected_window, window); + bset_last_selected_window (XBUFFER (w->buffer), window); /* Go to the point recorded in the window. This is important when the buffer is in more @@ -1972,7 +1972,7 @@ if (WINDOWP (BVAR (b, last_selected_window)) && w == XWINDOW (BVAR (b, last_selected_window))) - BSET (b, last_selected_window, Qnil); + bset_last_selected_window (b, Qnil); } /* Put NEW into the window structure in place of OLD. SETFLAG zero @@ -3148,15 +3148,15 @@ wset_buffer (w, buffer); if (EQ (window, selected_window)) - BSET (b, last_selected_window, window); + bset_last_selected_window (b, window); /* Let redisplay errors through. */ b->display_error_modiff = 0; /* Update time stamps of buffer display. */ if (INTEGERP (BVAR (b, display_count))) - BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); - BSET (b, display_time, Fcurrent_time ()); + bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1)); + bset_display_time (b, Fcurrent_time ()); wset_window_end_pos (w, make_number (0)); wset_window_end_vpos (w, make_number (0)); @@ -3347,7 +3347,7 @@ register Lisp_Object window; register struct window *w; - BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory)); + bset_directory (XBUFFER (buf), BVAR (current_buffer, directory)); Fset_buffer (buf); BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-18 01:42:52 +0000 +++ src/xdisp.c 2012-08-18 06:06:39 +0000 @@ -9340,7 +9340,7 @@ old_deactivate_mark = Vdeactivate_mark; oldbuf = current_buffer; Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); - BSET (current_buffer, undo_list, Qt); + bset_undo_list (current_buffer, Qt); oldpoint = message_dolog_marker1; set_marker_restricted (oldpoint, make_number (PT), Qnil); @@ -9902,7 +9902,7 @@ old_buffer = echo_buffer[i]; echo_buffer[i] = Fget_buffer_create (make_formatted_string (name, " *Echo Area %d*", i)); - BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil); + bset_truncate_lines (XBUFFER (echo_buffer[i]), Qnil); /* to force word wrap in echo area - it was decided to postpone this*/ /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ @@ -9995,8 +9995,8 @@ set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); } - BSET (current_buffer, undo_list, Qt); - BSET (current_buffer, read_only, Qnil); + bset_undo_list (current_buffer, Qt); + bset_read_only (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -10109,7 +10109,7 @@ /* Switch to that buffer and clear it. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); if (Z > BEG) { @@ -10152,7 +10152,7 @@ { /* Someone switched buffers between print requests. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); } } } @@ -10604,9 +10604,9 @@ != !NILP (BVAR (current_buffer, enable_multibyte_characters))) Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); - BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil); + bset_truncate_lines (current_buffer, message_truncate_lines ? Qt : Qnil); if (!NILP (BVAR (current_buffer, bidi_display_reordering))) - BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right); + bset_bidi_paragraph_direction (current_buffer, Qleft_to_right); /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); === modified file 'src/xfns.c' --- src/xfns.c 2012-08-18 01:42:52 +0000 +++ src/xfns.c 2012-08-18 06:06:39 +0000 @@ -4590,7 +4590,7 @@ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5087,7 +5087,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - BSET (current_buffer, truncate_lines, Qnil); + bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE);