aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in77
-rw-r--r--src/alloc.c4
-rw-r--r--src/autodeps.mk5
-rw-r--r--src/buffer.c92
-rw-r--r--src/buffer.h188
-rw-r--r--src/category.c2
-rw-r--r--src/cmds.c2
-rw-r--r--src/deps.mk2
-rw-r--r--src/editfns.c10
-rw-r--r--src/filelock.c49
-rw-r--r--src/gtkutil.c90
-rw-r--r--src/image.c4
-rw-r--r--src/keyboard.c28
-rw-r--r--src/keyboard.h52
-rw-r--r--src/lisp.h4
-rw-r--r--src/lisp.mk174
-rw-r--r--src/lread.c6
-rw-r--r--src/macfont.h6
-rw-r--r--src/nsfns.m31
-rw-r--r--src/nsimage.m104
-rw-r--r--src/nsmenu.m6
-rw-r--r--src/nsterm.h9
-rw-r--r--src/nsterm.m211
-rw-r--r--src/process.c4
-rw-r--r--src/syntax.c2
-rw-r--r--src/window.c6
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xterm.c15
28 files changed, 615 insertions, 579 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 9e7a8a79915..d0df3260356 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -327,10 +327,15 @@ am__v_at_0 = @
327am__v_at_1 = 327am__v_at_1 =
328 328
329DEPDIR=deps 329DEPDIR=deps
330## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty. 330AUTO_DEPEND = @AUTO_DEPEND@
331DEPFLAGS=@DEPFLAGS@ 331
332## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'. 332ifeq ($(AUTO_DEPEND),yes)
333MKDEPDIR=@MKDEPDIR@ 333DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
334MKDEPDIR = ${MKDIR_P} ${DEPDIR}
335else
336DEPFLAGS =
337MKDEPDIR = :
338endif
334 339
335## DO NOT use -R. There is a special hack described in lastfile.c 340## DO NOT use -R. There is a special hack described in lastfile.c
336## which is used instead. Some initialized data areas are modified 341## which is used instead. Some initialized data areas are modified
@@ -417,9 +422,37 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
417FIRSTFILE_OBJ=@FIRSTFILE_OBJ@ 422FIRSTFILE_OBJ=@FIRSTFILE_OBJ@
418ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj) 423ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
419 424
420## Configure inserts the file lisp.mk at this point, defining $lisp. 425## This is the list of all Lisp files that might be loaded into the
421@lisp_frag@ 426## dumped Emacs. Some of them are not loaded on all platforms, but
422 427## the DOC file on every platform uses them (because the DOC file is
428## supposed to be platform-independent).
429## Note that this list should not include lisp files which might not
430## be present, like site-load.el and site-init.el; this makefile
431## expects them all to be either present or buildable.
432##
433## To generate this list from loadup.el, we can either:
434## 1) Extract everything matching (load "..."), in which case
435## we need to add charprop.el by hand; or
436## 2) Extract everything matching (load "...", in which case
437## we need to remove leim-list, site-init, and site-load by hand.
438## There's not much to choose between these two approaches,
439## but the second one seems like it could be more future-proof.
440shortlisp =
441lisp.mk: $(lispsource)/loadup.el
442 @rm -f $@
443 ${AM_V_GEN}( echo "shortlisp = \\"; \
444 sed -n 's/^[ \t]*(load "\([^"]*\)".*/\1/p' $< | \
445 sed -e 's/$$/.elc \\/' -e 's/\.el\.elc/.el/'; \
446 echo "" ) > $@
447
448-include lisp.mk
449shortlisp_filter = leim/leim-list.el site-load.elc site-init.elc
450shortlisp := $(filter-out ${shortlisp_filter},${shortlisp})
451## Place loaddefs.el first, so it gets generated first, since it is on
452## the critical path (relevant in parallel compilations).
453## We don't really need to sort, but may as well use it to remove duplicates.
454shortlisp := loaddefs.el loadup.el $(sort ${shortlisp})
455lisp = $(addprefix ${lispsource}/,${shortlisp})
423 456
424## Construct full set of libraries to be linked. 457## Construct full set of libraries to be linked.
425LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ 458LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
@@ -453,7 +486,7 @@ $(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \
453## since not all pieces are used on all platforms. But DOC depends 486## since not all pieces are used on all platforms. But DOC depends
454## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here. 487## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
455emacs$(EXEEXT): temacs$(EXEEXT) \ 488emacs$(EXEEXT): temacs$(EXEEXT) \
456 $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \ 489 lisp.mk $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \
457 $(lispsource)/international/charprop.el 490 $(lispsource)/international/charprop.el
458ifeq ($(CANNOT_DUMP),yes) 491ifeq ($(CANNOT_DUMP),yes)
459 ln -f temacs$(EXEEXT) $@ 492 ln -f temacs$(EXEEXT) $@
@@ -464,12 +497,9 @@ else
464endif 497endif
465 498
466## We run make-docfile twice because the command line may get too long 499## We run make-docfile twice because the command line may get too long
467## on some systems. The sed command operating on lisp.mk also reduces 500## on some systems. Unfortunately, no-one has any idea
468## the length of the command line. Unfortunately, no-one has any idea
469## exactly how long the maximum safe command line length is on all the 501## exactly how long the maximum safe command line length is on all the
470## various systems that Emacs supports. Obviously, the length depends 502## various systems that Emacs supports.
471## on what your value of $srcdir is. If the length restriction goes
472## away, lisp.mk can be merged back into this file.
473## 503##
474## $(SOME_MACHINE_OBJECTS) comes before $(obj) because some files may 504## $(SOME_MACHINE_OBJECTS) comes before $(obj) because some files may
475## or may not be included in $(obj), but they are always included in 505## or may not be included in $(obj), but they are always included in
@@ -477,14 +507,13 @@ endif
477## for the first time, this prevents any variation between configurations 507## for the first time, this prevents any variation between configurations
478## in the contents of the DOC file. 508## in the contents of the DOC file.
479## 509##
480$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp) 510$(etc)/DOC: lisp.mk $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp)
481 $(AM_V_GEN)$(MKDIR_P) $(etc) 511 $(AM_V_GEN)$(MKDIR_P) $(etc)
482 -$(AM_V_at)rm -f $(etc)/DOC 512 -$(AM_V_at)rm -f $(etc)/DOC
483 $(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \ 513 $(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \
484 $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC 514 $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC
485 $(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \ 515 $(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \
486 `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' \ 516 $(shortlisp)
487 $(srcdir)/lisp.mk`
488 517
489$(libsrc)/make-docfile$(EXEEXT): 518$(libsrc)/make-docfile$(EXEEXT):
490 $(MAKE) -C $(libsrc) make-docfile$(EXEEXT) 519 $(MAKE) -C $(libsrc) make-docfile$(EXEEXT)
@@ -584,7 +613,7 @@ bootstrap-clean: clean
584 fi 613 fi
585 614
586distclean: bootstrap-clean 615distclean: bootstrap-clean
587 rm -f Makefile 616 rm -f Makefile lisp.mk
588 617
589maintainer-clean: distclean 618maintainer-clean: distclean
590 rm -f TAGS 619 rm -f TAGS
@@ -607,9 +636,11 @@ ctagsfiles3 = [a-zA-Z]*.m
607## rather than the file contents. 636## rather than the file contents.
608TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(srcdir)/$(ctagsfiles3) 637TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(srcdir)/$(ctagsfiles3)
609 "$(ETAGS)" --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ 638 "$(ETAGS)" --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \
610 --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ 639 --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \
640 --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \
611 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) \ 641 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) \
612 --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ 642 --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \
643 --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \
613 $(srcdir)/$(ctagsfiles3) 644 $(srcdir)/$(ctagsfiles3)
614 645
615## Arrange to make tags tables for ../lisp and ../lwlib, 646## Arrange to make tags tables for ../lisp and ../lwlib,
@@ -669,8 +700,10 @@ endif
669 @: Compile some files earlier to speed up further compilation. 700 @: Compile some files earlier to speed up further compilation.
670 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" 701 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
671 702
672## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. 703ifeq ($(AUTO_DEPEND),yes)
673@deps_frag@ 704-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
674 705else
706include $(srcdir)/deps.mk
707endif
675 708
676### Makefile.in ends here 709### Makefile.in ends here
diff --git a/src/alloc.c b/src/alloc.c
index 1f4b1a4694e..030c6e06ba8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4496,7 +4496,7 @@ live_buffer_p (struct mem_node *m, void *p)
4496 must not have been killed. */ 4496 must not have been killed. */
4497 return (m->type == MEM_TYPE_BUFFER 4497 return (m->type == MEM_TYPE_BUFFER
4498 && p == m->start 4498 && p == m->start
4499 && !NILP (((struct buffer *) p)->INTERNAL_FIELD (name))); 4499 && !NILP (((struct buffer *) p)->name_));
4500} 4500}
4501 4501
4502#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ 4502#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -5762,7 +5762,7 @@ garbage_collect_1 (void *end)
5762 after GC. It's important to scan finalizers at this stage so 5762 after GC. It's important to scan finalizers at this stage so
5763 that we can be sure that unmarked finalizers are really 5763 that we can be sure that unmarked finalizers are really
5764 unreachable except for references from their associated functions 5764 unreachable except for references from their associated functions
5765 and from other finalizers. */ 5765 and from other finalizers. */
5766 5766
5767 queue_doomed_finalizers (&doomed_finalizers, &finalizers); 5767 queue_doomed_finalizers (&doomed_finalizers, &finalizers);
5768 mark_finalizer_list (&doomed_finalizers); 5768 mark_finalizer_list (&doomed_finalizers);
diff --git a/src/autodeps.mk b/src/autodeps.mk
deleted file mode 100644
index 8b014a7508c..00000000000
--- a/src/autodeps.mk
+++ /dev/null
@@ -1,5 +0,0 @@
1### autodeps.mk --- src/Makefile fragment for GNU Emacs
2
3## This is inserted in src/Makefile if AUTO_DEPEND=yes.
4
5-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/src/buffer.c b/src/buffer.c
index 332d6d51a81..b09676c438d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -134,227 +134,227 @@ CHECK_OVERLAY (Lisp_Object x)
134static void 134static void
135bset_abbrev_mode (struct buffer *b, Lisp_Object val) 135bset_abbrev_mode (struct buffer *b, Lisp_Object val)
136{ 136{
137 b->INTERNAL_FIELD (abbrev_mode) = val; 137 b->abbrev_mode_ = val;
138} 138}
139static void 139static void
140bset_abbrev_table (struct buffer *b, Lisp_Object val) 140bset_abbrev_table (struct buffer *b, Lisp_Object val)
141{ 141{
142 b->INTERNAL_FIELD (abbrev_table) = val; 142 b->abbrev_table_ = val;
143} 143}
144static void 144static void
145bset_auto_fill_function (struct buffer *b, Lisp_Object val) 145bset_auto_fill_function (struct buffer *b, Lisp_Object val)
146{ 146{
147 b->INTERNAL_FIELD (auto_fill_function) = val; 147 b->auto_fill_function_ = val;
148} 148}
149static void 149static void
150bset_auto_save_file_format (struct buffer *b, Lisp_Object val) 150bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
151{ 151{
152 b->INTERNAL_FIELD (auto_save_file_format) = val; 152 b->auto_save_file_format_ = val;
153} 153}
154static void 154static void
155bset_auto_save_file_name (struct buffer *b, Lisp_Object val) 155bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
156{ 156{
157 b->INTERNAL_FIELD (auto_save_file_name) = val; 157 b->auto_save_file_name_ = val;
158} 158}
159static void 159static void
160bset_backed_up (struct buffer *b, Lisp_Object val) 160bset_backed_up (struct buffer *b, Lisp_Object val)
161{ 161{
162 b->INTERNAL_FIELD (backed_up) = val; 162 b->backed_up_ = val;
163} 163}
164static void 164static void
165bset_begv_marker (struct buffer *b, Lisp_Object val) 165bset_begv_marker (struct buffer *b, Lisp_Object val)
166{ 166{
167 b->INTERNAL_FIELD (begv_marker) = val; 167 b->begv_marker_ = val;
168} 168}
169static void 169static void
170bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) 170bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
171{ 171{
172 b->INTERNAL_FIELD (bidi_display_reordering) = val; 172 b->bidi_display_reordering_ = val;
173} 173}
174static void 174static void
175bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) 175bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
176{ 176{
177 b->INTERNAL_FIELD (buffer_file_coding_system) = val; 177 b->buffer_file_coding_system_ = val;
178} 178}
179static void 179static void
180bset_case_fold_search (struct buffer *b, Lisp_Object val) 180bset_case_fold_search (struct buffer *b, Lisp_Object val)
181{ 181{
182 b->INTERNAL_FIELD (case_fold_search) = val; 182 b->case_fold_search_ = val;
183} 183}
184static void 184static void
185bset_ctl_arrow (struct buffer *b, Lisp_Object val) 185bset_ctl_arrow (struct buffer *b, Lisp_Object val)
186{ 186{
187 b->INTERNAL_FIELD (ctl_arrow) = val; 187 b->ctl_arrow_ = val;
188} 188}
189static void 189static void
190bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) 190bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
191{ 191{
192 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; 192 b->cursor_in_non_selected_windows_ = val;
193} 193}
194static void 194static void
195bset_cursor_type (struct buffer *b, Lisp_Object val) 195bset_cursor_type (struct buffer *b, Lisp_Object val)
196{ 196{
197 b->INTERNAL_FIELD (cursor_type) = val; 197 b->cursor_type_ = val;
198} 198}
199static void 199static void
200bset_display_table (struct buffer *b, Lisp_Object val) 200bset_display_table (struct buffer *b, Lisp_Object val)
201{ 201{
202 b->INTERNAL_FIELD (display_table) = val; 202 b->display_table_ = val;
203} 203}
204static void 204static void
205bset_extra_line_spacing (struct buffer *b, Lisp_Object val) 205bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
206{ 206{
207 b->INTERNAL_FIELD (extra_line_spacing) = val; 207 b->extra_line_spacing_ = val;
208} 208}
209static void 209static void
210bset_file_format (struct buffer *b, Lisp_Object val) 210bset_file_format (struct buffer *b, Lisp_Object val)
211{ 211{
212 b->INTERNAL_FIELD (file_format) = val; 212 b->file_format_ = val;
213} 213}
214static void 214static void
215bset_file_truename (struct buffer *b, Lisp_Object val) 215bset_file_truename (struct buffer *b, Lisp_Object val)
216{ 216{
217 b->INTERNAL_FIELD (file_truename) = val; 217 b->file_truename_ = val;
218} 218}
219static void 219static void
220bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) 220bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
221{ 221{
222 b->INTERNAL_FIELD (fringe_cursor_alist) = val; 222 b->fringe_cursor_alist_ = val;
223} 223}
224static void 224static void
225bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) 225bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
226{ 226{
227 b->INTERNAL_FIELD (fringe_indicator_alist) = val; 227 b->fringe_indicator_alist_ = val;
228} 228}
229static void 229static void
230bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) 230bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
231{ 231{
232 b->INTERNAL_FIELD (fringes_outside_margins) = val; 232 b->fringes_outside_margins_ = val;
233} 233}
234static void 234static void
235bset_header_line_format (struct buffer *b, Lisp_Object val) 235bset_header_line_format (struct buffer *b, Lisp_Object val)
236{ 236{
237 b->INTERNAL_FIELD (header_line_format) = val; 237 b->header_line_format_ = val;
238} 238}
239static void 239static void
240bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) 240bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
241{ 241{
242 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; 242 b->indicate_buffer_boundaries_ = val;
243} 243}
244static void 244static void
245bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) 245bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
246{ 246{
247 b->INTERNAL_FIELD (indicate_empty_lines) = val; 247 b->indicate_empty_lines_ = val;
248} 248}
249static void 249static void
250bset_invisibility_spec (struct buffer *b, Lisp_Object val) 250bset_invisibility_spec (struct buffer *b, Lisp_Object val)
251{ 251{
252 b->INTERNAL_FIELD (invisibility_spec) = val; 252 b->invisibility_spec_ = val;
253} 253}
254static void 254static void
255bset_left_fringe_width (struct buffer *b, Lisp_Object val) 255bset_left_fringe_width (struct buffer *b, Lisp_Object val)
256{ 256{
257 b->INTERNAL_FIELD (left_fringe_width) = val; 257 b->left_fringe_width_ = val;
258} 258}
259static void 259static void
260bset_major_mode (struct buffer *b, Lisp_Object val) 260bset_major_mode (struct buffer *b, Lisp_Object val)
261{ 261{
262 b->INTERNAL_FIELD (major_mode) = val; 262 b->major_mode_ = val;
263} 263}
264static void 264static void
265bset_mark (struct buffer *b, Lisp_Object val) 265bset_mark (struct buffer *b, Lisp_Object val)
266{ 266{
267 b->INTERNAL_FIELD (mark) = val; 267 b->mark_ = val;
268} 268}
269static void 269static void
270bset_minor_modes (struct buffer *b, Lisp_Object val) 270bset_minor_modes (struct buffer *b, Lisp_Object val)
271{ 271{
272 b->INTERNAL_FIELD (minor_modes) = val; 272 b->minor_modes_ = val;
273} 273}
274static void 274static void
275bset_mode_line_format (struct buffer *b, Lisp_Object val) 275bset_mode_line_format (struct buffer *b, Lisp_Object val)
276{ 276{
277 b->INTERNAL_FIELD (mode_line_format) = val; 277 b->mode_line_format_ = val;
278} 278}
279static void 279static void
280bset_mode_name (struct buffer *b, Lisp_Object val) 280bset_mode_name (struct buffer *b, Lisp_Object val)
281{ 281{
282 b->INTERNAL_FIELD (mode_name) = val; 282 b->mode_name_ = val;
283} 283}
284static void 284static void
285bset_name (struct buffer *b, Lisp_Object val) 285bset_name (struct buffer *b, Lisp_Object val)
286{ 286{
287 b->INTERNAL_FIELD (name) = val; 287 b->name_ = val;
288} 288}
289static void 289static void
290bset_overwrite_mode (struct buffer *b, Lisp_Object val) 290bset_overwrite_mode (struct buffer *b, Lisp_Object val)
291{ 291{
292 b->INTERNAL_FIELD (overwrite_mode) = val; 292 b->overwrite_mode_ = val;
293} 293}
294static void 294static void
295bset_pt_marker (struct buffer *b, Lisp_Object val) 295bset_pt_marker (struct buffer *b, Lisp_Object val)
296{ 296{
297 b->INTERNAL_FIELD (pt_marker) = val; 297 b->pt_marker_ = val;
298} 298}
299static void 299static void
300bset_right_fringe_width (struct buffer *b, Lisp_Object val) 300bset_right_fringe_width (struct buffer *b, Lisp_Object val)
301{ 301{
302 b->INTERNAL_FIELD (right_fringe_width) = val; 302 b->right_fringe_width_ = val;
303} 303}
304static void 304static void
305bset_save_length (struct buffer *b, Lisp_Object val) 305bset_save_length (struct buffer *b, Lisp_Object val)
306{ 306{
307 b->INTERNAL_FIELD (save_length) = val; 307 b->save_length_ = val;
308} 308}
309static void 309static void
310bset_scroll_bar_width (struct buffer *b, Lisp_Object val) 310bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
311{ 311{
312 b->INTERNAL_FIELD (scroll_bar_width) = val; 312 b->scroll_bar_width_ = val;
313} 313}
314static void 314static void
315bset_scroll_bar_height (struct buffer *b, Lisp_Object val) 315bset_scroll_bar_height (struct buffer *b, Lisp_Object val)
316{ 316{
317 b->INTERNAL_FIELD (scroll_bar_height) = val; 317 b->scroll_bar_height_ = val;
318} 318}
319static void 319static void
320bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) 320bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
321{ 321{
322 b->INTERNAL_FIELD (scroll_down_aggressively) = val; 322 b->scroll_down_aggressively_ = val;
323} 323}
324static void 324static void
325bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) 325bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
326{ 326{
327 b->INTERNAL_FIELD (scroll_up_aggressively) = val; 327 b->scroll_up_aggressively_ = val;
328} 328}
329static void 329static void
330bset_selective_display (struct buffer *b, Lisp_Object val) 330bset_selective_display (struct buffer *b, Lisp_Object val)
331{ 331{
332 b->INTERNAL_FIELD (selective_display) = val; 332 b->selective_display_ = val;
333} 333}
334static void 334static void
335bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) 335bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
336{ 336{
337 b->INTERNAL_FIELD (selective_display_ellipses) = val; 337 b->selective_display_ellipses_ = val;
338} 338}
339static void 339static void
340bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) 340bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
341{ 341{
342 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; 342 b->vertical_scroll_bar_type_ = val;
343} 343}
344static void 344static void
345bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val) 345bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val)
346{ 346{
347 b->INTERNAL_FIELD (horizontal_scroll_bar_type) = val; 347 b->horizontal_scroll_bar_type_ = val;
348} 348}
349static void 349static void
350bset_word_wrap (struct buffer *b, Lisp_Object val) 350bset_word_wrap (struct buffer *b, Lisp_Object val)
351{ 351{
352 b->INTERNAL_FIELD (word_wrap) = val; 352 b->word_wrap_ = val;
353} 353}
354static void 354static void
355bset_zv_marker (struct buffer *b, Lisp_Object val) 355bset_zv_marker (struct buffer *b, Lisp_Object val)
356{ 356{
357 b->INTERNAL_FIELD (zv_marker) = val; 357 b->zv_marker_ = val;
358} 358}
359 359
360void 360void
@@ -1591,7 +1591,7 @@ compact_buffer (struct buffer *buffer)
1591 turned off in that buffer. Calling truncate_undo_list on 1591 turned off in that buffer. Calling truncate_undo_list on
1592 Qt tends to return NULL, which effectively turns undo back on. 1592 Qt tends to return NULL, which effectively turns undo back on.
1593 So don't call truncate_undo_list if undo_list is Qt. */ 1593 So don't call truncate_undo_list if undo_list is Qt. */
1594 if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt)) 1594 if (!EQ (BVAR(buffer, undo_list), Qt))
1595 truncate_undo_list (buffer); 1595 truncate_undo_list (buffer);
1596 1596
1597 /* Shrink buffer gaps. */ 1597 /* Shrink buffer gaps. */
diff --git a/src/buffer.h b/src/buffer.h
index 81852cae505..a0410d454cd 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -483,7 +483,7 @@ struct buffer_text
483 483
484/* Most code should use this macro to access Lisp fields in struct buffer. */ 484/* Most code should use this macro to access Lisp fields in struct buffer. */
485 485
486#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) 486#define BVAR(buf, field) ((buf)->field ## _)
487 487
488/* This is the structure that the buffer Lisp object points to. */ 488/* This is the structure that the buffer Lisp object points to. */
489 489
@@ -492,17 +492,17 @@ struct buffer
492 struct vectorlike_header header; 492 struct vectorlike_header header;
493 493
494 /* The name of this buffer. */ 494 /* The name of this buffer. */
495 Lisp_Object INTERNAL_FIELD (name); 495 Lisp_Object name_;
496 496
497 /* The name of the file visited in this buffer, or nil. */ 497 /* The name of the file visited in this buffer, or nil. */
498 Lisp_Object INTERNAL_FIELD (filename); 498 Lisp_Object filename_;
499 499
500 /* Directory for expanding relative file names. */ 500 /* Directory for expanding relative file names. */
501 Lisp_Object INTERNAL_FIELD (directory); 501 Lisp_Object directory_;
502 502
503 /* True if this buffer has been backed up (if you write to the visited 503 /* True if this buffer has been backed up (if you write to the visited
504 file and it hasn't been backed up, then a backup will be made). */ 504 file and it hasn't been backed up, then a backup will be made). */
505 Lisp_Object INTERNAL_FIELD (backed_up); 505 Lisp_Object backed_up_;
506 506
507 /* Length of file when last read or saved. 507 /* Length of file when last read or saved.
508 -1 means auto saving turned off because buffer shrank a lot. 508 -1 means auto saving turned off because buffer shrank a lot.
@@ -510,132 +510,132 @@ struct buffer
510 (That value is used with buffer-swap-text.) 510 (That value is used with buffer-swap-text.)
511 This is not in the struct buffer_text 511 This is not in the struct buffer_text
512 because it's not used in indirect buffers at all. */ 512 because it's not used in indirect buffers at all. */
513 Lisp_Object INTERNAL_FIELD (save_length); 513 Lisp_Object save_length_;
514 514
515 /* File name used for auto-saving this buffer. 515 /* File name used for auto-saving this buffer.
516 This is not in the struct buffer_text 516 This is not in the struct buffer_text
517 because it's not used in indirect buffers at all. */ 517 because it's not used in indirect buffers at all. */
518 Lisp_Object INTERNAL_FIELD (auto_save_file_name); 518 Lisp_Object auto_save_file_name_;
519 519
520 /* Non-nil if buffer read-only. */ 520 /* Non-nil if buffer read-only. */
521 Lisp_Object INTERNAL_FIELD (read_only); 521 Lisp_Object read_only_;
522 522
523 /* "The mark". This is a marker which may 523 /* "The mark". This is a marker which may
524 point into this buffer or may point nowhere. */ 524 point into this buffer or may point nowhere. */
525 Lisp_Object INTERNAL_FIELD (mark); 525 Lisp_Object mark_;
526 526
527 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all 527 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
528 per-buffer variables of this buffer. For locally unbound 528 per-buffer variables of this buffer. For locally unbound
529 symbols, just the symbol appears as the element. */ 529 symbols, just the symbol appears as the element. */
530 Lisp_Object INTERNAL_FIELD (local_var_alist); 530 Lisp_Object local_var_alist_;
531 531
532 /* Symbol naming major mode (e.g., lisp-mode). */ 532 /* Symbol naming major mode (e.g., lisp-mode). */
533 Lisp_Object INTERNAL_FIELD (major_mode); 533 Lisp_Object major_mode_;
534 534
535 /* Pretty name of major mode (e.g., "Lisp"). */ 535 /* Pretty name of major mode (e.g., "Lisp"). */
536 Lisp_Object INTERNAL_FIELD (mode_name); 536 Lisp_Object mode_name_;
537 537
538 /* Mode line element that controls format of mode line. */ 538 /* Mode line element that controls format of mode line. */
539 Lisp_Object INTERNAL_FIELD (mode_line_format); 539 Lisp_Object mode_line_format_;
540 540
541 /* Analogous to mode_line_format for the line displayed at the top 541 /* Analogous to mode_line_format for the line displayed at the top
542 of windows. Nil means don't display that line. */ 542 of windows. Nil means don't display that line. */
543 Lisp_Object INTERNAL_FIELD (header_line_format); 543 Lisp_Object header_line_format_;
544 544
545 /* Keys that are bound local to this buffer. */ 545 /* Keys that are bound local to this buffer. */
546 Lisp_Object INTERNAL_FIELD (keymap); 546 Lisp_Object keymap_;
547 547
548 /* This buffer's local abbrev table. */ 548 /* This buffer's local abbrev table. */
549 Lisp_Object INTERNAL_FIELD (abbrev_table); 549 Lisp_Object abbrev_table_;
550 550
551 /* This buffer's syntax table. */ 551 /* This buffer's syntax table. */
552 Lisp_Object INTERNAL_FIELD (syntax_table); 552 Lisp_Object syntax_table_;
553 553
554 /* This buffer's category table. */ 554 /* This buffer's category table. */
555 Lisp_Object INTERNAL_FIELD (category_table); 555 Lisp_Object category_table_;
556 556
557 /* Values of several buffer-local variables. */ 557 /* Values of several buffer-local variables. */
558 /* tab-width is buffer-local so that redisplay can find it 558 /* tab-width is buffer-local so that redisplay can find it
559 in buffers that are not current. */ 559 in buffers that are not current. */
560 Lisp_Object INTERNAL_FIELD (case_fold_search); 560 Lisp_Object case_fold_search_;
561 Lisp_Object INTERNAL_FIELD (tab_width); 561 Lisp_Object tab_width_;
562 Lisp_Object INTERNAL_FIELD (fill_column); 562 Lisp_Object fill_column_;
563 Lisp_Object INTERNAL_FIELD (left_margin); 563 Lisp_Object left_margin_;
564 564
565 /* Function to call when insert space past fill column. */ 565 /* Function to call when insert space past fill column. */
566 Lisp_Object INTERNAL_FIELD (auto_fill_function); 566 Lisp_Object auto_fill_function_;
567 567
568 /* Case table for case-conversion in this buffer. 568 /* Case table for case-conversion in this buffer.
569 This char-table maps each char into its lower-case version. */ 569 This char-table maps each char into its lower-case version. */
570 Lisp_Object INTERNAL_FIELD (downcase_table); 570 Lisp_Object downcase_table_;
571 571
572 /* Char-table mapping each char to its upper-case version. */ 572 /* Char-table mapping each char to its upper-case version. */
573 Lisp_Object INTERNAL_FIELD (upcase_table); 573 Lisp_Object upcase_table_;
574 574
575 /* Char-table for conversion for case-folding search. */ 575 /* Char-table for conversion for case-folding search. */
576 Lisp_Object INTERNAL_FIELD (case_canon_table); 576 Lisp_Object case_canon_table_;
577 577
578 /* Char-table of equivalences for case-folding search. */ 578 /* Char-table of equivalences for case-folding search. */
579 Lisp_Object INTERNAL_FIELD (case_eqv_table); 579 Lisp_Object case_eqv_table_;
580 580
581 /* Non-nil means do not display continuation lines. */ 581 /* Non-nil means do not display continuation lines. */
582 Lisp_Object INTERNAL_FIELD (truncate_lines); 582 Lisp_Object truncate_lines_;
583 583
584 /* Non-nil means to use word wrapping when displaying continuation lines. */ 584 /* Non-nil means to use word wrapping when displaying continuation lines. */
585 Lisp_Object INTERNAL_FIELD (word_wrap); 585 Lisp_Object word_wrap_;
586 586
587 /* Non-nil means display ctl chars with uparrow. */ 587 /* Non-nil means display ctl chars with uparrow. */
588 Lisp_Object INTERNAL_FIELD (ctl_arrow); 588 Lisp_Object ctl_arrow_;
589 589
590 /* Non-nil means reorder bidirectional text for display in the 590 /* Non-nil means reorder bidirectional text for display in the
591 visual order. */ 591 visual order. */
592 Lisp_Object INTERNAL_FIELD (bidi_display_reordering); 592 Lisp_Object bidi_display_reordering_;
593 593
594 /* If non-nil, specifies which direction of text to force in all the 594 /* If non-nil, specifies which direction of text to force in all the
595 paragraphs of the buffer. Nil means determine paragraph 595 paragraphs of the buffer. Nil means determine paragraph
596 direction dynamically for each paragraph. */ 596 direction dynamically for each paragraph. */
597 Lisp_Object INTERNAL_FIELD (bidi_paragraph_direction); 597 Lisp_Object bidi_paragraph_direction_;
598 598
599 /* Non-nil means do selective display; 599 /* Non-nil means do selective display;
600 see doc string in syms_of_buffer (buffer.c) for details. */ 600 see doc string in syms_of_buffer (buffer.c) for details. */
601 Lisp_Object INTERNAL_FIELD (selective_display); 601 Lisp_Object selective_display_;
602 602
603 /* Non-nil means show ... at end of line followed by invisible lines. */ 603 /* Non-nil means show ... at end of line followed by invisible lines. */
604 Lisp_Object INTERNAL_FIELD (selective_display_ellipses); 604 Lisp_Object selective_display_ellipses_;
605 605
606 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ 606 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
607 Lisp_Object INTERNAL_FIELD (minor_modes); 607 Lisp_Object minor_modes_;
608 608
609 /* t if "self-insertion" should overwrite; `binary' if it should also 609 /* t if "self-insertion" should overwrite; `binary' if it should also
610 overwrite newlines and tabs - for editing executables and the like. */ 610 overwrite newlines and tabs - for editing executables and the like. */
611 Lisp_Object INTERNAL_FIELD (overwrite_mode); 611 Lisp_Object overwrite_mode_;
612 612
613 /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ 613 /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */
614 Lisp_Object INTERNAL_FIELD (abbrev_mode); 614 Lisp_Object abbrev_mode_;
615 615
616 /* Display table to use for text in this buffer. */ 616 /* Display table to use for text in this buffer. */
617 Lisp_Object INTERNAL_FIELD (display_table); 617 Lisp_Object display_table_;
618 618
619 /* t means the mark and region are currently active. */ 619 /* t means the mark and region are currently active. */
620 Lisp_Object INTERNAL_FIELD (mark_active); 620 Lisp_Object mark_active_;
621 621
622 /* Non-nil means the buffer contents are regarded as multi-byte 622 /* Non-nil means the buffer contents are regarded as multi-byte
623 form of characters, not a binary code. */ 623 form of characters, not a binary code. */
624 Lisp_Object INTERNAL_FIELD (enable_multibyte_characters); 624 Lisp_Object enable_multibyte_characters_;
625 625
626 /* Coding system to be used for encoding the buffer contents on 626 /* Coding system to be used for encoding the buffer contents on
627 saving. */ 627 saving. */
628 Lisp_Object INTERNAL_FIELD (buffer_file_coding_system); 628 Lisp_Object buffer_file_coding_system_;
629 629
630 /* List of symbols naming the file format used for visited file. */ 630 /* List of symbols naming the file format used for visited file. */
631 Lisp_Object INTERNAL_FIELD (file_format); 631 Lisp_Object file_format_;
632 632
633 /* List of symbols naming the file format used for auto-save file. */ 633 /* List of symbols naming the file format used for auto-save file. */
634 Lisp_Object INTERNAL_FIELD (auto_save_file_format); 634 Lisp_Object auto_save_file_format_;
635 635
636 /* True if the newline position cache, width run cache and BIDI paragraph 636 /* True if the newline position cache, width run cache and BIDI paragraph
637 cache are enabled. See search.c, indent.c and bidi.c for details. */ 637 cache are enabled. See search.c, indent.c and bidi.c for details. */
638 Lisp_Object INTERNAL_FIELD (cache_long_scans); 638 Lisp_Object cache_long_scans_;
639 639
640 /* If the width run cache is enabled, this table contains the 640 /* If the width run cache is enabled, this table contains the
641 character widths width_run_cache (see above) assumes. When we 641 character widths width_run_cache (see above) assumes. When we
@@ -643,104 +643,104 @@ struct buffer
643 current display table to see whether the display table has 643 current display table to see whether the display table has
644 affected the widths of any characters. If it has, we 644 affected the widths of any characters. If it has, we
645 invalidate the width run cache, and re-initialize width_table. */ 645 invalidate the width run cache, and re-initialize width_table. */
646 Lisp_Object INTERNAL_FIELD (width_table); 646 Lisp_Object width_table_;
647 647
648 /* In an indirect buffer, or a buffer that is the base of an 648 /* In an indirect buffer, or a buffer that is the base of an
649 indirect buffer, this holds a marker that records 649 indirect buffer, this holds a marker that records
650 PT for this buffer when the buffer is not current. */ 650 PT for this buffer when the buffer is not current. */
651 Lisp_Object INTERNAL_FIELD (pt_marker); 651 Lisp_Object pt_marker_;
652 652
653 /* In an indirect buffer, or a buffer that is the base of an 653 /* In an indirect buffer, or a buffer that is the base of an
654 indirect buffer, this holds a marker that records 654 indirect buffer, this holds a marker that records
655 BEGV for this buffer when the buffer is not current. */ 655 BEGV for this buffer when the buffer is not current. */
656 Lisp_Object INTERNAL_FIELD (begv_marker); 656 Lisp_Object begv_marker_;
657 657
658 /* In an indirect buffer, or a buffer that is the base of an 658 /* In an indirect buffer, or a buffer that is the base of an
659 indirect buffer, this holds a marker that records 659 indirect buffer, this holds a marker that records
660 ZV for this buffer when the buffer is not current. */ 660 ZV for this buffer when the buffer is not current. */
661 Lisp_Object INTERNAL_FIELD (zv_marker); 661 Lisp_Object zv_marker_;
662 662
663 /* This holds the point value before the last scroll operation. 663 /* This holds the point value before the last scroll operation.
664 Explicitly setting point sets this to nil. */ 664 Explicitly setting point sets this to nil. */
665 Lisp_Object INTERNAL_FIELD (point_before_scroll); 665 Lisp_Object point_before_scroll_;
666 666
667 /* Truename of the visited file, or nil. */ 667 /* Truename of the visited file, or nil. */
668 Lisp_Object INTERNAL_FIELD (file_truename); 668 Lisp_Object file_truename_;
669 669
670 /* Invisibility spec of this buffer. 670 /* Invisibility spec of this buffer.
671 t => any non-nil `invisible' property means invisible. 671 t => any non-nil `invisible' property means invisible.
672 A list => `invisible' property means invisible 672 A list => `invisible' property means invisible
673 if it is memq in that list. */ 673 if it is memq in that list. */
674 Lisp_Object INTERNAL_FIELD (invisibility_spec); 674 Lisp_Object invisibility_spec_;
675 675
676 /* This is the last window that was selected with this buffer in it, 676 /* This is the last window that was selected with this buffer in it,
677 or nil if that window no longer displays this buffer. */ 677 or nil if that window no longer displays this buffer. */
678 Lisp_Object INTERNAL_FIELD (last_selected_window); 678 Lisp_Object last_selected_window_;
679 679
680 /* Incremented each time the buffer is displayed in a window. */ 680 /* Incremented each time the buffer is displayed in a window. */
681 Lisp_Object INTERNAL_FIELD (display_count); 681 Lisp_Object display_count_;
682 682
683 /* Widths of left and right marginal areas for windows displaying 683 /* Widths of left and right marginal areas for windows displaying
684 this buffer. */ 684 this buffer. */
685 Lisp_Object INTERNAL_FIELD (left_margin_cols); 685 Lisp_Object left_margin_cols_;
686 Lisp_Object INTERNAL_FIELD (right_margin_cols); 686 Lisp_Object right_margin_cols_;
687 687
688 /* Widths of left and right fringe areas for windows displaying 688 /* Widths of left and right fringe areas for windows displaying
689 this buffer. */ 689 this buffer. */
690 Lisp_Object INTERNAL_FIELD (left_fringe_width); 690 Lisp_Object left_fringe_width_;
691 Lisp_Object INTERNAL_FIELD (right_fringe_width); 691 Lisp_Object right_fringe_width_;
692 692
693 /* Non-nil means fringes are drawn outside display margins; 693 /* Non-nil means fringes are drawn outside display margins;
694 othersize draw them between margin areas and text. */ 694 othersize draw them between margin areas and text. */
695 Lisp_Object INTERNAL_FIELD (fringes_outside_margins); 695 Lisp_Object fringes_outside_margins_;
696 696
697 /* Width, height and types of scroll bar areas for windows displaying 697 /* Width, height and types of scroll bar areas for windows displaying
698 this buffer. */ 698 this buffer. */
699 Lisp_Object INTERNAL_FIELD (scroll_bar_width); 699 Lisp_Object scroll_bar_width_;
700 Lisp_Object INTERNAL_FIELD (scroll_bar_height); 700 Lisp_Object scroll_bar_height_;
701 Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type); 701 Lisp_Object vertical_scroll_bar_type_;
702 Lisp_Object INTERNAL_FIELD (horizontal_scroll_bar_type); 702 Lisp_Object horizontal_scroll_bar_type_;
703 703
704 /* Non-nil means indicate lines not displaying text (in a style 704 /* Non-nil means indicate lines not displaying text (in a style
705 like vi). */ 705 like vi). */
706 Lisp_Object INTERNAL_FIELD (indicate_empty_lines); 706 Lisp_Object indicate_empty_lines_;
707 707
708 /* Non-nil means indicate buffer boundaries and scrolling. */ 708 /* Non-nil means indicate buffer boundaries and scrolling. */
709 Lisp_Object INTERNAL_FIELD (indicate_buffer_boundaries); 709 Lisp_Object indicate_buffer_boundaries_;
710 710
711 /* Logical to physical fringe bitmap mappings. */ 711 /* Logical to physical fringe bitmap mappings. */
712 Lisp_Object INTERNAL_FIELD (fringe_indicator_alist); 712 Lisp_Object fringe_indicator_alist_;
713 713
714 /* Logical to physical cursor bitmap mappings. */ 714 /* Logical to physical cursor bitmap mappings. */
715 Lisp_Object INTERNAL_FIELD (fringe_cursor_alist); 715 Lisp_Object fringe_cursor_alist_;
716 716
717 /* Time stamp updated each time this buffer is displayed in a window. */ 717 /* Time stamp updated each time this buffer is displayed in a window. */
718 Lisp_Object INTERNAL_FIELD (display_time); 718 Lisp_Object display_time_;
719 719
720 /* If scrolling the display because point is below the bottom of a 720 /* If scrolling the display because point is below the bottom of a
721 window showing this buffer, try to choose a window start so 721 window showing this buffer, try to choose a window start so
722 that point ends up this number of lines from the top of the 722 that point ends up this number of lines from the top of the
723 window. Nil means that scrolling method isn't used. */ 723 window. Nil means that scrolling method isn't used. */
724 Lisp_Object INTERNAL_FIELD (scroll_up_aggressively); 724 Lisp_Object scroll_up_aggressively_;
725 725
726 /* If scrolling the display because point is above the top of a 726 /* If scrolling the display because point is above the top of a
727 window showing this buffer, try to choose a window start so 727 window showing this buffer, try to choose a window start so
728 that point ends up this number of lines from the bottom of the 728 that point ends up this number of lines from the bottom of the
729 window. Nil means that scrolling method isn't used. */ 729 window. Nil means that scrolling method isn't used. */
730 Lisp_Object INTERNAL_FIELD (scroll_down_aggressively); 730 Lisp_Object scroll_down_aggressively_;
731 731
732 /* Desired cursor type in this buffer. See the doc string of 732 /* Desired cursor type in this buffer. See the doc string of
733 per-buffer variable `cursor-type'. */ 733 per-buffer variable `cursor-type'. */
734 Lisp_Object INTERNAL_FIELD (cursor_type); 734 Lisp_Object cursor_type_;
735 735
736 /* An integer > 0 means put that number of pixels below text lines 736 /* An integer > 0 means put that number of pixels below text lines
737 in the display of this buffer. */ 737 in the display of this buffer. */
738 Lisp_Object INTERNAL_FIELD (extra_line_spacing); 738 Lisp_Object extra_line_spacing_;
739 739
740 /* Cursor type to display in non-selected windows. 740 /* Cursor type to display in non-selected windows.
741 t means to use hollow box cursor. 741 t means to use hollow box cursor.
742 See `cursor-type' for other values. */ 742 See `cursor-type' for other values. */
743 Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows); 743 Lisp_Object cursor_in_non_selected_windows_;
744 744
745 /* No more Lisp_Object beyond this point. Except undo_list, 745 /* No more Lisp_Object beyond this point. Except undo_list,
746 which is handled specially in Fgarbage_collect. */ 746 which is handled specially in Fgarbage_collect. */
@@ -872,7 +872,7 @@ struct buffer
872 buffer of an indirect buffer. But we can't store it in the 872 buffer of an indirect buffer. But we can't store it in the
873 struct buffer_text because local variables have to be right in 873 struct buffer_text because local variables have to be right in
874 the struct buffer. So we copy it around in set_buffer_internal. */ 874 the struct buffer. So we copy it around in set_buffer_internal. */
875 Lisp_Object INTERNAL_FIELD (undo_list); 875 Lisp_Object undo_list_;
876}; 876};
877 877
878/* Most code should use these functions to set Lisp fields in struct 878/* Most code should use these functions to set Lisp fields in struct
@@ -881,102 +881,102 @@ struct buffer
881INLINE void 881INLINE void
882bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) 882bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val)
883{ 883{
884 b->INTERNAL_FIELD (bidi_paragraph_direction) = val; 884 b->bidi_paragraph_direction_ = val;
885} 885}
886INLINE void 886INLINE void
887bset_cache_long_scans (struct buffer *b, Lisp_Object val) 887bset_cache_long_scans (struct buffer *b, Lisp_Object val)
888{ 888{
889 b->INTERNAL_FIELD (cache_long_scans) = val; 889 b->cache_long_scans_ = val;
890} 890}
891INLINE void 891INLINE void
892bset_case_canon_table (struct buffer *b, Lisp_Object val) 892bset_case_canon_table (struct buffer *b, Lisp_Object val)
893{ 893{
894 b->INTERNAL_FIELD (case_canon_table) = val; 894 b->case_canon_table_ = val;
895} 895}
896INLINE void 896INLINE void
897bset_case_eqv_table (struct buffer *b, Lisp_Object val) 897bset_case_eqv_table (struct buffer *b, Lisp_Object val)
898{ 898{
899 b->INTERNAL_FIELD (case_eqv_table) = val; 899 b->case_eqv_table_ = val;
900} 900}
901INLINE void 901INLINE void
902bset_directory (struct buffer *b, Lisp_Object val) 902bset_directory (struct buffer *b, Lisp_Object val)
903{ 903{
904 b->INTERNAL_FIELD (directory) = val; 904 b->directory_ = val;
905} 905}
906INLINE void 906INLINE void
907bset_display_count (struct buffer *b, Lisp_Object val) 907bset_display_count (struct buffer *b, Lisp_Object val)
908{ 908{
909 b->INTERNAL_FIELD (display_count) = val; 909 b->display_count_ = val;
910} 910}
911INLINE void 911INLINE void
912bset_display_time (struct buffer *b, Lisp_Object val) 912bset_display_time (struct buffer *b, Lisp_Object val)
913{ 913{
914 b->INTERNAL_FIELD (display_time) = val; 914 b->display_time_ = val;
915} 915}
916INLINE void 916INLINE void
917bset_downcase_table (struct buffer *b, Lisp_Object val) 917bset_downcase_table (struct buffer *b, Lisp_Object val)
918{ 918{
919 b->INTERNAL_FIELD (downcase_table) = val; 919 b->downcase_table_ = val;
920} 920}
921INLINE void 921INLINE void
922bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) 922bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val)
923{ 923{
924 b->INTERNAL_FIELD (enable_multibyte_characters) = val; 924 b->enable_multibyte_characters_ = val;
925} 925}
926INLINE void 926INLINE void
927bset_filename (struct buffer *b, Lisp_Object val) 927bset_filename (struct buffer *b, Lisp_Object val)
928{ 928{
929 b->INTERNAL_FIELD (filename) = val; 929 b->filename_ = val;
930} 930}
931INLINE void 931INLINE void
932bset_keymap (struct buffer *b, Lisp_Object val) 932bset_keymap (struct buffer *b, Lisp_Object val)
933{ 933{
934 b->INTERNAL_FIELD (keymap) = val; 934 b->keymap_ = val;
935} 935}
936INLINE void 936INLINE void
937bset_last_selected_window (struct buffer *b, Lisp_Object val) 937bset_last_selected_window (struct buffer *b, Lisp_Object val)
938{ 938{
939 b->INTERNAL_FIELD (last_selected_window) = val; 939 b->last_selected_window_ = val;
940} 940}
941INLINE void 941INLINE void
942bset_local_var_alist (struct buffer *b, Lisp_Object val) 942bset_local_var_alist (struct buffer *b, Lisp_Object val)
943{ 943{
944 b->INTERNAL_FIELD (local_var_alist) = val; 944 b->local_var_alist_ = val;
945} 945}
946INLINE void 946INLINE void
947bset_mark_active (struct buffer *b, Lisp_Object val) 947bset_mark_active (struct buffer *b, Lisp_Object val)
948{ 948{
949 b->INTERNAL_FIELD (mark_active) = val; 949 b->mark_active_ = val;
950} 950}
951INLINE void 951INLINE void
952bset_point_before_scroll (struct buffer *b, Lisp_Object val) 952bset_point_before_scroll (struct buffer *b, Lisp_Object val)
953{ 953{
954 b->INTERNAL_FIELD (point_before_scroll) = val; 954 b->point_before_scroll_ = val;
955} 955}
956INLINE void 956INLINE void
957bset_read_only (struct buffer *b, Lisp_Object val) 957bset_read_only (struct buffer *b, Lisp_Object val)
958{ 958{
959 b->INTERNAL_FIELD (read_only) = val; 959 b->read_only_ = val;
960} 960}
961INLINE void 961INLINE void
962bset_truncate_lines (struct buffer *b, Lisp_Object val) 962bset_truncate_lines (struct buffer *b, Lisp_Object val)
963{ 963{
964 b->INTERNAL_FIELD (truncate_lines) = val; 964 b->truncate_lines_ = val;
965} 965}
966INLINE void 966INLINE void
967bset_undo_list (struct buffer *b, Lisp_Object val) 967bset_undo_list (struct buffer *b, Lisp_Object val)
968{ 968{
969 b->INTERNAL_FIELD (undo_list) = val; 969 b->undo_list_ = val;
970} 970}
971INLINE void 971INLINE void
972bset_upcase_table (struct buffer *b, Lisp_Object val) 972bset_upcase_table (struct buffer *b, Lisp_Object val)
973{ 973{
974 b->INTERNAL_FIELD (upcase_table) = val; 974 b->upcase_table_ = val;
975} 975}
976INLINE void 976INLINE void
977bset_width_table (struct buffer *b, Lisp_Object val) 977bset_width_table (struct buffer *b, Lisp_Object val)
978{ 978{
979 b->INTERNAL_FIELD (width_table) = val; 979 b->width_table_ = val;
980} 980}
981 981
982/* Number of Lisp_Objects at the beginning of struct buffer. 982/* Number of Lisp_Objects at the beginning of struct buffer.
@@ -1253,7 +1253,7 @@ extern int last_per_buffer_idx;
1253 from the start of a buffer structure. */ 1253 from the start of a buffer structure. */
1254 1254
1255#define PER_BUFFER_VAR_OFFSET(VAR) \ 1255#define PER_BUFFER_VAR_OFFSET(VAR) \
1256 offsetof (struct buffer, INTERNAL_FIELD (VAR)) 1256 offsetof (struct buffer, VAR ## _)
1257 1257
1258/* Used to iterate over normal Lisp_Object fields of struct buffer (all 1258/* Used to iterate over normal Lisp_Object fields of struct buffer (all
1259 Lisp_Objects except undo_list). If you add, remove, or reorder 1259 Lisp_Objects except undo_list). If you add, remove, or reorder
diff --git a/src/category.c b/src/category.c
index b20493e5949..ab90f5ff093 100644
--- a/src/category.c
+++ b/src/category.c
@@ -41,7 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41static void 41static void
42bset_category_table (struct buffer *b, Lisp_Object val) 42bset_category_table (struct buffer *b, Lisp_Object val)
43{ 43{
44 b->INTERNAL_FIELD (category_table) = val; 44 b->category_table_ = val;
45} 45}
46 46
47/* The version number of the latest category table. Each category 47/* The version number of the latest category table. Each category
diff --git a/src/cmds.c b/src/cmds.c
index 168ce8355ed..b590805ea8a 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -473,7 +473,7 @@ internal_self_insert (int c, EMACS_INT n)
473 } 473 }
474 474
475 replace_range (PT, PT + chars_to_delete, string, 1, 1, 1); 475 replace_range (PT, PT + chars_to_delete, string, 1, 1, 1);
476 Fforward_char (make_number (n + spaces_to_insert)); 476 Fforward_char (make_number (n));
477 } 477 }
478 else if (n > 1) 478 else if (n > 1)
479 { 479 {
diff --git a/src/deps.mk b/src/deps.mk
index 71a5f42d22e..23789384fdb 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -20,7 +20,7 @@
20 20
21## Commentary: 21## Commentary:
22## 22##
23## This file is inserted in src/Makefile if AUTO_DEPEND=no. 23## This file is included in src/Makefile if AUTO_DEPEND=no.
24## It defines static dependencies between the various source files. 24## It defines static dependencies between the various source files.
25 25
26## FIXME some of these dependencies are platform-specific. 26## FIXME some of these dependencies are platform-specific.
diff --git a/src/editfns.c b/src/editfns.c
index dead48c1a62..cddb0d4eae6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -908,6 +908,10 @@ even in case of abnormal exit (throw or error).
908If you only want to save the current buffer but not point, 908If you only want to save the current buffer but not point,
909then just use `save-current-buffer', or even `with-current-buffer'. 909then just use `save-current-buffer', or even `with-current-buffer'.
910 910
911Before Emacs 25.1, `save-excursion' used to save the mark state.
912To save the marker state as well as the point and buffer, use
913`save-mark-and-excursion'.
914
911usage: (save-excursion &rest BODY) */) 915usage: (save-excursion &rest BODY) */)
912 (Lisp_Object args) 916 (Lisp_Object args)
913{ 917{
@@ -4386,9 +4390,6 @@ usage: (format STRING &rest OBJECTS) */)
4386 nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); 4390 nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
4387 val = make_specified_string (buf, nchars, p - buf, multibyte); 4391 val = make_specified_string (buf, nchars, p - buf, multibyte);
4388 4392
4389 /* If we allocated BUF with malloc, free it too. */
4390 SAFE_FREE ();
4391
4392 /* If the format string has text properties, or any of the string 4393 /* If the format string has text properties, or any of the string
4393 arguments has text properties, set up text properties of the 4394 arguments has text properties, set up text properties of the
4394 result string. */ 4395 result string. */
@@ -4494,6 +4495,9 @@ usage: (format STRING &rest OBJECTS) */)
4494 UNGCPRO; 4495 UNGCPRO;
4495 } 4496 }
4496 4497
4498 /* If we allocated BUF or INFO with malloc, free it too. */
4499 SAFE_FREE ();
4500
4497 return val; 4501 return val;
4498} 4502}
4499 4503
diff --git a/src/filelock.c b/src/filelock.c
index 89d3e350219..4ee7a01ecb8 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -669,10 +669,6 @@ lock_file (Lisp_Object fn)
669 struct gcpro gcpro1; 669 struct gcpro gcpro1;
670 USE_SAFE_ALLOCA; 670 USE_SAFE_ALLOCA;
671 671
672 /* Don't do locking if the user has opted out. */
673 if (! create_lockfiles)
674 return;
675
676 /* Don't do locking while dumping Emacs. 672 /* Don't do locking while dumping Emacs.
677 Uncompressing wtmp files uses call-process, which does not work 673 Uncompressing wtmp files uses call-process, which does not work
678 in an uninitialized Emacs. */ 674 in an uninitialized Emacs. */
@@ -690,9 +686,6 @@ lock_file (Lisp_Object fn)
690#endif 686#endif
691 encoded_fn = ENCODE_FILE (fn); 687 encoded_fn = ENCODE_FILE (fn);
692 688
693 /* Create the name of the lock-file for file fn */
694 MAKE_LOCK_NAME (lfname, encoded_fn);
695
696 /* See if this file is visited and has changed on disk since it was 689 /* See if this file is visited and has changed on disk since it was
697 visited. */ 690 visited. */
698 { 691 {
@@ -707,27 +700,35 @@ lock_file (Lisp_Object fn)
707 700
708 } 701 }
709 702
710 /* Try to lock the lock. */ 703 /* Don't do locking if the user has opted out. */
711 if (0 < lock_if_free (&lock_info, lfname)) 704 if (create_lockfiles)
712 { 705 {
713 /* Someone else has the lock. Consider breaking it. */ 706
714 Lisp_Object attack; 707 /* Create the name of the lock-file for file fn */
715 char *dot = lock_info.dot; 708 MAKE_LOCK_NAME (lfname, encoded_fn);
716 ptrdiff_t pidlen = lock_info.colon - (dot + 1); 709
717 static char const replacement[] = " (pid "; 710 /* Try to lock the lock. */
718 int replacementlen = sizeof replacement - 1; 711 if (0 < lock_if_free (&lock_info, lfname))
719 memmove (dot + replacementlen, dot + 1, pidlen); 712 {
720 strcpy (dot + replacementlen + pidlen, ")"); 713 /* Someone else has the lock. Consider breaking it. */
721 memcpy (dot, replacement, replacementlen); 714 Lisp_Object attack;
722 attack = call2 (intern ("ask-user-about-lock"), fn, 715 char *dot = lock_info.dot;
723 build_string (lock_info.user)); 716 ptrdiff_t pidlen = lock_info.colon - (dot + 1);
724 /* Take the lock if the user said so. */ 717 static char const replacement[] = " (pid ";
725 if (!NILP (attack)) 718 int replacementlen = sizeof replacement - 1;
726 lock_file_1 (lfname, 1); 719 memmove (dot + replacementlen, dot + 1, pidlen);
720 strcpy (dot + replacementlen + pidlen, ")");
721 memcpy (dot, replacement, replacementlen);
722 attack = call2 (intern ("ask-user-about-lock"), fn,
723 build_string (lock_info.user));
724 /* Take the lock if the user said so. */
725 if (!NILP (attack))
726 lock_file_1 (lfname, 1);
727 }
728 SAFE_FREE ();
727 } 729 }
728 730
729 UNGCPRO; 731 UNGCPRO;
730 SAFE_FREE ();
731} 732}
732 733
733void 734void
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d7340ba797e..5d28b0221af 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -869,6 +869,21 @@ xg_clear_under_internal_border (struct frame *f)
869 } 869 }
870} 870}
871 871
872static int
873xg_get_gdk_scale (void)
874{
875 const char *sscale = getenv ("GDK_SCALE");
876
877 if (sscale)
878 {
879 long scale = atol (sscale);
880 if (0 < scale)
881 return min (scale, INT_MAX);
882 }
883
884 return 1;
885}
886
872/* Function to handle resize of our frame. As we have a Gtk+ tool bar 887/* Function to handle resize of our frame. As we have a Gtk+ tool bar
873 and a Gtk+ menu bar, we get resize events for the edit part of the 888 and a Gtk+ menu bar, we get resize events for the edit part of the
874 frame only. We let Gtk+ deal with the Gtk+ parts. 889 frame only. We let Gtk+ deal with the Gtk+ parts.
@@ -919,6 +934,9 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
919 int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); 934 int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
920 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); 935 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
921 gint gwidth, gheight; 936 gint gwidth, gheight;
937 int totalheight
938 = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
939 int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f);
922 940
923 if (FRAME_PIXEL_HEIGHT (f) == 0) 941 if (FRAME_PIXEL_HEIGHT (f) == 0)
924 return; 942 return;
@@ -929,6 +947,13 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
929 /* Do this before resize, as we don't know yet if we will be resized. */ 947 /* Do this before resize, as we don't know yet if we will be resized. */
930 xg_clear_under_internal_border (f); 948 xg_clear_under_internal_border (f);
931 949
950 if (FRAME_VISIBLE_P (f))
951 {
952 int scale = xg_get_gdk_scale ();
953 totalheight /= scale;
954 totalwidth /= scale;
955 }
956
932 /* Resize the top level widget so rows and columns remain constant. 957 /* Resize the top level widget so rows and columns remain constant.
933 958
934 When the frame is fullheight and we only want to change the width 959 When the frame is fullheight and we only want to change the width
@@ -943,38 +968,33 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
943 frame_size_history_add 968 frame_size_history_add
944 (f, Qxg_frame_set_char_size_1, width, height, 969 (f, Qxg_frame_set_char_size_1, width, height,
945 list2 (make_number (gheight), 970 list2 (make_number (gheight),
946 make_number (pixelheight + FRAME_TOOLBAR_HEIGHT (f) 971 make_number (totalheight)));
947 + FRAME_MENUBAR_HEIGHT (f))));
948 972
949 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 973 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
950 gwidth, 974 gwidth,
951 pixelheight + FRAME_TOOLBAR_HEIGHT (f) 975 totalheight);
952 + FRAME_MENUBAR_HEIGHT (f));
953 } 976 }
954 else if (EQ (fullscreen, Qfullheight) && height == FRAME_TEXT_HEIGHT (f)) 977 else if (EQ (fullscreen, Qfullheight) && height == FRAME_TEXT_HEIGHT (f))
955 { 978 {
956 frame_size_history_add 979 frame_size_history_add
957 (f, Qxg_frame_set_char_size_2, width, height, 980 (f, Qxg_frame_set_char_size_2, width, height,
958 list2 (make_number (gwidth), 981 list2 (make_number (gwidth),
959 make_number (pixelwidth + FRAME_TOOLBAR_WIDTH (f)))); 982 make_number (totalwidth)));
960 983
961 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 984 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
962 pixelwidth + FRAME_TOOLBAR_WIDTH (f), 985 totalwidth,
963 gheight); 986 gheight);
964 } 987 }
965
966 else 988 else
967 { 989 {
968 frame_size_history_add 990 frame_size_history_add
969 (f, Qxg_frame_set_char_size_3, width, height, 991 (f, Qxg_frame_set_char_size_3, width, height,
970 list2 (make_number (pixelwidth + FRAME_TOOLBAR_WIDTH (f)), 992 list2 (make_number (totalwidth),
971 make_number (pixelheight + FRAME_TOOLBAR_HEIGHT (f) 993 make_number (totalheight)));
972 + FRAME_MENUBAR_HEIGHT (f))));
973 994
974 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 995 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
975 pixelwidth + FRAME_TOOLBAR_WIDTH (f), 996 totalwidth,
976 pixelheight + FRAME_TOOLBAR_HEIGHT (f) 997 totalheight);
977 + FRAME_MENUBAR_HEIGHT (f));
978 fullscreen = Qnil; 998 fullscreen = Qnil;
979 } 999 }
980 1000
@@ -1126,18 +1146,6 @@ delete_cb (GtkWidget *widget,
1126 GdkEvent *event, 1146 GdkEvent *event,
1127 gpointer user_data) 1147 gpointer user_data)
1128{ 1148{
1129#ifdef HAVE_GTK3
1130 /* The event doesn't arrive in the normal event loop. Send event
1131 here. */
1132 struct frame *f = user_data;
1133 struct input_event ie;
1134
1135 EVENT_INIT (ie);
1136 ie.kind = DELETE_WINDOW_EVENT;
1137 XSETFRAME (ie.frame_or_window, f);
1138 kbd_buffer_store_event (&ie);
1139#endif
1140
1141 return TRUE; 1149 return TRUE;
1142} 1150}
1143 1151
@@ -1356,6 +1364,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1356 int min_rows = 0, min_cols = 0; 1364 int min_rows = 0, min_cols = 0;
1357 int win_gravity = f->win_gravity; 1365 int win_gravity = f->win_gravity;
1358 Lisp_Object fs_state, frame; 1366 Lisp_Object fs_state, frame;
1367 int scale = xg_get_gdk_scale ();
1359 1368
1360 /* Don't set size hints during initialization; that apparently leads 1369 /* Don't set size hints during initialization; that apparently leads
1361 to a race condition. See the thread at 1370 to a race condition. See the thread at
@@ -1435,6 +1444,11 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1435 hint_flags |= GDK_HINT_USER_POS; 1444 hint_flags |= GDK_HINT_USER_POS;
1436 } 1445 }
1437 1446
1447 size_hints.base_width /= scale;
1448 size_hints.base_height /= scale;
1449 size_hints.width_inc /= scale;
1450 size_hints.height_inc /= scale;
1451
1438 if (hint_flags != f->output_data.x->hint_flags 1452 if (hint_flags != f->output_data.x->hint_flags
1439 || memcmp (&size_hints, 1453 || memcmp (&size_hints,
1440 &f->output_data.x->size_hints, 1454 &f->output_data.x->size_hints,
@@ -3556,14 +3570,14 @@ update_theme_scrollbar_height (void)
3556int 3570int
3557xg_get_default_scrollbar_width (void) 3571xg_get_default_scrollbar_width (void)
3558{ 3572{
3559 return scroll_bar_width_for_theme; 3573 return scroll_bar_width_for_theme * xg_get_gdk_scale ();
3560} 3574}
3561 3575
3562int 3576int
3563xg_get_default_scrollbar_height (void) 3577xg_get_default_scrollbar_height (void)
3564{ 3578{
3565 /* Apparently there's no default height for themes. */ 3579 /* Apparently there's no default height for themes. */
3566 return scroll_bar_width_for_theme; 3580 return scroll_bar_width_for_theme * xg_get_gdk_scale ();
3567} 3581}
3568 3582
3569/* Return the scrollbar id for X Window WID on display DPY. 3583/* Return the scrollbar id for X Window WID on display DPY.
@@ -3762,14 +3776,18 @@ xg_update_scrollbar_pos (struct frame *f,
3762 int width, 3776 int width,
3763 int height) 3777 int height)
3764{ 3778{
3765
3766 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); 3779 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
3767
3768 if (wscroll) 3780 if (wscroll)
3769 { 3781 {
3770 GtkWidget *wfixed = f->output_data.x->edit_widget; 3782 GtkWidget *wfixed = f->output_data.x->edit_widget;
3771 GtkWidget *wparent = gtk_widget_get_parent (wscroll); 3783 GtkWidget *wparent = gtk_widget_get_parent (wscroll);
3772 gint msl; 3784 gint msl;
3785 int scale = xg_get_gdk_scale ();
3786
3787 top /= scale;
3788 left /= scale;
3789 height /= scale;
3790 left -= (scale - 1) * ((width / scale) >> 1);
3773 3791
3774 /* Clear out old position. */ 3792 /* Clear out old position. */
3775 int oldx = -1, oldy = -1, oldw, oldh; 3793 int oldx = -1, oldy = -1, oldw, oldh;
@@ -3800,11 +3818,15 @@ xg_update_scrollbar_pos (struct frame *f,
3800 gdk_window_process_all_updates (); 3818 gdk_window_process_all_updates ();
3801#endif 3819#endif
3802 if (oldx != -1 && oldw > 0 && oldh > 0) 3820 if (oldx != -1 && oldw > 0 && oldh > 0)
3803 /* Clear under old scroll bar position. This must be done after 3821 {
3804 the gtk_widget_queue_draw and gdk_window_process_all_updates 3822 /* Clear under old scroll bar position. This must be done after
3805 above. */ 3823 the gtk_widget_queue_draw and gdk_window_process_all_updates
3806 x_clear_area (f, 3824 above. */
3807 oldx, oldy, oldw, oldh); 3825 oldw += (scale - 1) * oldw;
3826 oldx -= (scale - 1) * oldw;
3827 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3828 oldx, oldy, oldw, oldh);
3829 }
3808 3830
3809 /* GTK does not redraw until the main loop is entered again, but 3831 /* GTK does not redraw until the main loop is entered again, but
3810 if there are no X events pending we will not enter it. So we sync 3832 if there are no X events pending we will not enter it. So we sync
diff --git a/src/image.c b/src/image.c
index ffbed747590..87029bfa1b0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -237,7 +237,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
237#endif /* HAVE_NTGUI */ 237#endif /* HAVE_NTGUI */
238 238
239#ifdef HAVE_NS 239#ifdef HAVE_NS
240 void *bitmap = ns_image_from_XBM (bits, width, height); 240 void *bitmap = ns_image_from_XBM (bits, width, height, 0, 0);
241 if (!bitmap) 241 if (!bitmap)
242 return -1; 242 return -1;
243#endif 243#endif
@@ -2706,7 +2706,7 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2706 convert_mono_to_color_image (f, img, fg, bg); 2706 convert_mono_to_color_image (f, img, fg, bg);
2707 2707
2708#elif defined (HAVE_NS) 2708#elif defined (HAVE_NS)
2709 img->pixmap = ns_image_from_XBM (data, img->width, img->height); 2709 img->pixmap = ns_image_from_XBM (data, img->width, img->height, fg, bg);
2710 2710
2711#else 2711#else
2712 img->pixmap = 2712 img->pixmap =
diff --git a/src/keyboard.c b/src/keyboard.c
index bd79f901970..77f7fb97898 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -391,47 +391,47 @@ static void store_user_signal_events (void);
391static void 391static void
392kset_echo_string (struct kboard *kb, Lisp_Object val) 392kset_echo_string (struct kboard *kb, Lisp_Object val)
393{ 393{
394 kb->INTERNAL_FIELD (echo_string) = val; 394 kb->echo_string_ = val;
395} 395}
396static void 396static void
397kset_kbd_queue (struct kboard *kb, Lisp_Object val) 397kset_kbd_queue (struct kboard *kb, Lisp_Object val)
398{ 398{
399 kb->INTERNAL_FIELD (kbd_queue) = val; 399 kb->kbd_queue_ = val;
400} 400}
401static void 401static void
402kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val) 402kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
403{ 403{
404 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val; 404 kb->Vkeyboard_translate_table_ = val;
405} 405}
406static void 406static void
407kset_last_prefix_arg (struct kboard *kb, Lisp_Object val) 407kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
408{ 408{
409 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val; 409 kb->Vlast_prefix_arg_ = val;
410} 410}
411static void 411static void
412kset_last_repeatable_command (struct kboard *kb, Lisp_Object val) 412kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
413{ 413{
414 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val; 414 kb->Vlast_repeatable_command_ = val;
415} 415}
416static void 416static void
417kset_local_function_key_map (struct kboard *kb, Lisp_Object val) 417kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
418{ 418{
419 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val; 419 kb->Vlocal_function_key_map_ = val;
420} 420}
421static void 421static void
422kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val) 422kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
423{ 423{
424 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val; 424 kb->Voverriding_terminal_local_map_ = val;
425} 425}
426static void 426static void
427kset_real_last_command (struct kboard *kb, Lisp_Object val) 427kset_real_last_command (struct kboard *kb, Lisp_Object val)
428{ 428{
429 kb->INTERNAL_FIELD (Vreal_last_command) = val; 429 kb->Vreal_last_command_ = val;
430} 430}
431static void 431static void
432kset_system_key_syms (struct kboard *kb, Lisp_Object val) 432kset_system_key_syms (struct kboard *kb, Lisp_Object val)
433{ 433{
434 kb->INTERNAL_FIELD (system_key_syms) = val; 434 kb->system_key_syms_ = val;
435} 435}
436 436
437 437
@@ -8707,12 +8707,10 @@ read_char_minibuf_menu_prompt (int commandflag,
8707 while (BUFFERP (obj)); 8707 while (BUFFERP (obj));
8708 kset_defining_kbd_macro (current_kboard, orig_defn_macro); 8708 kset_defining_kbd_macro (current_kboard, orig_defn_macro);
8709 8709
8710 if (!INTEGERP (obj) || XINT (obj) == -2) 8710 if (!INTEGERP (obj) || XINT (obj) == -2
8711 return obj; 8711 || (! EQ (obj, menu_prompt_more_char)
8712 8712 && (!INTEGERP (menu_prompt_more_char)
8713 if (! EQ (obj, menu_prompt_more_char) 8713 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))))
8714 && (!INTEGERP (menu_prompt_more_char)
8715 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char))))))
8716 { 8714 {
8717 if (!NILP (KVAR (current_kboard, defining_kbd_macro))) 8715 if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
8718 store_kbd_macro_char (obj); 8716 store_kbd_macro_char (obj);
diff --git a/src/keyboard.h b/src/keyboard.h
index 0ce6d184482..bcdeaf62165 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -25,7 +25,7 @@ INLINE_HEADER_BEGIN
25 25
26/* Most code should use this macro to access Lisp fields in struct kboard. */ 26/* Most code should use this macro to access Lisp fields in struct kboard. */
27 27
28#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) 28#define KVAR(kboard, field) ((kboard)->field ## _)
29 29
30/* Each KBOARD represents one logical input stream from which Emacs 30/* Each KBOARD represents one logical input stream from which Emacs
31 gets input. If we are using ordinary terminals, it has one KBOARD 31 gets input. If we are using ordinary terminals, it has one KBOARD
@@ -78,32 +78,32 @@ struct kboard
78 can effectively wait for input in the any-kboard state, and hence 78 can effectively wait for input in the any-kboard state, and hence
79 avoid blocking out the other KBOARDs. See universal-argument in 79 avoid blocking out the other KBOARDs. See universal-argument in
80 lisp/simple.el for an example. */ 80 lisp/simple.el for an example. */
81 Lisp_Object INTERNAL_FIELD (Voverriding_terminal_local_map); 81 Lisp_Object Voverriding_terminal_local_map_;
82 82
83 /* Last command executed by the editor command loop, not counting 83 /* Last command executed by the editor command loop, not counting
84 commands that set the prefix argument. */ 84 commands that set the prefix argument. */
85 Lisp_Object INTERNAL_FIELD (Vlast_command); 85 Lisp_Object Vlast_command_;
86 86
87 /* Normally same as last-command, but never modified by other commands. */ 87 /* Normally same as last-command, but never modified by other commands. */
88 Lisp_Object INTERNAL_FIELD (Vreal_last_command); 88 Lisp_Object Vreal_last_command_;
89 89
90 /* User-supplied table to translate input characters through. */ 90 /* User-supplied table to translate input characters through. */
91 Lisp_Object INTERNAL_FIELD (Vkeyboard_translate_table); 91 Lisp_Object Vkeyboard_translate_table_;
92 92
93 /* Last command that may be repeated by `repeat'. */ 93 /* Last command that may be repeated by `repeat'. */
94 Lisp_Object INTERNAL_FIELD (Vlast_repeatable_command); 94 Lisp_Object Vlast_repeatable_command_;
95 95
96 /* The prefix argument for the next command, in raw form. */ 96 /* The prefix argument for the next command, in raw form. */
97 Lisp_Object INTERNAL_FIELD (Vprefix_arg); 97 Lisp_Object Vprefix_arg_;
98 98
99 /* Saved prefix argument for the last command, in raw form. */ 99 /* Saved prefix argument for the last command, in raw form. */
100 Lisp_Object INTERNAL_FIELD (Vlast_prefix_arg); 100 Lisp_Object Vlast_prefix_arg_;
101 101
102 /* Unread events specific to this kboard. */ 102 /* Unread events specific to this kboard. */
103 Lisp_Object INTERNAL_FIELD (kbd_queue); 103 Lisp_Object kbd_queue_;
104 104
105 /* Non-nil while a kbd macro is being defined. */ 105 /* Non-nil while a kbd macro is being defined. */
106 Lisp_Object INTERNAL_FIELD (defining_kbd_macro); 106 Lisp_Object defining_kbd_macro_;
107 107
108 /* The start of storage for the current keyboard macro. */ 108 /* The start of storage for the current keyboard macro. */
109 Lisp_Object *kbd_macro_buffer; 109 Lisp_Object *kbd_macro_buffer;
@@ -125,28 +125,28 @@ struct kboard
125 ptrdiff_t kbd_macro_bufsize; 125 ptrdiff_t kbd_macro_bufsize;
126 126
127 /* Last anonymous kbd macro defined. */ 127 /* Last anonymous kbd macro defined. */
128 Lisp_Object INTERNAL_FIELD (Vlast_kbd_macro); 128 Lisp_Object Vlast_kbd_macro_;
129 129
130 /* Alist of system-specific X windows key symbols. */ 130 /* Alist of system-specific X windows key symbols. */
131 Lisp_Object INTERNAL_FIELD (Vsystem_key_alist); 131 Lisp_Object Vsystem_key_alist_;
132 132
133 /* Cache for modify_event_symbol. */ 133 /* Cache for modify_event_symbol. */
134 Lisp_Object INTERNAL_FIELD (system_key_syms); 134 Lisp_Object system_key_syms_;
135 135
136 /* The kind of display: x, w32, ... */ 136 /* The kind of display: x, w32, ... */
137 Lisp_Object INTERNAL_FIELD (Vwindow_system); 137 Lisp_Object Vwindow_system_;
138 138
139 /* Keymap mapping keys to alternative preferred forms. 139 /* Keymap mapping keys to alternative preferred forms.
140 See the DEFVAR for more documentation. */ 140 See the DEFVAR for more documentation. */
141 Lisp_Object INTERNAL_FIELD (Vlocal_function_key_map); 141 Lisp_Object Vlocal_function_key_map_;
142 142
143 /* Keymap mapping ASCII function key sequences onto their preferred 143 /* Keymap mapping ASCII function key sequences onto their preferred
144 forms. Initialized by the terminal-specific lisp files. See the 144 forms. Initialized by the terminal-specific lisp files. See the
145 DEFVAR for more documentation. */ 145 DEFVAR for more documentation. */
146 Lisp_Object INTERNAL_FIELD (Vinput_decode_map); 146 Lisp_Object Vinput_decode_map_;
147 147
148 /* Minibufferless frames on this display use this frame's minibuffer. */ 148 /* Minibufferless frames on this display use this frame's minibuffer. */
149 Lisp_Object INTERNAL_FIELD (Vdefault_minibuffer_frame); 149 Lisp_Object Vdefault_minibuffer_frame_;
150 150
151 /* Number of displays using this KBOARD. Normally 1, but can be 151 /* Number of displays using this KBOARD. Normally 1, but can be
152 larger when you have multiple screens on a single X display. */ 152 larger when you have multiple screens on a single X display. */
@@ -154,7 +154,7 @@ struct kboard
154 154
155 /* The text we're echoing in the modeline - partial key sequences, 155 /* The text we're echoing in the modeline - partial key sequences,
156 usually. This is nil when not echoing. */ 156 usually. This is nil when not echoing. */
157 Lisp_Object INTERNAL_FIELD (echo_string); 157 Lisp_Object echo_string_;
158 158
159 /* This flag indicates that events were put into kbd_queue 159 /* This flag indicates that events were put into kbd_queue
160 while Emacs was running for some other KBOARD. 160 while Emacs was running for some other KBOARD.
@@ -179,42 +179,42 @@ struct kboard
179INLINE void 179INLINE void
180kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val) 180kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val)
181{ 181{
182 kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val; 182 kb->Vdefault_minibuffer_frame_ = val;
183} 183}
184INLINE void 184INLINE void
185kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val) 185kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val)
186{ 186{
187 kb->INTERNAL_FIELD (defining_kbd_macro) = val; 187 kb->defining_kbd_macro_ = val;
188} 188}
189INLINE void 189INLINE void
190kset_input_decode_map (struct kboard *kb, Lisp_Object val) 190kset_input_decode_map (struct kboard *kb, Lisp_Object val)
191{ 191{
192 kb->INTERNAL_FIELD (Vinput_decode_map) = val; 192 kb->Vinput_decode_map_ = val;
193} 193}
194INLINE void 194INLINE void
195kset_last_command (struct kboard *kb, Lisp_Object val) 195kset_last_command (struct kboard *kb, Lisp_Object val)
196{ 196{
197 kb->INTERNAL_FIELD (Vlast_command) = val; 197 kb->Vlast_command_ = val;
198} 198}
199INLINE void 199INLINE void
200kset_last_kbd_macro (struct kboard *kb, Lisp_Object val) 200kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
201{ 201{
202 kb->INTERNAL_FIELD (Vlast_kbd_macro) = val; 202 kb->Vlast_kbd_macro_ = val;
203} 203}
204INLINE void 204INLINE void
205kset_prefix_arg (struct kboard *kb, Lisp_Object val) 205kset_prefix_arg (struct kboard *kb, Lisp_Object val)
206{ 206{
207 kb->INTERNAL_FIELD (Vprefix_arg) = val; 207 kb->Vprefix_arg_ = val;
208} 208}
209INLINE void 209INLINE void
210kset_system_key_alist (struct kboard *kb, Lisp_Object val) 210kset_system_key_alist (struct kboard *kb, Lisp_Object val)
211{ 211{
212 kb->INTERNAL_FIELD (Vsystem_key_alist) = val; 212 kb->Vsystem_key_alist_ = val;
213} 213}
214INLINE void 214INLINE void
215kset_window_system (struct kboard *kb, Lisp_Object val) 215kset_window_system (struct kboard *kb, Lisp_Object val)
216{ 216{
217 kb->INTERNAL_FIELD (Vwindow_system) = val; 217 kb->Vwindow_system_ = val;
218} 218}
219 219
220/* Temporarily used before a frame has been opened. */ 220/* Temporarily used before a frame has been opened. */
diff --git a/src/lisp.h b/src/lisp.h
index 55c4c662c06..6d34ce3b052 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1144,10 +1144,6 @@ LISP_MACRO_DEFUN_VOID (CHECK_TYPE,
1144 (int ok, Lisp_Object predicate, Lisp_Object x), 1144 (int ok, Lisp_Object predicate, Lisp_Object x),
1145 (ok, predicate, x)) 1145 (ok, predicate, x))
1146 1146
1147/* Deprecated and will be removed soon. */
1148
1149#define INTERNAL_FIELD(field) field ## _
1150
1151/* See the macros in intervals.h. */ 1147/* See the macros in intervals.h. */
1152 1148
1153typedef struct interval *INTERVAL; 1149typedef struct interval *INTERVAL;
diff --git a/src/lisp.mk b/src/lisp.mk
deleted file mode 100644
index ee2a07c0fd7..00000000000
--- a/src/lisp.mk
+++ /dev/null
@@ -1,174 +0,0 @@
1### lisp.mk --- src/Makefile fragment for GNU Emacs
2
3## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2015 Free Software
4## Foundation, Inc.
5
6## This file is part of GNU Emacs.
7
8## GNU Emacs is free software: you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation, either version 3 of the License, or
11## (at your option) any later version.
12
13## GNU Emacs is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16## GNU General Public License for more details.
17
18## You should have received a copy of the GNU General Public License
19## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
21### Commentary:
22
23## This is the list of all Lisp files that might be loaded into the
24## dumped Emacs. Some of them are not loaded on all platforms, but
25## the DOC file on every platform uses them (because the DOC file is
26## supposed to be platform-independent).
27## It is arranged like this because it is easier to generate it
28## semi-mechanically from loadup.el this way.
29## Eg something like:
30## sed -e 's/"[ )].*//' -n -e '/(load "/ s/.*load "//p' loadup.el | \
31## grep -vE 'site-|ldefs-boot'
32## minus any duplicates.
33## Note that you can generally just add a ".elc" extension to every file
34## that does not have an explicit .el extension, but beware of any
35## no-byte-compile ones.
36
37## Confusingly, international/cp51932 and international/eucjp-ms are
38## unconditionally loaded from language/japanese, instead of being
39## loaded directly from loadup.el; FIXME.
40
41## Note that this list should not include lisp files which might not
42## be present, like site-load.el and site-init.el; this makefile
43## expects them all to be either present or buildable.
44
45## Place loaddefs.el first, so it gets generated first, since it is on
46## the critical path (relevant in parallel compilations).
47
48### Code:
49
50## NB: This list is parsed by sed in the main src/Makefile.
51## Do not change the formatting.
52lisp = \
53 $(lispsource)/loaddefs.el \
54 $(lispsource)/loadup.el \
55 $(lispsource)/emacs-lisp/byte-run.elc \
56 $(lispsource)/emacs-lisp/backquote.elc \
57 $(lispsource)/subr.elc \
58 $(lispsource)/version.elc \
59 $(lispsource)/widget.elc \
60 $(lispsource)/custom.elc \
61 $(lispsource)/emacs-lisp/map-ynp.elc \
62 $(lispsource)/cus-start.elc \
63 $(lispsource)/international/mule.elc \
64 $(lispsource)/international/mule-conf.elc \
65 $(lispsource)/env.elc \
66 $(lispsource)/format.elc \
67 $(lispsource)/bindings.elc \
68 $(lispsource)/files.elc \
69 $(lispsource)/emacs-lisp/macroexp.elc \
70 $(lispsource)/cus-face.elc \
71 $(lispsource)/faces.elc \
72 $(lispsource)/button.elc \
73 $(lispsource)/startup.elc \
74 $(lispsource)/emacs-lisp/cl-preloaded.elc \
75 $(lispsource)/emacs-lisp/nadvice.elc \
76 $(lispsource)/minibuffer.elc \
77 $(lispsource)/abbrev.elc \
78 $(lispsource)/simple.elc \
79 $(lispsource)/help.elc \
80 $(lispsource)/jka-cmpr-hook.elc \
81 $(lispsource)/epa-hook.elc \
82 $(lispsource)/international/mule-cmds.elc \
83 $(lispsource)/case-table.elc \
84 $(lispsource)/international/characters.elc \
85 $(lispsource)/composite.elc \
86 $(lispsource)/international/charprop.el \
87 $(lispsource)/language/chinese.elc \
88 $(lispsource)/language/cyrillic.elc \
89 $(lispsource)/language/indian.elc \
90 $(lispsource)/language/sinhala.elc \
91 $(lispsource)/language/english.elc \
92 $(lispsource)/language/ethiopic.elc \
93 $(lispsource)/language/european.elc \
94 $(lispsource)/language/czech.elc \
95 $(lispsource)/language/slovak.elc \
96 $(lispsource)/language/romanian.elc \
97 $(lispsource)/language/greek.elc \
98 $(lispsource)/language/hebrew.elc \
99 $(lispsource)/language/japanese.elc \
100 $(lispsource)/international/cp51932.el \
101 $(lispsource)/international/eucjp-ms.el \
102 $(lispsource)/language/korean.elc \
103 $(lispsource)/language/lao.elc \
104 $(lispsource)/language/tai-viet.elc \
105 $(lispsource)/language/thai.elc \
106 $(lispsource)/language/tibetan.elc \
107 $(lispsource)/language/vietnamese.elc \
108 $(lispsource)/language/misc-lang.elc \
109 $(lispsource)/language/utf-8-lang.elc \
110 $(lispsource)/language/georgian.elc \
111 $(lispsource)/language/khmer.elc \
112 $(lispsource)/language/burmese.elc \
113 $(lispsource)/language/cham.elc \
114 $(lispsource)/indent.elc \
115 $(lispsource)/window.elc \
116 $(lispsource)/frame.elc \
117 $(lispsource)/term/tty-colors.elc \
118 $(lispsource)/font-core.elc \
119 $(lispsource)/facemenu.elc \
120 $(lispsource)/emacs-lisp/syntax.elc \
121 $(lispsource)/font-lock.elc \
122 $(lispsource)/jit-lock.elc \
123 $(lispsource)/mouse.elc \
124 $(lispsource)/scroll-bar.elc \
125 $(lispsource)/select.elc \
126 $(lispsource)/emacs-lisp/timer.elc \
127 $(lispsource)/isearch.elc \
128 $(lispsource)/rfn-eshadow.elc \
129 $(lispsource)/menu-bar.elc \
130 $(lispsource)/emacs-lisp/lisp.elc \
131 $(lispsource)/textmodes/page.elc \
132 $(lispsource)/register.elc \
133 $(lispsource)/textmodes/paragraphs.elc \
134 $(lispsource)/progmodes/prog-mode.elc \
135 $(lispsource)/emacs-lisp/lisp-mode.elc \
136 $(lispsource)/progmodes/elisp-mode.elc \
137 $(lispsource)/textmodes/text-mode.elc \
138 $(lispsource)/textmodes/fill.elc \
139 $(lispsource)/newcomment.elc \
140 $(lispsource)/replace.elc \
141 $(lispsource)/emacs-lisp/tabulated-list.elc \
142 $(lispsource)/buff-menu.elc \
143 $(lispsource)/fringe.elc \
144 $(lispsource)/emacs-lisp/regexp-opt.elc \
145 $(lispsource)/image.elc \
146 $(lispsource)/international/fontset.elc \
147 $(lispsource)/dnd.elc \
148 $(lispsource)/tool-bar.elc \
149 $(lispsource)/dynamic-setting.elc \
150 $(lispsource)/x-dnd.elc \
151 $(lispsource)/term/common-win.elc \
152 $(lispsource)/term/x-win.elc \
153 $(lispsource)/w32-vars.elc \
154 $(lispsource)/term/w32-win.elc \
155 $(lispsource)/ls-lisp.elc \
156 $(lispsource)/disp-table.elc \
157 $(lispsource)/dos-w32.elc \
158 $(lispsource)/w32-fns.elc \
159 $(lispsource)/dos-fns.elc \
160 $(lispsource)/dos-vars.elc \
161 $(lispsource)/term/pc-win.elc \
162 $(lispsource)/term/internal.elc \
163 $(lispsource)/term/ns-win.elc \
164 $(lispsource)/mwheel.elc \
165 $(lispsource)/emacs-lisp/float-sup.elc \
166 $(lispsource)/vc/vc-hooks.elc \
167 $(lispsource)/vc/ediff-hook.elc \
168 $(lispsource)/electric.elc \
169 $(lispsource)/emacs-lisp/eldoc.elc \
170 $(lispsource)/uniquify.elc \
171 $(lispsource)/tooltip.elc
172
173
174### lisp.mk ends here
diff --git a/src/lread.c b/src/lread.c
index a84450a4364..26c19d8338b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4592,8 +4592,10 @@ of the file, regardless of whether or not it has the `.elc' extension. */);
4592 4592
4593 DEFVAR_LISP ("load-read-function", Vload_read_function, 4593 DEFVAR_LISP ("load-read-function", Vload_read_function,
4594 doc: /* Function used by `load' and `eval-region' for reading expressions. 4594 doc: /* Function used by `load' and `eval-region' for reading expressions.
4595The default is nil, which means use the function `read'. */); 4595Called with a single argument (the stream from which to read).
4596 Vload_read_function = Qnil; 4596The default is to use the function `read'. */);
4597 DEFSYM (Qread, "read");
4598 Vload_read_function = Qread;
4597 4599
4598 DEFVAR_LISP ("load-source-file-function", Vload_source_file_function, 4600 DEFVAR_LISP ("load-source-file-function", Vload_source_file_function,
4599 doc: /* Function called in `load' to load an Emacs Lisp source file. 4601 doc: /* Function called in `load' to load an Emacs Lisp source file.
diff --git a/src/macfont.h b/src/macfont.h
index f311577f051..403be94e332 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -48,7 +48,7 @@ struct mac_glyph_layout
48typedef CTFontDescriptorRef FontDescriptorRef; 48typedef CTFontDescriptorRef FontDescriptorRef;
49typedef CTFontRef FontRef; 49typedef CTFontRef FontRef;
50typedef CTFontSymbolicTraits FontSymbolicTraits; 50typedef CTFontSymbolicTraits FontSymbolicTraits;
51typedef CTCharacterCollection CharacterCollection; 51typedef NSCharacterCollection CharacterCollection;
52 52
53#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute 53#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute
54#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute 54#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute
@@ -79,8 +79,8 @@ enum {
79}; 79};
80 80
81enum { 81enum {
82 MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = kCTIdentityMappingCharacterCollection, 82 MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = NSIdentityMappingCharacterCollection,
83 MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = kCTAdobeJapan1CharacterCollection 83 MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = NSAdobeJapan1CharacterCollection
84}; 84};
85 85
86#define mac_font_descriptor_create_with_attributes \ 86#define mac_font_descriptor_create_with_attributes \
diff --git a/src/nsfns.m b/src/nsfns.m
index f8863e6d400..8a3c6ccf2b0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1075,7 +1075,6 @@ This function is an internal primitive--use `make-frame' instead. */)
1075 Lisp_Object name; 1075 Lisp_Object name;
1076 int minibuffer_only = 0; 1076 int minibuffer_only = 0;
1077 long window_prompting = 0; 1077 long window_prompting = 0;
1078 int width, height;
1079 ptrdiff_t count = specpdl_ptr - specpdl; 1078 ptrdiff_t count = specpdl_ptr - specpdl;
1080 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1079 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1081 Lisp_Object display; 1080 Lisp_Object display;
@@ -1455,6 +1454,15 @@ ns_run_file_dialog (void)
1455 ns_fd_data.panel = nil; 1454 ns_fd_data.panel = nil;
1456} 1455}
1457 1456
1457#ifdef NS_IMPL_COCOA
1458#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9
1459#define MODAL_OK_RESPONSE NSModalResponseOK
1460#endif
1461#endif
1462#ifndef MODAL_OK_RESPONSE
1463#define MODAL_OK_RESPONSE NSOKButton
1464#endif
1465
1458DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0, 1466DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0,
1459 doc: /* Use a graphical panel to read a file name, using prompt PROMPT. 1467 doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
1460Optional arg DIR, if non-nil, supplies a default directory. 1468Optional arg DIR, if non-nil, supplies a default directory.
@@ -1466,10 +1474,9 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1466 Lisp_Object init, Lisp_Object dir_only_p) 1474 Lisp_Object init, Lisp_Object dir_only_p)
1467{ 1475{
1468 static id fileDelegate = nil; 1476 static id fileDelegate = nil;
1469 BOOL ret;
1470 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p); 1477 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
1471 id panel; 1478 id panel;
1472 Lisp_Object fname; 1479 Lisp_Object fname = Qnil;
1473 1480
1474 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : 1481 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
1475 [NSString stringWithUTF8String: SSDATA (prompt)]; 1482 [NSString stringWithUTF8String: SSDATA (prompt)];
@@ -1549,20 +1556,17 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1549 while (ns_fd_data.panel != nil) 1556 while (ns_fd_data.panel != nil)
1550 [NSApp run]; 1557 [NSApp run];
1551 1558
1552 ret = (ns_fd_data.ret == NSOKButton); 1559 if (ns_fd_data.ret == MODAL_OK_RESPONSE)
1553
1554 if (ret)
1555 { 1560 {
1556 NSString *str = ns_filename_from_panel (panel); 1561 NSString *str = ns_filename_from_panel (panel);
1557 if (! str) str = ns_directory_from_panel (panel); 1562 if (! str) str = ns_directory_from_panel (panel);
1558 if (! str) ret = NO; 1563 if (str) fname = build_string ([str UTF8String]);
1559 else fname = build_string ([str UTF8String]);
1560 } 1564 }
1561 1565
1562 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; 1566 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
1563 unblock_input (); 1567 unblock_input ();
1564 1568
1565 return ret ? fname : Qnil; 1569 return fname;
1566} 1570}
1567 1571
1568const char * 1572const char *
@@ -2677,7 +2681,16 @@ compute_tip_xy (struct frame *f,
2677 pt.y = dpyinfo->last_mouse_motion_y; 2681 pt.y = dpyinfo->last_mouse_motion_y;
2678 /* Convert to screen coordinates */ 2682 /* Convert to screen coordinates */
2679 pt = [view convertPoint: pt toView: nil]; 2683 pt = [view convertPoint: pt toView: nil];
2684#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
2680 pt = [[view window] convertBaseToScreen: pt]; 2685 pt = [[view window] convertBaseToScreen: pt];
2686#else
2687 {
2688 NSRect r = NSMakeRect (pt.x, pt.y, 0, 0);
2689 r = [[view window] convertRectToScreen: r];
2690 pt.x = r.origin.x;
2691 pt.y = r.origin.y;
2692 }
2693#endif
2681 } 2694 }
2682 else 2695 else
2683 { 2696 {
diff --git a/src/nsimage.m b/src/nsimage.m
index f37ad38ad1e..9302cd2f212 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -53,12 +53,13 @@ int image_trace_num = 0;
53 ========================================================================== */ 53 ========================================================================== */
54 54
55void * 55void *
56ns_image_from_XBM (unsigned char *bits, int width, int height) 56ns_image_from_XBM (unsigned char *bits, int width, int height,
57 unsigned long fg, unsigned long bg)
57{ 58{
58 NSTRACE (ns_image_from_XBM); 59 NSTRACE (ns_image_from_XBM);
59 return [[EmacsImage alloc] initFromXBM: bits 60 return [[EmacsImage alloc] initFromXBM: bits
60 width: width height: height 61 width: width height: height
61 flip: YES]; 62 fg: fg bg: bg];
62} 63}
63 64
64void * 65void *
@@ -186,7 +187,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
186 187
187 /* The next two lines cause the DPI of the image to be ignored. 188 /* The next two lines cause the DPI of the image to be ignored.
188 This seems to be the behavior users expect. */ 189 This seems to be the behavior users expect. */
190#ifdef NS_IMPL_COCOA
191#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
189 [image setScalesWhenResized: YES]; 192 [image setScalesWhenResized: YES];
193#endif
194#endif
190 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; 195 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
191 196
192 [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; 197 [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
@@ -204,16 +209,8 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
204 209
205 210
206- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h 211- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
207 flip: (BOOL)flip 212 fg: (unsigned long)fg bg: (unsigned long)bg
208{ 213{
209 return [self initFromSkipXBM: bits width: w height: h flip: flip length: 0];
210}
211
212
213- initFromSkipXBM: (unsigned char *)bits width: (int)w height: (int)h
214 flip: (BOOL)flip length: (int)length;
215{
216 int bpr = (w + 7) / 8;
217 unsigned char *planes[5]; 214 unsigned char *planes[5];
218 215
219 [self initWithSize: NSMakeSize (w, h)]; 216 [self initWithSize: NSMakeSize (w, h)];
@@ -226,57 +223,58 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
226 bytesPerRow: w bitsPerPixel: 0]; 223 bytesPerRow: w bitsPerPixel: 0];
227 224
228 [bmRep getBitmapDataPlanes: planes]; 225 [bmRep getBitmapDataPlanes: planes];
226
227 if (fg == 0 && bg == 0)
228 bg = 0xffffff;
229
229 { 230 {
230 /* pull bits out to set the (bytewise) alpha mask */ 231 /* pull bits out to set the (bytewise) alpha mask */
231 int i, j, k; 232 int i, j, k;
232 unsigned char *s = bits; 233 unsigned char *s = bits;
234 unsigned char *rr = planes[0];
235 unsigned char *gg = planes[1];
236 unsigned char *bb = planes[2];
233 unsigned char *alpha = planes[3]; 237 unsigned char *alpha = planes[3];
234 unsigned char swt[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 238 unsigned char fgr = (fg >> 16) & 0xff;
235 3, 11, 7, 15}; 239 unsigned char fgg = (fg >> 8) & 0xff;
236 unsigned char c, bitPat; 240 unsigned char fgb = fg & 0xff;
237 241 unsigned char bgr = (bg >> 16) & 0xff;
238 for (j = 0; j < h; j++) 242 unsigned char bgg = (bg >> 8) & 0xff;
239 for (i = 0; i < bpr; i++) 243 unsigned char bgb = bg & 0xff;
244 unsigned char c;
245
246 int idx = 0;
247 for (j = 0; j < h; ++j)
248 for (i = 0; i < w; )
240 { 249 {
241 if (length) 250 c = *s++;
251 for (k = 0; i < w && k < 8; ++k, ++i)
242 { 252 {
243 unsigned char s1, s2; 253 *alpha++ = 0xff;
244 while (*s++ != 'x' && s < bits + length); 254 if (c & 1)
245 if (s >= bits + length)
246 { 255 {
247 [bmRep release]; 256 *rr++ = fgr;
248 bmRep = nil; 257 *gg++ = fgg;
249 return nil; 258 *bb++ = fgb;
250 } 259 }
251#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10) 260 else
252 s1 = *s++; 261 {
253 s2 = *s++; 262 *rr++ = bgr;
254 c = hexchar (s1) * 0x10 + hexchar (s2); 263 *gg++ = bgg;
255 } 264 *bb++ = bgb;
256 else 265 }
257 c = *s++; 266 idx++;
258 267 c >>= 1;
259 bitPat = flip ? swt[c >> 4] | (swt[c & 0xf] << 4) : c ^ 255;
260 for (k =0; k<8; k++)
261 {
262 *alpha++ = (bitPat & 0x80) ? 0xff : 0;
263 bitPat <<= 1;
264 } 268 }
265 } 269 }
266 } 270 }
267 271
272 xbm_fg = fg;
268 [self addRepresentation: bmRep]; 273 [self addRepresentation: bmRep];
269
270 memset (planes[0], 0, w*h);
271 memset (planes[1], 0, w*h);
272 memset (planes[2], 0, w*h);
273 [self setXBMColor: [NSColor blackColor]];
274 return self; 274 return self;
275} 275}
276 276
277 277/* Set color for a bitmap image. */
278/* Set color for a bitmap image (see initFromSkipXBM). Note that the alpha
279 is used as a mask, so we just memset the entire array. */
280- setXBMColor: (NSColor *)color 278- setXBMColor: (NSColor *)color
281{ 279{
282 NSSize s = [self size]; 280 NSSize s = [self size];
@@ -296,19 +294,21 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
296 294
297 [bmRep getBitmapDataPlanes: planes]; 295 [bmRep getBitmapDataPlanes: planes];
298 296
299 /* we used to just do this, but Cocoa seems to have a bug when rendering
300 an alpha-masked image onto a dark background where it bloats the mask */
301 /* memset (planes[0..2], r, g, b*0xff, len); */
302 { 297 {
303 int i, len = s.width*s.height; 298 int i, len = s.width*s.height;
304 int rr = r * 0xff, gg = g * 0xff, bb = b * 0xff; 299 int rr = r * 0xff, gg = g * 0xff, bb = b * 0xff;
305 for (i =0; i<len; i++) 300 unsigned char fgr = (xbm_fg >> 16) & 0xff;
306 if (planes[3][i] != 0) 301 unsigned char fgg = (xbm_fg >> 8) & 0xff;
302 unsigned char fgb = xbm_fg & 0xff;
303
304 for (i = 0; i < len; ++i)
305 if (planes[0][i] == fgr && planes[1][i] == fgg && planes[2][i] == fgb)
307 { 306 {
308 planes[0][i] = rr; 307 planes[0][i] = rr;
309 planes[1][i] = gg; 308 planes[1][i] = gg;
310 planes[2][i] = bb; 309 planes[2][i] = bb;
311 } 310 }
311 xbm_fg = ((rr << 16) & 0xff) + ((gg << 8) & 0xff) + (bb & 0xff);
312 } 312 }
313 313
314 return self; 314 return self;
@@ -356,7 +356,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
356 356
357 /* The next two lines cause the DPI of the image to be ignored. 357 /* The next two lines cause the DPI of the image to be ignored.
358 This seems to be the behavior users expect. */ 358 This seems to be the behavior users expect. */
359#ifdef NS_IMPL_COCOA
360#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
359 [self setScalesWhenResized: YES]; 361 [self setScalesWhenResized: YES];
362#endif
363#endif
360 [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; 364 [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])];
361 365
362 break; 366 break;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 26fe26e5e0d..b5cb64d68e5 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1418,7 +1418,7 @@ Lisp_Object
1418ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) 1418ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1419{ 1419{
1420 id dialog; 1420 id dialog;
1421 Lisp_Object window, tem, title; 1421 Lisp_Object tem, title;
1422 NSPoint p; 1422 NSPoint p;
1423 BOOL isQ; 1423 BOOL isQ;
1424 NSAutoreleasePool *pool; 1424 NSAutoreleasePool *pool;
@@ -1506,7 +1506,11 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1506 area.size.width = ICONSIZE; 1506 area.size.width = ICONSIZE;
1507 area.size.height= ICONSIZE; 1507 area.size.height= ICONSIZE;
1508 img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; 1508 img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
1509#ifdef NS_IMPL_COCOA
1510#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
1509 [img setScalesWhenResized: YES]; 1511 [img setScalesWhenResized: YES];
1512#endif
1513#endif
1510 [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; 1514 [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
1511 imgView = [[NSImageView alloc] initWithFrame: area]; 1515 imgView = [[NSImageView alloc] initWithFrame: area];
1512 [imgView setImage: img]; 1516 [imgView setImage: img];
diff --git a/src/nsterm.h b/src/nsterm.h
index 9035ee1a328..c06b7c49a6d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -341,13 +341,12 @@ typedef float EmacsCGFloat;
341 NSBitmapImageRep *bmRep; /* used for accessing pixel data */ 341 NSBitmapImageRep *bmRep; /* used for accessing pixel data */
342 unsigned char *pixmapData[5]; /* shortcut to access pixel data */ 342 unsigned char *pixmapData[5]; /* shortcut to access pixel data */
343 NSColor *stippleMask; 343 NSColor *stippleMask;
344 unsigned long xbm_fg;
344} 345}
345+ allocInitFromFile: (Lisp_Object)file; 346+ allocInitFromFile: (Lisp_Object)file;
346- (void)dealloc; 347- (void)dealloc;
347- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h 348- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
348 flip: (BOOL)flip; 349 fg: (unsigned long)fg bg: (unsigned long)bg;
349- initFromSkipXBM: (unsigned char *)bits width: (int)w height: (int)h
350 flip: (BOOL)flip length: (int)length;
351- setXBMColor: (NSColor *)color; 350- setXBMColor: (NSColor *)color;
352- initForXPMWithDepth: (int)depth width: (int)width height: (int)height; 351- initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
353- (void)setPixmapData; 352- (void)setPixmapData;
@@ -397,6 +396,7 @@ typedef float EmacsCGFloat;
397- condemn; 396- condemn;
398- reprieve; 397- reprieve;
399- (bool)judge; 398- (bool)judge;
399+ (CGFloat)scrollerWidth;
400@end 400@end
401 401
402 402
@@ -864,7 +864,8 @@ extern void syms_of_nsselect (void);
864 864
865/* From nsimage.m, needed in image.c */ 865/* From nsimage.m, needed in image.c */
866struct image; 866struct image;
867extern void *ns_image_from_XBM (unsigned char *bits, int width, int height); 867extern void *ns_image_from_XBM (unsigned char *bits, int width, int height,
868 unsigned long fg, unsigned long bg);
868extern void *ns_image_for_XPM (int width, int height, int depth); 869extern void *ns_image_for_XPM (int width, int height, int depth);
869extern void *ns_image_from_file (Lisp_Object file); 870extern void *ns_image_from_file (Lisp_Object file);
870extern bool ns_load_image (struct frame *f, struct image *img, 871extern bool ns_load_image (struct frame *f, struct image *img,
diff --git a/src/nsterm.m b/src/nsterm.m
index e90c3d70db3..67a03898d13 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1538,7 +1538,7 @@ ns_get_color (const char *name, NSColor **col)
1538{ 1538{
1539 NSColor *new = nil; 1539 NSColor *new = nil;
1540 static char hex[20]; 1540 static char hex[20];
1541 int scaling; 1541 int scaling = 0;
1542 float r = -1.0, g, b; 1542 float r = -1.0, g, b;
1543 NSString *nsname = [NSString stringWithUTF8String: name]; 1543 NSString *nsname = [NSString stringWithUTF8String: name];
1544 1544
@@ -2093,6 +2093,18 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2093 return; 2093 return;
2094} 2094}
2095 2095
2096static void
2097ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
2098{
2099 if (FRAME_NS_VIEW (f))
2100 {
2101 ns_focus (f, &dest, 1);
2102 [FRAME_NS_VIEW (f) scrollRect: src
2103 by: NSMakeSize (dest.origin.x - src.origin.x,
2104 dest.origin.y - src.origin.y)];
2105 ns_unfocus (f);
2106 }
2107}
2096 2108
2097static void 2109static void
2098ns_scroll_run (struct window *w, struct run *run) 2110ns_scroll_run (struct window *w, struct run *run)
@@ -2145,11 +2157,8 @@ ns_scroll_run (struct window *w, struct run *run)
2145 { 2157 {
2146 NSRect srcRect = NSMakeRect (x, from_y, width, height); 2158 NSRect srcRect = NSMakeRect (x, from_y, width, height);
2147 NSRect dstRect = NSMakeRect (x, to_y, width, height); 2159 NSRect dstRect = NSMakeRect (x, to_y, width, height);
2148 NSPoint dstOrigin = NSMakePoint (x, to_y);
2149 2160
2150 ns_focus (f, &dstRect, 1); 2161 ns_copy_bits (f, srcRect , dstRect);
2151 NSCopyBits (0, srcRect , dstOrigin);
2152 ns_unfocus (f);
2153 } 2162 }
2154 2163
2155 unblock_input (); 2164 unblock_input ();
@@ -2205,13 +2214,10 @@ ns_shift_glyphs_for_insert (struct frame *f,
2205{ 2214{
2206 NSRect srcRect = NSMakeRect (x, y, width, height); 2215 NSRect srcRect = NSMakeRect (x, y, width, height);
2207 NSRect dstRect = NSMakeRect (x+shift_by, y, width, height); 2216 NSRect dstRect = NSMakeRect (x+shift_by, y, width, height);
2208 NSPoint dstOrigin = dstRect.origin;
2209 2217
2210 NSTRACE (ns_shift_glyphs_for_insert); 2218 NSTRACE (ns_shift_glyphs_for_insert);
2211 2219
2212 ns_focus (f, &dstRect, 1); 2220 ns_copy_bits (f, srcRect, dstRect);
2213 NSCopyBits (0, srcRect, dstOrigin);
2214 ns_unfocus (f);
2215} 2221}
2216 2222
2217 2223
@@ -2317,7 +2323,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2317 for (i = 0; i < len; i++) 2323 for (i = 0; i < len; i++)
2318 cbits[i] = ~(bits[i] & 0xff); 2324 cbits[i] = ~(bits[i] & 0xff);
2319 img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h 2325 img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h
2320 flip: NO]; 2326 fg: 0 bg: 0];
2321 bimgs[p->which - 1] = img; 2327 bimgs[p->which - 1] = img;
2322 xfree (cbits); 2328 xfree (cbits);
2323 } 2329 }
@@ -2459,6 +2465,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2459 2465
2460 switch (cursor_type) 2466 switch (cursor_type)
2461 { 2467 {
2468 case DEFAULT_CURSOR:
2462 case NO_CURSOR: 2469 case NO_CURSOR:
2463 break; 2470 break;
2464 case FILLED_BOX_CURSOR: 2471 case FILLED_BOX_CURSOR:
@@ -3188,6 +3195,96 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
3188 3195
3189 3196
3190static void 3197static void
3198ns_draw_composite_glyph_string_foreground (struct glyph_string *s)
3199{
3200 int i, j, x;
3201 struct font *font = s->font;
3202
3203 /* If first glyph of S has a left box line, start drawing the text
3204 of S to the right of that box line. */
3205 if (s->face && s->face->box != FACE_NO_BOX
3206 && s->first_glyph->left_box_line_p)
3207 x = s->x + eabs (s->face->box_line_width);
3208 else
3209 x = s->x;
3210
3211 /* S is a glyph string for a composition. S->cmp_from is the index
3212 of the first character drawn for glyphs of this composition.
3213 S->cmp_from == 0 means we are drawing the very first character of
3214 this composition. */
3215
3216 /* Draw a rectangle for the composition if the font for the very
3217 first character of the composition could not be loaded. */
3218 if (s->font_not_found_p)
3219 {
3220 if (s->cmp_from == 0)
3221 {
3222 NSRect r = NSMakeRect (s->x, s->y, s->width-1, s->height -1);
3223 ns_draw_box (r, 1, FRAME_CURSOR_COLOR (s->f), 1, 1);
3224 }
3225 }
3226 else if (! s->first_glyph->u.cmp.automatic)
3227 {
3228 int y = s->ybase;
3229
3230 for (i = 0, j = s->cmp_from; i < s->nchars; i++, j++)
3231 /* TAB in a composition means display glyphs with padding
3232 space on the left or right. */
3233 if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
3234 {
3235 int xx = x + s->cmp->offsets[j * 2];
3236 int yy = y - s->cmp->offsets[j * 2 + 1];
3237
3238 font->driver->draw (s, j, j + 1, xx, yy, false);
3239 if (s->face->overstrike)
3240 font->driver->draw (s, j, j + 1, xx + 1, yy, false);
3241 }
3242 }
3243 else
3244 {
3245 Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
3246 Lisp_Object glyph;
3247 int y = s->ybase;
3248 int width = 0;
3249
3250 for (i = j = s->cmp_from; i < s->cmp_to; i++)
3251 {
3252 glyph = LGSTRING_GLYPH (gstring, i);
3253 if (NILP (LGLYPH_ADJUSTMENT (glyph)))
3254 width += LGLYPH_WIDTH (glyph);
3255 else
3256 {
3257 int xoff, yoff, wadjust;
3258
3259 if (j < i)
3260 {
3261 font->driver->draw (s, j, i, x, y, false);
3262 if (s->face->overstrike)
3263 font->driver->draw (s, j, i, x + 1, y, false);
3264 x += width;
3265 }
3266 xoff = LGLYPH_XOFF (glyph);
3267 yoff = LGLYPH_YOFF (glyph);
3268 wadjust = LGLYPH_WADJUST (glyph);
3269 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, false);
3270 if (s->face->overstrike)
3271 font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff,
3272 false);
3273 x += wadjust;
3274 j = i + 1;
3275 width = 0;
3276 }
3277 }
3278 if (j < i)
3279 {
3280 font->driver->draw (s, j, i, x, y, false);
3281 if (s->face->overstrike)
3282 font->driver->draw (s, j, i, x + 1, y, false);
3283 }
3284 }
3285}
3286
3287static void
3191ns_draw_glyph_string (struct glyph_string *s) 3288ns_draw_glyph_string (struct glyph_string *s)
3192/* -------------------------------------------------------------------------- 3289/* --------------------------------------------------------------------------
3193 External (RIF): Main draw-text call. 3290 External (RIF): Main draw-text call.
@@ -3279,13 +3376,14 @@ ns_draw_glyph_string (struct glyph_string *s)
3279 3376
3280 { 3377 {
3281 BOOL isComposite = s->first_glyph->type == COMPOSITE_GLYPH; 3378 BOOL isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
3282 int end = isComposite ? s->cmp_to : s->nchars;
3283
3284 font->driver->draw
3285 (s, s->cmp_from, end, s->x, s->ybase,
3286 (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
3287 || flags == NS_DUMPGLYPH_MOUSEFACE);
3288 3379
3380 if (isComposite)
3381 ns_draw_composite_glyph_string_foreground (s);
3382 else
3383 font->driver->draw
3384 (s, s->cmp_from, s->nchars, s->x, s->ybase,
3385 (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
3386 || flags == NS_DUMPGLYPH_MOUSEFACE);
3289 } 3387 }
3290 3388
3291 { 3389 {
@@ -3866,7 +3964,6 @@ ns_set_horizontal_scroll_bar (struct window *window,
3866 EmacsScroller *bar; 3964 EmacsScroller *bar;
3867 int top, height, left, width; 3965 int top, height, left, width;
3868 int window_x, window_width; 3966 int window_x, window_width;
3869 int pixel_width = WINDOW_PIXEL_WIDTH (window);
3870 BOOL update_p = YES; 3967 BOOL update_p = YES;
3871 3968
3872 /* optimization; display engine sends WAY too many of these.. */ 3969 /* optimization; display engine sends WAY too many of these.. */
@@ -4224,6 +4321,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
4224 terminal->menu_show_hook = ns_menu_show; 4321 terminal->menu_show_hook = ns_menu_show;
4225 terminal->popup_dialog_hook = ns_popup_dialog; 4322 terminal->popup_dialog_hook = ns_popup_dialog;
4226 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; 4323 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
4324 terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar;
4227 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; 4325 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
4228 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; 4326 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
4229 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; 4327 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
@@ -4508,7 +4606,7 @@ ns_term_shutdown (int sig)
4508 4606
4509- (id)init 4607- (id)init
4510{ 4608{
4511 if (self = [super init]) 4609 if ((self = [super init]))
4512 { 4610 {
4513#ifdef NS_IMPL_COCOA 4611#ifdef NS_IMPL_COCOA
4514 self->isFirst = YES; 4612 self->isFirst = YES;
@@ -4795,21 +4893,43 @@ ns_term_shutdown (int sig)
4795 EV_TRAILER ((id)nil); 4893 EV_TRAILER ((id)nil);
4796} 4894}
4797 4895
4896static bool
4897runAlertPanel(NSString *title,
4898 NSString *msgFormat,
4899 NSString *defaultButton,
4900 NSString *alternateButton)
4901{
4902#if !defined (NS_IMPL_COCOA) || \
4903 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
4904 return NSRunAlertPanel(title, msgFormat, defaultButton, alternateButton, nil)
4905 == NSAlertDefaultReturn;
4906#else
4907 NSAlert *alert = [[NSAlert alloc] init];
4908 [alert setAlertStyle: NSCriticalAlertStyle];
4909 [alert setMessageText: msgFormat];
4910 [alert addButtonWithTitle: defaultButton];
4911 [alert addButtonWithTitle: alternateButton];
4912 NSInteger ret = [alert runModal];
4913 [alert release];
4914 return ret == NSAlertFirstButtonReturn;
4915#endif
4916}
4917
4798 4918
4799- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender 4919- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
4800{ 4920{
4801 int ret; 4921 bool ret;
4802 4922
4803 if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO 4923 if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO
4804 return NSTerminateNow; 4924 return NSTerminateNow;
4805 4925
4806 ret = NSRunAlertPanel(ns_app_name, 4926 ret = runAlertPanel(ns_app_name,
4807 @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?", 4927 @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?",
4808 @"Save Buffers and Exit", @"Cancel", nil); 4928 @"Save Buffers and Exit", @"Cancel");
4809 4929
4810 if (ret == NSAlertDefaultReturn) 4930 if (ret)
4811 return NSTerminateNow; 4931 return NSTerminateNow;
4812 else if (ret == NSAlertAlternateReturn) 4932 else
4813 return NSTerminateCancel; 4933 return NSTerminateCancel;
4814 return NSTerminateNow; /* just in case */ 4934 return NSTerminateNow; /* just in case */
4815} 4935}
@@ -5153,9 +5273,6 @@ not_in_argv (NSString *arg)
5153 int code; 5273 int code;
5154 unsigned fnKeysym = 0; 5274 unsigned fnKeysym = 0;
5155 static NSMutableArray *nsEvArray; 5275 static NSMutableArray *nsEvArray;
5156#ifdef NS_IMPL_GNUSTEP
5157 static BOOL firstTime = YES;
5158#endif
5159 int left_is_none; 5276 int left_is_none;
5160 unsigned int flags = [theEvent modifierFlags]; 5277 unsigned int flags = [theEvent modifierFlags];
5161 5278
@@ -5384,18 +5501,6 @@ not_in_argv (NSString *arg)
5384 } 5501 }
5385 5502
5386 5503
5387#ifdef NS_IMPL_GNUSTEP
5388 /* if we get here we should send the key for input manager processing */
5389 /* Disable warning, there is nothing a user can do about it anyway, and
5390 it does not seem to matter. */
5391#if 0
5392 if (firstTime && [[NSInputManager currentInputManager]
5393 wantsToDelayTextChangeNotifications] == NO)
5394 fprintf (stderr,
5395 "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n");
5396#endif
5397 firstTime = NO;
5398#endif
5399 if (NS_KEYLOG && !processingCompose) 5504 if (NS_KEYLOG && !processingCompose)
5400 fprintf (stderr, "keyDown: Begin compose sequence.\n"); 5505 fprintf (stderr, "keyDown: Begin compose sequence.\n");
5401 5506
@@ -6160,8 +6265,10 @@ if (cols > 0 && rows > 0)
6160 6265
6161 [win setAcceptsMouseMovedEvents: YES]; 6266 [win setAcceptsMouseMovedEvents: YES];
6162 [win setDelegate: self]; 6267 [win setDelegate: self];
6268#if !defined (NS_IMPL_COCOA) || \
6269 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6163 [win useOptimizedDrawing: YES]; 6270 [win useOptimizedDrawing: YES];
6164 6271#endif
6165 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); 6272 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
6166 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); 6273 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
6167 [win setResizeIncrements: sz]; 6274 [win setResizeIncrements: sz];
@@ -6222,8 +6329,10 @@ if (cols > 0 && rows > 0)
6222 if ([col alphaComponent] != (EmacsCGFloat) 1.0) 6329 if ([col alphaComponent] != (EmacsCGFloat) 1.0)
6223 [win setOpaque: NO]; 6330 [win setOpaque: NO];
6224 6331
6332#if !defined (NS_IMPL_COCOA) || \
6333 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6225 [self allocateGState]; 6334 [self allocateGState];
6226 6335#endif
6227 [NSApp registerServicesMenuSendTypes: ns_send_types 6336 [NSApp registerServicesMenuSendTypes: ns_send_types
6228 returnTypes: nil]; 6337 returnTypes: nil];
6229 6338
@@ -6278,7 +6387,7 @@ if (cols > 0 && rows > 0)
6278 } 6387 }
6279 else if (next_maximized == FULLSCREEN_HEIGHT 6388 else if (next_maximized == FULLSCREEN_HEIGHT
6280 || (next_maximized == -1 6389 || (next_maximized == -1
6281 && abs (defaultFrame.size.height - result.size.height) 6390 && abs ((int)(defaultFrame.size.height - result.size.height))
6282 > FRAME_LINE_HEIGHT (emacsframe))) 6391 > FRAME_LINE_HEIGHT (emacsframe)))
6283 { 6392 {
6284 /* first click */ 6393 /* first click */
@@ -6301,7 +6410,7 @@ if (cols > 0 && rows > 0)
6301 } 6410 }
6302 else if (next_maximized == FULLSCREEN_MAXIMIZED 6411 else if (next_maximized == FULLSCREEN_MAXIMIZED
6303 || (next_maximized == -1 6412 || (next_maximized == -1
6304 && abs (defaultFrame.size.width - result.size.width) 6413 && abs ((int)(defaultFrame.size.width - result.size.width))
6305 > FRAME_COLUMN_WIDTH (emacsframe))) 6414 > FRAME_COLUMN_WIDTH (emacsframe)))
6306 { 6415 {
6307 result = defaultFrame; /* second click */ 6416 result = defaultFrame; /* second click */
@@ -6548,7 +6657,10 @@ if (cols > 0 && rows > 0)
6548 [fw setTitle:[w title]]; 6657 [fw setTitle:[w title]];
6549 [fw setDelegate:self]; 6658 [fw setDelegate:self];
6550 [fw setAcceptsMouseMovedEvents: YES]; 6659 [fw setAcceptsMouseMovedEvents: YES];
6660#if !defined (NS_IMPL_COCOA) || \
6661 MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
6551 [fw useOptimizedDrawing: YES]; 6662 [fw useOptimizedDrawing: YES];
6663#endif
6552 [fw setResizeIncrements: sz]; 6664 [fw setResizeIncrements: sz];
6553 [fw setBackgroundColor: col]; 6665 [fw setBackgroundColor: col];
6554 if ([col alphaComponent] != (EmacsCGFloat) 1.0) 6666 if ([col alphaComponent] != (EmacsCGFloat) 1.0)
@@ -6791,7 +6903,7 @@ if (cols > 0 && rows > 0)
6791/* NSDraggingDestination protocol methods. Actually this is not really a 6903/* NSDraggingDestination protocol methods. Actually this is not really a
6792 protocol, but a category of Object. O well... */ 6904 protocol, but a category of Object. O well... */
6793 6905
6794-(NSUInteger) draggingEntered: (id <NSDraggingInfo>) sender 6906-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
6795{ 6907{
6796 NSTRACE (draggingEntered); 6908 NSTRACE (draggingEntered);
6797 return NSDragOperationGeneric; 6909 return NSDragOperationGeneric;
@@ -7076,7 +7188,6 @@ if (cols > 0 && rows > 0)
7076 one screen, we want to constrain. Other times not. */ 7188 one screen, we want to constrain. Other times not. */
7077 NSArray *screens = [NSScreen screens]; 7189 NSArray *screens = [NSScreen screens];
7078 NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i; 7190 NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i;
7079 struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
7080 NSTRACE (constrainFrameRect); 7191 NSTRACE (constrainFrameRect);
7081 NSTRACE_RECT ("input", frameRect); 7192 NSTRACE_RECT ("input", frameRect);
7082 7193
@@ -7172,7 +7283,15 @@ if (cols > 0 && rows > 0)
7172{ 7283{
7173 /* TODO: if we want to allow variable widths, this is the place to do it, 7284 /* TODO: if we want to allow variable widths, this is the place to do it,
7174 however neither GNUstep nor Cocoa support it very well */ 7285 however neither GNUstep nor Cocoa support it very well */
7175 return [NSScroller scrollerWidth]; 7286 CGFloat r;
7287#if !defined (NS_IMPL_COCOA) || \
7288 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
7289 r = [NSScroller scrollerWidth];
7290#else
7291 r = [NSScroller scrollerWidthForControlSize: NSRegularControlSize
7292 scrollerStyle: NSScrollerStyleLegacy];
7293#endif
7294 return r;
7176} 7295}
7177 7296
7178 7297
diff --git a/src/process.c b/src/process.c
index 3e04cb76387..ce78d818e29 100644
--- a/src/process.c
+++ b/src/process.c
@@ -136,8 +136,8 @@ extern int sys_select (int, fd_set *, fd_set *, fd_set *,
136 136
137/* Work around GCC 4.7.0 bug with strict overflow checking; see 137/* Work around GCC 4.7.0 bug with strict overflow checking; see
138 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>. 138 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
139 These lines can be removed once the GCC bug is fixed. */ 139 This bug appears to be fixed in GCC 5.1, so don't work around it there. */
140#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 140#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3
141# pragma GCC diagnostic ignored "-Wstrict-overflow" 141# pragma GCC diagnostic ignored "-Wstrict-overflow"
142#endif 142#endif
143 143
diff --git a/src/syntax.c b/src/syntax.c
index 2f821564294..1695815902a 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -186,7 +186,7 @@ static bool in_classes (int, Lisp_Object);
186static void 186static void
187bset_syntax_table (struct buffer *b, Lisp_Object val) 187bset_syntax_table (struct buffer *b, Lisp_Object val)
188{ 188{
189 b->INTERNAL_FIELD (syntax_table) = val; 189 b->syntax_table_ = val;
190} 190}
191 191
192/* Whether the syntax of the character C has the prefix flag set. */ 192/* Whether the syntax of the character C has the prefix flag set. */
diff --git a/src/window.c b/src/window.c
index 0fcf82d43f4..b8281661b4d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1748,7 +1748,11 @@ if it isn't already recorded. */)
1748 || b->clip_changed 1748 || b->clip_changed
1749 || b->prevent_redisplay_optimizations_p 1749 || b->prevent_redisplay_optimizations_p
1750 || window_outdated (w)) 1750 || window_outdated (w))
1751 && !noninteractive) 1751 /* Don't call display routines if we didn't yet create any real
1752 frames, because the glyph matrices are not yet allocated in
1753 that case. This could happen in some code that runs in the
1754 daemon during initialization (e.g., see bug#20565). */
1755 && !(noninteractive || FRAME_INITIAL_P (WINDOW_XFRAME (w))))
1752 { 1756 {
1753 struct text_pos startp; 1757 struct text_pos startp;
1754 struct it it; 1758 struct it it;
diff --git a/src/xdisp.c b/src/xdisp.c
index 5a27adc2b18..c2f0b747c6e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13359,6 +13359,13 @@ redisplay_internal (void)
13359 if (f->fonts_changed) 13359 if (f->fonts_changed)
13360 { 13360 {
13361 adjust_frame_glyphs (f); 13361 adjust_frame_glyphs (f);
13362 /* Disable all redisplay optimizations for this frame.
13363 This is because adjust_frame_glyphs resets the
13364 enabled_p flag for all glyph rows of all windows, so
13365 many optimizations will fail anyway, and some might
13366 fail to test that flag and do bogus things as
13367 result. */
13368 SET_FRAME_GARBAGED (f);
13362 f->fonts_changed = false; 13369 f->fonts_changed = false;
13363 } 13370 }
13364 /* If cursor type has been changed on the frame 13371 /* If cursor type has been changed on the frame
@@ -13753,6 +13760,10 @@ redisplay_internal (void)
13753 if (f->fonts_changed) 13760 if (f->fonts_changed)
13754 { 13761 {
13755 adjust_frame_glyphs (f); 13762 adjust_frame_glyphs (f);
13763 /* Disable all redisplay optimizations for this
13764 frame. For the reasons, see the comment near
13765 the previous call to adjust_frame_glyphs above. */
13766 SET_FRAME_GARBAGED (f);
13756 f->fonts_changed = false; 13767 f->fonts_changed = false;
13757 goto retry_frame; 13768 goto retry_frame;
13758 } 13769 }
diff --git a/src/xterm.c b/src/xterm.c
index 3d3e0a70cfa..8f595c87214 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -263,7 +263,7 @@ static int x_dispatch_event (XEvent *, Display *);
263#endif 263#endif
264/* Don't declare this _Noreturn because we want no 264/* Don't declare this _Noreturn because we want no
265 interference with debugging failing X calls. */ 265 interference with debugging failing X calls. */
266static void x_connection_closed (Display *, const char *); 266static void x_connection_closed (Display *, const char *, bool);
267static void x_wm_set_window_state (struct frame *, int); 267static void x_wm_set_window_state (struct frame *, int);
268static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); 268static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
269static void x_initialize (void); 269static void x_initialize (void);
@@ -3664,7 +3664,9 @@ x_draw_glyph_string (struct glyph_string *s)
3664static void 3664static void
3665x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) 3665x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by)
3666{ 3666{
3667 x_free_cr_resources (f); 3667/* Never called on a GUI frame, see
3668 http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00456.html
3669*/
3668 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), 3670 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f),
3669 f->output_data.x->normal_gc, 3671 f->output_data.x->normal_gc,
3670 x, y, width, height, 3672 x, y, width, height,
@@ -9249,7 +9251,7 @@ static char *error_msg;
9249 the text of an error message that lead to the connection loss. */ 9251 the text of an error message that lead to the connection loss. */
9250 9252
9251static void 9253static void
9252x_connection_closed (Display *dpy, const char *error_message) 9254x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
9253{ 9255{
9254 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 9256 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
9255 Lisp_Object frame, tail; 9257 Lisp_Object frame, tail;
@@ -9268,6 +9270,7 @@ x_connection_closed (Display *dpy, const char *error_message)
9268 dpyinfo->reference_count++; 9270 dpyinfo->reference_count++;
9269 dpyinfo->terminal->reference_count++; 9271 dpyinfo->terminal->reference_count++;
9270 } 9272 }
9273 if (ioerror) dpyinfo->display = 0;
9271 9274
9272 /* First delete frames whose mini-buffers are on frames 9275 /* First delete frames whose mini-buffers are on frames
9273 that are on the dead display. */ 9276 that are on the dead display. */
@@ -9405,7 +9408,7 @@ x_error_quitter (Display *display, XErrorEvent *event)
9405 XGetErrorText (display, event->error_code, buf, sizeof (buf)); 9408 XGetErrorText (display, event->error_code, buf, sizeof (buf));
9406 sprintf (buf1, "X protocol error: %s on protocol request %d", 9409 sprintf (buf1, "X protocol error: %s on protocol request %d",
9407 buf, event->request_code); 9410 buf, event->request_code);
9408 x_connection_closed (display, buf1); 9411 x_connection_closed (display, buf1, false);
9409} 9412}
9410 9413
9411 9414
@@ -9420,7 +9423,7 @@ x_io_error_quitter (Display *display)
9420 9423
9421 snprintf (buf, sizeof buf, "Connection lost to X server `%s'", 9424 snprintf (buf, sizeof buf, "Connection lost to X server `%s'",
9422 DisplayString (display)); 9425 DisplayString (display));
9423 x_connection_closed (display, buf); 9426 x_connection_closed (display, buf, true);
9424 return 0; 9427 return 0;
9425} 9428}
9426 9429
@@ -12251,7 +12254,7 @@ static struct redisplay_interface x_redisplay_interface =
12251 x_draw_window_cursor, 12254 x_draw_window_cursor,
12252 x_draw_vertical_window_border, 12255 x_draw_vertical_window_border,
12253 x_draw_window_divider, 12256 x_draw_window_divider,
12254 x_shift_glyphs_for_insert, 12257 x_shift_glyphs_for_insert, /* Never called, se comment in function. */
12255 x_show_hourglass, 12258 x_show_hourglass,
12256 x_hide_hourglass 12259 x_hide_hourglass
12257 }; 12260 };