aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog180
-rw-r--r--src/Makefile.in6
-rw-r--r--src/alloc.c57
-rw-r--r--src/buffer.c61
-rw-r--r--src/buffer.h15
-rw-r--r--src/callint.c6
-rw-r--r--src/callproc.c6
-rw-r--r--src/character.h14
-rw-r--r--src/charset.c2
-rw-r--r--src/composite.c4
-rw-r--r--src/doc.c17
-rw-r--r--src/dosfns.c8
-rw-r--r--src/emacs.c6
-rw-r--r--src/eval.c80
-rw-r--r--src/fileio.c4
-rw-r--r--src/fns.c4
-rw-r--r--src/fontset.c2
-rw-r--r--src/fringe.c2
-rw-r--r--src/gnutls.c28
-rw-r--r--src/gnutls.h5
-rw-r--r--src/indent.c16
-rw-r--r--src/keyboard.c4
-rw-r--r--src/lisp.h3
-rw-r--r--src/lread.c2
-rw-r--r--src/makefile.w32-in10
-rw-r--r--src/minibuf.c11
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c4
-rw-r--r--src/process.c5
-rw-r--r--src/process.h1
-rw-r--r--src/s/gnu-linux.h3
-rw-r--r--src/s/ms-w32.h3
-rw-r--r--src/syntax.c2
-rw-r--r--src/w32menu.c29
-rw-r--r--src/w32term.c4
-rw-r--r--src/window.c15
-rw-r--r--src/xdisp.c136
-rw-r--r--src/xfaces.c4
-rw-r--r--src/xfns.c10
-rw-r--r--src/xml.c132
-rw-r--r--src/xsettings.c2
-rw-r--r--src/xterm.c4
42 files changed, 635 insertions, 274 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 381d2ad631c..18a3d4545e3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,180 @@
12012-04-09 Glenn Morris <rgm@gnu.org>
2
3 * doc.c (Fsnarf_documentation): Check variables, functions are bound,
4 not just in the obarray, before snarfing them. (Bug#11036)
5
6 * Makefile.in ($(leimdir)/leim-list.el):
7 Pass EMACS rather than BUILT_EMACS.
8
92012-04-09 Teodor Zlatanov <tzz@lifelogs.com>
10
11 * process.c (make_process):
12 * process.h: Add integer `gnutls_handshakes_tried' member to
13 process struct.
14
15 * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit. Add
16 convenience `GNUTLS_LOG2i' macro.
17
18 * gnutls.c (gnutls_log_function2i): Convenience log function.
19 (emacs_gnutls_read): Use new log functions,
20 `gnutls_handshakes_tried' process member, and
21 `GNUTLS_EMACS_HANDSHAKES_LIMIT' to limit the number of handshake
22 attempts per process (connection).
23
242012-04-09 Chong Yidong <cyd@gnu.org>
25
26 * eval.c (Fuser_variable_p, user_variable_p_eh)
27 (lisp_indirect_variable): Functions deleted.
28 (Fdefvar): Caller changed.
29
30 * callint.c (Finteractive, Fcall_interactively):
31 * minibuf.c (Fread_variable): Callers changed.
32
332012-04-09 Eli Zaretskii <eliz@gnu.org>
34
35 * xdisp.c (set_cursor_from_row): If the display string appears in
36 the buffer at position that is closer to point than the position
37 after the display string, display the cursor on the first glyph of
38 the display string. Fixes cursor display when a 'display' text
39 property immediately follows invisible text. (Bug#11094)
40
412012-04-09 Paul Eggert <eggert@cs.ucla.edu>
42
43 composite.c: use 'double' consistently
44 * composite.c (get_composition_id): Use 'double' consistently
45 instead of converting 'float' to 'double' and vice versa; this is
46 easier to understand and avoids a GCC warning.
47
482012-04-09 Glenn Morris <rgm@gnu.org>
49
50 * Makefile.in: Generate leim-list with bootstrap-emacs, in
51 preparation for dumping it with emacs. (Bug#4789)
52 (leimdir): New variable.
53 ($(leimdir)/leim-list.el): New rule.
54 (emacs$(EXEEXT)): Depend on leim-list.el.
55
56 * buffer.c (Qucs_set_table_for_input): Remove. (Bug#9821)
57 (Fget_buffer_create): Don't call Qucs_set_table_for_input.
58 (init_buffer_once, syms_of_buffer): Remove Qucs_set_table_for_input.
59
602012-04-08 Andreas Schwab <schwab@linux-m68k.org>
61
62 * lisp.h (struct Lisp_Symbol): Add explicit padding to ensure
63 proper alignment.
64
652012-04-07 Juanma Barranquero <lekktu@gmail.com>
66
67 * xml.c (init_libxml2_functions) [WINDOWSNT]:
68 Remove unused local variable.
69
702012-04-07 Paul Eggert <eggert@cs.ucla.edu>
71
72 Avoid unnecessary pointer scanning in garbage collection (Bug#10780).
73 * alloc.c (POINTERS_MIGHT_HIDE_IN_OBJECTS): New macro.
74 (mark_memory): Mark Lisp_Objects only if pointers might hide in
75 objects, as mark_maybe_pointer will catch them otherwise.
76 (GC_LISP_OBJECT_ALIGNMENT): Remove; no longer needed.
77 * s/gnu-linux.h (GC_LISP_OBJECT_ALIGNMENT) [__mc68000__]: Likewise.
78
792012-04-07 Paul Eggert <eggert@cs.ucla.edu>
80
81 Fix typo that broke non-Windows builds.
82 * xml.c (libxml2_loaded_p) [!!WINDOWSNT]: 'inine' -> 'inline'.
83
842012-04-07 Eli Zaretskii <eliz@gnu.org>
85
86 Support building on MS-Windows with libxml2.
87
88 * makefile.w32-in (OBJ2): Add xml.$(O).
89 (GLOBAL_SOURCES): Add xml.c.
90 ($(BLD)/xml.$(O)): New dependency list.
91
92 * xml.c (DEF_XML2_FN, LOAD_XML2_FN) [WINDOWSNT]: New macros.
93 (fn_htmlReadMemory, fn_xmlReadMemory, fn_xmlDocGetRootElement)
94 (fn_xmlFreeDoc, fn_xmlCleanupParser, fn_xmlCheckVersion)
95 [!WINDOWSNT]: New macros.
96 (init_libxml2_functions, libxml2_loaded_p): New functions.
97 (parse_region): Call fn_xmlCheckVersion instead of using the macro
98 LIBXML_TEST_VERSION. Call libxml2 functions via the fn_* macros.
99 (xml_cleanup_parser): New function, export for fn_xmlCleanupParser.
100 Calls xmlCleanupParser only if libxml2 was loaded (or statically
101 linked in).
102 (Flibxml_parse_html_region, Flibxml_parse_xml_region): Call
103 init_libxml2_functions before calling libxml2 functions.
104 (syms_of_xml) <Qlibxml2_dll>: DEFSYM it.
105
106 * emacs.c: Don't include libxml/parser.h.
107 (shut_down_emacs): Call xml_cleanup_parser, instead of calling
108 xmlCleanupParser directly.
109
110 * lisp.h [HAVE_LIBXML2]: Add prototype for xml_cleanup_parser.
111
1122012-04-07 Eli Zaretskii <eliz@gnu.org>
113
114 * indent.c (Fvertical_motion): If there is a display string at
115 point, use it.vpos to compute how many lines to backtrack after
116 move_it_to point. (Bug#11133)
117
1182012-04-06 Eli Zaretskii <eliz@gnu.org>
119
120 * buffer.h (FETCH_CHAR, FETCH_MULTIBYTE_CHAR):
121 * character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Add comments
122 about subtle differences between FETCH_CHAR* and STRING_CHAR*
123 macros related to unification of CJK characters. For the details,
124 see the discussion following the message here:
125 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11073#14.
126
1272012-04-04 Chong Yidong <cyd@gnu.org>
128
129 * keyboard.c (Vdelayed_warnings_list): Doc fix.
130
1312012-04-01 Eli Zaretskii <eliz@gnu.org>
132
133 * w32menu.c (simple_dialog_show, add_menu_item): Use SAFE_ALLOCA
134 instead of alloca. (Bug#11138)
135
1362012-04-01 Andreas Schwab <schwab@linux-m68k.org>
137
138 * w32menu.c (is_simple_dialog): Properly check lisp types.
139 (Bug#11141)
140
1412012-03-31 Eli Zaretskii <eliz@gnu.org>
142
143 * xdisp.c (move_it_by_lines): When DVPOS is positive, and the
144 position we get to after a call to move_it_to fails the
145 IS_POS_VALID_AFTER_MOVE_P test, move to the next buffer position
146 only if we wind up in a string from display property. (Bug#11063)
147
148 * window.c (Fdelete_other_windows_internal): Invalidate the row
149 and column information about mouse highlight, so that redisplay
150 restores it after reallocating the glyph matrices. (Bug#7464)
151
152 * xdisp.c (set_cursor_from_row): If `cursor' property on a display
153 string comes from a `display' text property, use the buffer
154 position of that property as if we actually saw that position in
155 the row's glyphs.
156 (move_it_by_lines): Remove the assertion that
157 "it->current_x == 0 && it->hpos == 0" which can be legitimately
158 violated when there's a before-string at the beginning of a line.
159 (Bug#11063)
160
1612012-03-30 Eli Zaretskii <eliz@gnu.org>
162
163 * xdisp.c (append_space_for_newline): If the default face was
164 remapped, use the remapped face for the appended newline.
165 (extend_face_to_end_of_line): Use the remapped default face for
166 extending the face to the end of the line.
167 (display_line): Call extend_face_to_end_of_line when the default
168 face was remapped. (Bug#11068)
169
1702012-03-29 Eli Zaretskii <eliz@gnu.org>
171
172 * s/ms-w32.h: Discourage from defining HAVE_GETCWD.
173
1742012-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
175
176 * keyboard.c (safe_run_hooks_error): Don't unquote strings.
177
12012-03-27 Glenn Morris <rgm@gnu.org> 1782012-03-27 Glenn Morris <rgm@gnu.org>
2 179
3 * search.c (Fword_search_backward_lax, Fword_search_forward_lax): 180 * search.c (Fword_search_backward_lax, Fword_search_forward_lax):
@@ -16,8 +193,7 @@
16 193
172012-03-25 Fabrice Popineau <fabrice.popineau@supelec.fr> 1942012-03-25 Fabrice Popineau <fabrice.popineau@supelec.fr>
18 195
19 * w32heap.c (_heap_init, _heap_term): Remove dead MSVC-specific 196 * w32heap.c (_heap_init, _heap_term): Remove dead MSVC-specific code.
20 code.
21 197
222012-03-25 Kenichi Handa <handa@m17n.org> 1982012-03-25 Kenichi Handa <handa@m17n.org>
23 199
diff --git a/src/Makefile.in b/src/Makefile.in
index 16424e9bc5f..466a091cde9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -49,6 +49,7 @@ lispsource = $(srcdir)/../lisp
49lib = ../lib 49lib = ../lib
50libsrc = ../lib-src 50libsrc = ../lib-src
51etc = ../etc 51etc = ../etc
52leimdir = ../leim
52oldXMenudir = ../oldXMenu 53oldXMenudir = ../oldXMenu
53lwlibdir = ../lwlib 54lwlibdir = ../lwlib
54lispdir = ../lisp 55lispdir = ../lisp
@@ -403,13 +404,16 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
403 404
404all: emacs$(EXEEXT) $(OTHER_FILES) 405all: emacs$(EXEEXT) $(OTHER_FILES)
405 406
407$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
408 cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe)
409
406## Does anyone ever pay attention to the load-path-shadows output here? 410## Does anyone ever pay attention to the load-path-shadows output here?
407## The dumped Emacs is as functional and more efficient than 411## The dumped Emacs is as functional and more efficient than
408## bootstrap-emacs, so we replace the latter with the former. 412## bootstrap-emacs, so we replace the latter with the former.
409## Strictly speaking, emacs does not depend directly on all of $lisp, 413## Strictly speaking, emacs does not depend directly on all of $lisp,
410## since not all pieces are used on all platforms. But DOC depends 414## since not all pieces are used on all platforms. But DOC depends
411## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here. 415## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
412emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) 416emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
413 if test "$(CANNOT_DUMP)" = "yes"; then \ 417 if test "$(CANNOT_DUMP)" = "yes"; then \
414 ln -f temacs$(EXEEXT) emacs$(EXEEXT); \ 418 ln -f temacs$(EXEEXT) emacs$(EXEEXT); \
415 EMACSLOADPATH=$(lispsource) ./emacs -batch \ 419 EMACSLOADPATH=$(lispsource) ./emacs -batch \
diff --git a/src/alloc.c b/src/alloc.c
index f85661415cd..16b004fc0e9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4251,23 +4251,38 @@ mark_maybe_pointer (void *p)
4251} 4251}
4252 4252
4253 4253
4254/* Alignment of Lisp_Object and pointer values. Use offsetof, as it 4254/* Alignment of pointer values. Use offsetof, as it sometimes returns
4255 sometimes returns a smaller alignment than GCC's __alignof__ and 4255 a smaller alignment than GCC's __alignof__ and mark_memory might
4256 mark_memory might miss objects if __alignof__ were used. For 4256 miss objects if __alignof__ were used. */
4257 example, on x86 with WIDE_EMACS_INT, __alignof__ (Lisp_Object) is 8
4258 but GC_LISP_OBJECT_ALIGNMENT should be 4. */
4259#ifndef GC_LISP_OBJECT_ALIGNMENT
4260# define GC_LISP_OBJECT_ALIGNMENT offsetof (struct {char a; Lisp_Object b;}, b)
4261#endif
4262#define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b) 4257#define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b)
4263 4258
4259/* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does
4260 not suffice, which is the typical case. A host where a Lisp_Object is
4261 wider than a pointer might allocate a Lisp_Object in non-adjacent halves.
4262 If USE_LSB_TAG, the bottom half is not a valid pointer, but it should
4263 suffice to widen it to to a Lisp_Object and check it that way. */
4264#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS != 0
4265# if !defined USE_LSB_TAG && UINTPTR_MAX >> VALBITS >> GCTYPEBITS != 0
4266 /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer
4267 nor mark_maybe_object can follow the pointers. This should not occur on
4268 any practical porting target. */
4269# error "MSB type bits straddle pointer-word boundaries"
4270# endif
4271 /* Marking via C pointers does not suffice, because Lisp_Objects contain
4272 pointer words that hold pointers ORed with type bits. */
4273# define POINTERS_MIGHT_HIDE_IN_OBJECTS 1
4274#else
4275 /* Marking via C pointers suffices, because Lisp_Objects contain pointer
4276 words that hold unmodified pointers. */
4277# define POINTERS_MIGHT_HIDE_IN_OBJECTS 0
4278#endif
4279
4264/* Mark Lisp objects referenced from the address range START+OFFSET..END 4280/* Mark Lisp objects referenced from the address range START+OFFSET..END
4265 or END+OFFSET..START. */ 4281 or END+OFFSET..START. */
4266 4282
4267static void 4283static void
4268mark_memory (void *start, void *end) 4284mark_memory (void *start, void *end)
4269{ 4285{
4270 Lisp_Object *p;
4271 void **pp; 4286 void **pp;
4272 int i; 4287 int i;
4273 4288
@@ -4284,11 +4299,6 @@ mark_memory (void *start, void *end)
4284 end = tem; 4299 end = tem;
4285 } 4300 }
4286 4301
4287 /* Mark Lisp_Objects. */
4288 for (p = start; (void *) p < end; p++)
4289 for (i = 0; i < sizeof *p; i += GC_LISP_OBJECT_ALIGNMENT)
4290 mark_maybe_object (*(Lisp_Object *) ((char *) p + i));
4291
4292 /* Mark Lisp data pointed to. This is necessary because, in some 4302 /* Mark Lisp data pointed to. This is necessary because, in some
4293 situations, the C compiler optimizes Lisp objects away, so that 4303 situations, the C compiler optimizes Lisp objects away, so that
4294 only a pointer to them remains. Example: 4304 only a pointer to them remains. Example:
@@ -4310,17 +4320,10 @@ mark_memory (void *start, void *end)
4310 for (pp = start; (void *) pp < end; pp++) 4320 for (pp = start; (void *) pp < end; pp++)
4311 for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT) 4321 for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT)
4312 { 4322 {
4313 void *w = *(void **) ((char *) pp + i); 4323 void *p = *(void **) ((char *) pp + i);
4314 mark_maybe_pointer (w); 4324 mark_maybe_pointer (p);
4315 4325 if (POINTERS_MIGHT_HIDE_IN_OBJECTS)
4316#ifdef USE_LSB_TAG 4326 mark_maybe_object (widen_to_Lisp_Object (p));
4317 /* A host where a Lisp_Object is wider than a pointer might
4318 allocate a Lisp_Object in non-adjacent halves. If
4319 USE_LSB_TAG, the bottom half is not a valid pointer, so
4320 widen it to to a Lisp_Object and check it that way. */
4321 if (sizeof w < sizeof (Lisp_Object))
4322 mark_maybe_object (widen_to_Lisp_Object (w));
4323#endif
4324 } 4327 }
4325} 4328}
4326 4329
@@ -6410,7 +6413,7 @@ void
6410syms_of_alloc (void) 6413syms_of_alloc (void)
6411{ 6414{
6412 DEFVAR_INT ("gc-cons-threshold", gc_cons_threshold, 6415 DEFVAR_INT ("gc-cons-threshold", gc_cons_threshold,
6413 doc: /* *Number of bytes of consing between garbage collections. 6416 doc: /* Number of bytes of consing between garbage collections.
6414Garbage collection can happen automatically once this many bytes have been 6417Garbage collection can happen automatically once this many bytes have been
6415allocated since the last garbage collection. All data types count. 6418allocated since the last garbage collection. All data types count.
6416 6419
@@ -6421,7 +6424,7 @@ prevent garbage collection during a part of the program.
6421See also `gc-cons-percentage'. */); 6424See also `gc-cons-percentage'. */);
6422 6425
6423 DEFVAR_LISP ("gc-cons-percentage", Vgc_cons_percentage, 6426 DEFVAR_LISP ("gc-cons-percentage", Vgc_cons_percentage,
6424 doc: /* *Portion of the heap used for allocation. 6427 doc: /* Portion of the heap used for allocation.
6425Garbage collection can happen automatically once this portion of the heap 6428Garbage collection can happen automatically once this portion of the heap
6426has been allocated since the last garbage collection. 6429has been allocated since the last garbage collection.
6427If this portion is smaller than `gc-cons-threshold', this is ignored. */); 6430If this portion is smaller than `gc-cons-threshold', this is ignored. */);
diff --git a/src/buffer.c b/src/buffer.c
index 1fea19b0d65..ca8d1ec5db3 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -128,7 +128,6 @@ static Lisp_Object Qchange_major_mode_hook;
128Lisp_Object Qfirst_change_hook; 128Lisp_Object Qfirst_change_hook;
129Lisp_Object Qbefore_change_functions; 129Lisp_Object Qbefore_change_functions;
130Lisp_Object Qafter_change_functions; 130Lisp_Object Qafter_change_functions;
131static Lisp_Object Qucs_set_table_for_input;
132 131
133static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; 132static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local;
134static Lisp_Object Qpermanent_local_hook; 133static Lisp_Object Qpermanent_local_hook;
@@ -402,13 +401,6 @@ even if it is dead. The return value is never nil. */)
402 if (!NILP (Vrun_hooks)) 401 if (!NILP (Vrun_hooks))
403 call1 (Vrun_hooks, Qbuffer_list_update_hook); 402 call1 (Vrun_hooks, Qbuffer_list_update_hook);
404 403
405 /* An error in calling the function here (should someone redefine it)
406 can lead to infinite regress until you run out of stack. rms
407 says that's not worth protecting against. */
408 if (!NILP (Ffboundp (Qucs_set_table_for_input)))
409 /* buffer is on buffer-alist, so no gcpro. */
410 call1 (Qucs_set_table_for_input, buffer);
411
412 return buffer; 404 return buffer;
413} 405}
414 406
@@ -5043,8 +5035,6 @@ init_buffer_once (void)
5043 Qkill_buffer_hook = intern_c_string ("kill-buffer-hook"); 5035 Qkill_buffer_hook = intern_c_string ("kill-buffer-hook");
5044 Fput (Qkill_buffer_hook, Qpermanent_local, Qt); 5036 Fput (Qkill_buffer_hook, Qpermanent_local, Qt);
5045 5037
5046 Qucs_set_table_for_input = intern_c_string ("ucs-set-table-for-input");
5047
5048 /* super-magic invisible buffer */ 5038 /* super-magic invisible buffer */
5049 Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1")); 5039 Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1"));
5050 Vbuffer_alist = Qnil; 5040 Vbuffer_alist = Qnil;
@@ -5200,9 +5190,6 @@ syms_of_buffer (void)
5200 DEFSYM (Qafter_change_functions, "after-change-functions"); 5190 DEFSYM (Qafter_change_functions, "after-change-functions");
5201 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); 5191 DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
5202 5192
5203 /* The next one is initialized in init_buffer_once. */
5204 staticpro (&Qucs_set_table_for_input);
5205
5206 Fput (Qprotected_field, Qerror_conditions, 5193 Fput (Qprotected_field, Qerror_conditions,
5207 pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); 5194 pure_cons (Qprotected_field, pure_cons (Qerror, Qnil)));
5208 Fput (Qprotected_field, Qerror_message, 5195 Fput (Qprotected_field, Qerror_message,
@@ -5244,7 +5231,7 @@ This is the same as (default-value 'ctl-arrow). */);
5244 5231
5245 DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters", 5232 DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters",
5246 enable_multibyte_characters, 5233 enable_multibyte_characters,
5247 doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it. 5234 doc: /* Default value of `enable-multibyte-characters' for buffers not overriding it.
5248This is the same as (default-value 'enable-multibyte-characters). */); 5235This is the same as (default-value 'enable-multibyte-characters). */);
5249 5236
5250 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system", 5237 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system",
@@ -5406,7 +5393,7 @@ A string is printed verbatim in the mode line except for %-constructs:
5406Decimal digits after the % specify field width to which to pad. */); 5393Decimal digits after the % specify field width to which to pad. */);
5407 5394
5408 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, 5395 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
5409 doc: /* *Value of `major-mode' for new buffers. */); 5396 doc: /* Value of `major-mode' for new buffers. */);
5410 5397
5411 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), 5398 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5412 make_number (Lisp_Symbol), 5399 make_number (Lisp_Symbol),
@@ -5437,25 +5424,25 @@ Use the command `abbrev-mode' to change this variable. */);
5437 5424
5438 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), 5425 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search),
5439 Qnil, 5426 Qnil,
5440 doc: /* *Non-nil if searches and matches should ignore case. */); 5427 doc: /* Non-nil if searches and matches should ignore case. */);
5441 5428
5442 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), 5429 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5443 make_number (LISP_INT_TAG), 5430 make_number (LISP_INT_TAG),
5444 doc: /* *Column beyond which automatic line-wrapping should happen. 5431 doc: /* Column beyond which automatic line-wrapping should happen.
5445Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5432Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5446 5433
5447 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), 5434 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5448 make_number (LISP_INT_TAG), 5435 make_number (LISP_INT_TAG),
5449 doc: /* *Column for the default `indent-line-function' to indent to. 5436 doc: /* Column for the default `indent-line-function' to indent to.
5450Linefeed indents to this column in Fundamental mode. */); 5437Linefeed indents to this column in Fundamental mode. */);
5451 5438
5452 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), 5439 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5453 make_number (LISP_INT_TAG), 5440 make_number (LISP_INT_TAG),
5454 doc: /* *Distance between tab stops (for display of tab characters), in columns. 5441 doc: /* Distance between tab stops (for display of tab characters), in columns.
5455This should be an integer greater than zero. */); 5442This should be an integer greater than zero. */);
5456 5443
5457 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, 5444 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
5458 doc: /* *Non-nil means display control chars with uparrow. 5445 doc: /* Non-nil means display control chars with uparrow.
5459A value of nil means use backslash and octal digits. 5446A value of nil means use backslash and octal digits.
5460This variable does not apply to characters whose display is specified 5447This variable does not apply to characters whose display is specified
5461in the current display table (if there is one). */); 5448in the current display table (if there is one). */);
@@ -5496,7 +5483,7 @@ This variable is never applied to a way of decoding a file while reading it. */
5496 5483
5497 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5484 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5498 &BVAR (current_buffer, bidi_paragraph_direction), Qnil, 5485 &BVAR (current_buffer, bidi_paragraph_direction), Qnil,
5499 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5486 doc: /* If non-nil, forces directionality of text paragraphs in the buffer.
5500 5487
5501If this is nil (the default), the direction of each paragraph is 5488If this is nil (the default), the direction of each paragraph is
5502determined by the first strong directional character of its text. 5489determined by the first strong directional character of its text.
@@ -5507,7 +5494,7 @@ This variable has no effect unless the buffer's value of
5507\`bidi-display-reordering' is non-nil. */); 5494\`bidi-display-reordering' is non-nil. */);
5508 5495
5509 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, 5496 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil,
5510 doc: /* *Non-nil means do not display continuation lines. 5497 doc: /* Non-nil means do not display continuation lines.
5511Instead, give each line of text just one screen line. 5498Instead, give each line of text just one screen line.
5512 5499
5513Note that this is overridden by the variable 5500Note that this is overridden by the variable
@@ -5517,7 +5504,7 @@ and this buffer is not full-frame width.
5517Minibuffers set this variable to nil. */); 5504Minibuffers set this variable to nil. */);
5518 5505
5519 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, 5506 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
5520 doc: /* *Non-nil means to use word-wrapping for continuation lines. 5507 doc: /* Non-nil means to use word-wrapping for continuation lines.
5521When word-wrapping is on, continuation lines are wrapped at the space 5508When word-wrapping is on, continuation lines are wrapped at the space
5522or tab character nearest to the right window edge. 5509or tab character nearest to the right window edge.
5523If nil, continuation lines are wrapped at the right screen edge. 5510If nil, continuation lines are wrapped at the right screen edge.
@@ -5638,39 +5625,39 @@ See also the functions `display-table-slot' and `set-display-table-slot'. */);
5638 5625
5639 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), 5626 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5640 Qnil, 5627 Qnil,
5641 doc: /* *Width of left marginal area for display of a buffer. 5628 doc: /* Width of left marginal area for display of a buffer.
5642A value of nil means no marginal area. */); 5629A value of nil means no marginal area. */);
5643 5630
5644 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), 5631 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5645 Qnil, 5632 Qnil,
5646 doc: /* *Width of right marginal area for display of a buffer. 5633 doc: /* Width of right marginal area for display of a buffer.
5647A value of nil means no marginal area. */); 5634A value of nil means no marginal area. */);
5648 5635
5649 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), 5636 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5650 Qnil, 5637 Qnil,
5651 doc: /* *Width of this buffer's left fringe (in pixels). 5638 doc: /* Width of this buffer's left fringe (in pixels).
5652A value of 0 means no left fringe is shown in this buffer's window. 5639A value of 0 means no left fringe is shown in this buffer's window.
5653A value of nil means to use the left fringe width from the window's frame. */); 5640A value of nil means to use the left fringe width from the window's frame. */);
5654 5641
5655 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), 5642 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5656 Qnil, 5643 Qnil,
5657 doc: /* *Width of this buffer's right fringe (in pixels). 5644 doc: /* Width of this buffer's right fringe (in pixels).
5658A value of 0 means no right fringe is shown in this buffer's window. 5645A value of 0 means no right fringe is shown in this buffer's window.
5659A value of nil means to use the right fringe width from the window's frame. */); 5646A value of nil means to use the right fringe width from the window's frame. */);
5660 5647
5661 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), 5648 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
5662 Qnil, 5649 Qnil,
5663 doc: /* *Non-nil means to display fringes outside display margins. 5650 doc: /* Non-nil means to display fringes outside display margins.
5664A value of nil means to display fringes between margins and buffer text. */); 5651A value of nil means to display fringes between margins and buffer text. */);
5665 5652
5666 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), 5653 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5667 Qnil, 5654 Qnil,
5668 doc: /* *Width of this buffer's scroll bars in pixels. 5655 doc: /* Width of this buffer's scroll bars in pixels.
5669A value of nil means to use the scroll bar width from the window's frame. */); 5656A value of nil means to use the scroll bar width from the window's frame. */);
5670 5657
5671 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), 5658 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5672 Qnil, 5659 Qnil,
5673 doc: /* *Position of this buffer's vertical scroll bar. 5660 doc: /* Position of this buffer's vertical scroll bar.
5674The value takes effect whenever you tell a window to display this buffer; 5661The value takes effect whenever you tell a window to display this buffer;
5675for instance, with `set-window-buffer' or when `display-buffer' displays it. 5662for instance, with `set-window-buffer' or when `display-buffer' displays it.
5676 5663
@@ -5680,13 +5667,13 @@ A value of t (the default) means do whatever the window's frame specifies. */);
5680 5667
5681 DEFVAR_PER_BUFFER ("indicate-empty-lines", 5668 DEFVAR_PER_BUFFER ("indicate-empty-lines",
5682 &BVAR (current_buffer, indicate_empty_lines), Qnil, 5669 &BVAR (current_buffer, indicate_empty_lines), Qnil,
5683 doc: /* *Visually indicate empty lines after the buffer end. 5670 doc: /* Visually indicate empty lines after the buffer end.
5684If non-nil, a bitmap is displayed in the left fringe of a window on 5671If non-nil, a bitmap is displayed in the left fringe of a window on
5685window-systems. */); 5672window-systems. */);
5686 5673
5687 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", 5674 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
5688 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, 5675 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
5689 doc: /* *Visually indicate buffer boundaries and scrolling. 5676 doc: /* Visually indicate buffer boundaries and scrolling.
5690If non-nil, the first and last line of the buffer are marked in the fringe 5677If non-nil, the first and last line of the buffer are marked in the fringe
5691of a window on window-systems with angle bitmaps, or if the window can be 5678of a window on window-systems with angle bitmaps, or if the window can be
5692scrolled, the top and bottom line of the window are marked with up and down 5679scrolled, the top and bottom line of the window are marked with up and down
@@ -5711,7 +5698,7 @@ fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5711 5698
5712 DEFVAR_PER_BUFFER ("fringe-indicator-alist", 5699 DEFVAR_PER_BUFFER ("fringe-indicator-alist",
5713 &BVAR (current_buffer, fringe_indicator_alist), Qnil, 5700 &BVAR (current_buffer, fringe_indicator_alist), Qnil,
5714 doc: /* *Mapping from logical to physical fringe indicator bitmaps. 5701 doc: /* Mapping from logical to physical fringe indicator bitmaps.
5715The value is an alist where each element (INDICATOR . BITMAPS) 5702The value is an alist where each element (INDICATOR . BITMAPS)
5716specifies the fringe bitmaps used to display a specific logical 5703specifies the fringe bitmaps used to display a specific logical
5717fringe indicator. 5704fringe indicator.
@@ -5730,7 +5717,7 @@ symbol which is used in both left and right fringes. */);
5730 5717
5731 DEFVAR_PER_BUFFER ("fringe-cursor-alist", 5718 DEFVAR_PER_BUFFER ("fringe-cursor-alist",
5732 &BVAR (current_buffer, fringe_cursor_alist), Qnil, 5719 &BVAR (current_buffer, fringe_cursor_alist), Qnil,
5733 doc: /* *Mapping from logical to physical fringe cursor bitmaps. 5720 doc: /* Mapping from logical to physical fringe cursor bitmaps.
5734The value is an alist where each element (CURSOR . BITMAP) 5721The value is an alist where each element (CURSOR . BITMAP)
5735specifies the fringe bitmaps used to display a specific logical 5722specifies the fringe bitmaps used to display a specific logical
5736cursor type in the fringe. 5723cursor type in the fringe.
@@ -5894,7 +5881,7 @@ set when a file is visited. */);
5894 5881
5895 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", 5882 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
5896 &BVAR (current_buffer, auto_save_file_format), Qnil, 5883 &BVAR (current_buffer, auto_save_file_format), Qnil,
5897 doc: /* *Format in which to write auto-save files. 5884 doc: /* Format in which to write auto-save files.
5898Should be a list of symbols naming formats that are defined in `format-alist'. 5885Should be a list of symbols naming formats that are defined in `format-alist'.
5899If it is t, which is the default, auto-save files are written in the 5886If it is t, which is the default, auto-save files are written in the
5900same format as a regular save would use. */); 5887same format as a regular save would use. */);
@@ -5944,7 +5931,7 @@ Lisp programs may give this variable certain special values:
5944 Vtransient_mark_mode = Qnil; 5931 Vtransient_mark_mode = Qnil;
5945 5932
5946 DEFVAR_LISP ("inhibit-read-only", Vinhibit_read_only, 5933 DEFVAR_LISP ("inhibit-read-only", Vinhibit_read_only,
5947 doc: /* *Non-nil means disregard read-only status of buffers or characters. 5934 doc: /* Non-nil means disregard read-only status of buffers or characters.
5948If the value is t, disregard `buffer-read-only' and all `read-only' 5935If the value is t, disregard `buffer-read-only' and all `read-only'
5949text properties. If the value is a list, disregard `buffer-read-only' 5936text properties. If the value is a list, disregard `buffer-read-only'
5950and disregard a `read-only' text property if the property value 5937and disregard a `read-only' text property if the property value
@@ -5979,7 +5966,7 @@ to the default frame line height. A value of nil means add no extra space. */)
5979 5966
5980 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 5967 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
5981 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, 5968 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
5982 doc: /* *Non-nil means show a cursor in non-selected windows. 5969 doc: /* Non-nil means show a cursor in non-selected windows.
5983If nil, only shows a cursor in the selected window. 5970If nil, only shows a cursor in the selected window.
5984If t, displays a cursor related to the usual cursor type 5971If t, displays a cursor related to the usual cursor type
5985\(a solid box becomes hollow, a bar becomes a narrower bar). 5972\(a solid box becomes hollow, a bar becomes a narrower bar).
diff --git a/src/buffer.h b/src/buffer.h
index 3df4a95cf93..1635a847839 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -343,7 +343,8 @@ while (0)
343 - (ptr - (current_buffer)->text->beg <= GPT_BYTE - BEG_BYTE ? 0 : GAP_SIZE) \ 343 - (ptr - (current_buffer)->text->beg <= GPT_BYTE - BEG_BYTE ? 0 : GAP_SIZE) \
344 + BEG_BYTE) 344 + BEG_BYTE)
345 345
346/* Return character at byte position POS. */ 346/* Return character at byte position POS. See the caveat WARNING for
347 FETCH_MULTIBYTE_CHAR below. */
347 348
348#define FETCH_CHAR(pos) \ 349#define FETCH_CHAR(pos) \
349 (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \ 350 (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \
@@ -359,7 +360,17 @@ extern unsigned char *_fetch_multibyte_char_p;
359 360
360/* Return character code of multi-byte form at byte position POS. If POS 361/* Return character code of multi-byte form at byte position POS. If POS
361 doesn't point the head of valid multi-byte form, only the byte at 362 doesn't point the head of valid multi-byte form, only the byte at
362 POS is returned. No range checking. */ 363 POS is returned. No range checking.
364
365 WARNING: The character returned by this macro could be "unified"
366 inside STRING_CHAR, if the original character in the buffer belongs
367 to one of the Private Use Areas (PUAs) of codepoints that Emacs
368 uses to support non-unified CJK characters. If that happens,
369 CHAR_BYTES will return a value that is different from the length of
370 the original multibyte sequence stored in the buffer. Therefore,
371 do _not_ use FETCH_MULTIBYTE_CHAR if you need to advance through
372 the buffer to the next character after fetching this one. Instead,
373 use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */
363 374
364#define FETCH_MULTIBYTE_CHAR(pos) \ 375#define FETCH_MULTIBYTE_CHAR(pos) \
365 (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) \ 376 (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) \
diff --git a/src/callint.c b/src/callint.c
index e09210f1bb6..c70082e8ae0 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -97,7 +97,7 @@ r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.
97s -- Any string. Does not inherit the current input method. 97s -- Any string. Does not inherit the current input method.
98S -- Any symbol. 98S -- Any symbol.
99U -- Mouse up event discarded by a previous k or K argument. 99U -- Mouse up event discarded by a previous k or K argument.
100v -- Variable name: symbol that is user-variable-p. 100v -- Variable name: symbol that is `custom-variable-p'.
101x -- Lisp expression read but not evaluated. 101x -- Lisp expression read but not evaluated.
102X -- Lisp expression read and evaluated. 102X -- Lisp expression read and evaluated.
103z -- Coding system. 103z -- Coding system.
@@ -748,7 +748,7 @@ invoke it. If KEYS is omitted or nil, the return value of
748 break; 748 break;
749 749
750 case 'v': /* Variable name: symbol that is 750 case 'v': /* Variable name: symbol that is
751 user-variable-p. */ 751 custom-variable-p. */
752 args[i] = Fread_variable (callint_message, Qnil); 752 args[i] = Fread_variable (callint_message, Qnil);
753 visargs[i] = last_minibuf_string; 753 visargs[i] = last_minibuf_string;
754 break; 754 break;
@@ -945,7 +945,7 @@ may be set by the debugger as a reminder for itself. */);
945 Vcommand_debug_status = Qnil; 945 Vcommand_debug_status = Qnil;
946 946
947 DEFVAR_LISP ("mark-even-if-inactive", Vmark_even_if_inactive, 947 DEFVAR_LISP ("mark-even-if-inactive", Vmark_even_if_inactive,
948 doc: /* *Non-nil means you can use the mark even when inactive. 948 doc: /* Non-nil means you can use the mark even when inactive.
949This option makes a difference in Transient Mark mode. 949This option makes a difference in Transient Mark mode.
950When the option is non-nil, deactivation of the mark 950When the option is non-nil, deactivation of the mark
951turns off region highlighting, but commands that use the mark 951turns off region highlighting, but commands that use the mark
diff --git a/src/callproc.c b/src/callproc.c
index b5b8cadeb68..9528c9644d8 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1637,16 +1637,16 @@ syms_of_callproc (void)
1637 staticpro (&Vtemp_file_name_pattern); 1637 staticpro (&Vtemp_file_name_pattern);
1638 1638
1639 DEFVAR_LISP ("shell-file-name", Vshell_file_name, 1639 DEFVAR_LISP ("shell-file-name", Vshell_file_name,
1640 doc: /* *File name to load inferior shells from. 1640 doc: /* File name to load inferior shells from.
1641Initialized from the SHELL environment variable, or to a system-dependent 1641Initialized from the SHELL environment variable, or to a system-dependent
1642default if SHELL is not set. */); 1642default if SHELL is not set. */);
1643 1643
1644 DEFVAR_LISP ("exec-path", Vexec_path, 1644 DEFVAR_LISP ("exec-path", Vexec_path,
1645 doc: /* *List of directories to search programs to run in subprocesses. 1645 doc: /* List of directories to search programs to run in subprocesses.
1646Each element is a string (directory name) or nil (try default directory). */); 1646Each element is a string (directory name) or nil (try default directory). */);
1647 1647
1648 DEFVAR_LISP ("exec-suffixes", Vexec_suffixes, 1648 DEFVAR_LISP ("exec-suffixes", Vexec_suffixes,
1649 doc: /* *List of suffixes to try to find executable file names. 1649 doc: /* List of suffixes to try to find executable file names.
1650Each element is a string. */); 1650Each element is a string. */);
1651 Vexec_suffixes = Qnil; 1651 Vexec_suffixes = Qnil;
1652 1652
diff --git a/src/character.h b/src/character.h
index 5ae6cb8c49c..a829def428d 100644
--- a/src/character.h
+++ b/src/character.h
@@ -292,7 +292,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
292 } while (0) 292 } while (0)
293 293
294/* Return the character code of character whose multibyte form is at 294/* Return the character code of character whose multibyte form is at
295 P. */ 295 P. Note that this macro unifies CJK characters whose codepoints
296 are in the Private Use Areas (PUAs), so it might return a different
297 codepoint from the one actually stored at P. */
296 298
297#define STRING_CHAR(p) \ 299#define STRING_CHAR(p) \
298 (!((p)[0] & 0x80) \ 300 (!((p)[0] & 0x80) \
@@ -309,7 +311,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
309 311
310 312
311/* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte 313/* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte
312 form. */ 314 form.
315
316 Note: This macro returns the actual length of the character's
317 multibyte sequence as it is stored in a buffer or string. The
318 character it returns might have a different codepoint that has a
319 different multibyte sequence of a different legth, due to possible
320 unification of CJK characters inside string_char. Therefore do NOT
321 assume that the length returned by this macro is identical to the
322 length of the multibyte sequence of the character it returns. */
313 323
314#define STRING_CHAR_AND_LENGTH(p, actual_len) \ 324#define STRING_CHAR_AND_LENGTH(p, actual_len) \
315 (!((p)[0] & 0x80) \ 325 (!((p)[0] & 0x80) \
diff --git a/src/charset.c b/src/charset.c
index 57e1603fc19..7b963a94800 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -2403,7 +2403,7 @@ syms_of_charset (void)
2403 defsubr (&Ssort_charsets); 2403 defsubr (&Ssort_charsets);
2404 2404
2405 DEFVAR_LISP ("charset-map-path", Vcharset_map_path, 2405 DEFVAR_LISP ("charset-map-path", Vcharset_map_path,
2406 doc: /* *List of directories to search for charset map files. */); 2406 doc: /* List of directories to search for charset map files. */);
2407 Vcharset_map_path = Qnil; 2407 Vcharset_map_path = Qnil;
2408 2408
2409 DEFVAR_BOOL ("inhibit-load-charset-map", inhibit_load_charset_map, 2409 DEFVAR_BOOL ("inhibit-load-charset-map", inhibit_load_charset_map,
diff --git a/src/composite.c b/src/composite.c
index c44c8e565d0..abf71c275fa 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -355,7 +355,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
355 else 355 else
356 { 356 {
357 /* Rule-base composition. */ 357 /* Rule-base composition. */
358 float leftmost = 0.0, rightmost; 358 double leftmost = 0.0, rightmost;
359 359
360 ch = XINT (key_contents[0]); 360 ch = XINT (key_contents[0]);
361 rightmost = ch != '\t' ? CHAR_WIDTH (ch) : 1; 361 rightmost = ch != '\t' ? CHAR_WIDTH (ch) : 1;
@@ -364,7 +364,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
364 { 364 {
365 int rule, gref, nref; 365 int rule, gref, nref;
366 int this_width; 366 int this_width;
367 float this_left; 367 double this_left;
368 368
369 rule = XINT (key_contents[i]); 369 rule = XINT (key_contents[i]);
370 ch = XINT (key_contents[i + 1]); 370 ch = XINT (key_contents[i + 1]);
diff --git a/src/doc.c b/src/doc.c
index 02db4dde072..9e48a4d49f3 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,6 @@
1/* Record indices of function doc strings stored in a file. 1/* Record indices of function doc strings stored in a file.
2 Copyright (C) 1985-1986, 1993-1995, 1997-2012 2
3 Free Software Foundation, Inc. 3Copyright (C) 1985-1986, 1993-1995, 1997-2012 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -671,15 +671,18 @@ the same file name is found in the `doc-directory'. */)
671 /* Install file-position as variable-documentation property 671 /* Install file-position as variable-documentation property
672 and make it negative for a user-variable 672 and make it negative for a user-variable
673 (doc starts with a `*'). */ 673 (doc starts with a `*'). */
674 Fput (sym, Qvariable_documentation, 674 if (!NILP (Fboundp (sym)))
675 make_number ((pos + end + 1 - buf) 675 Fput (sym, Qvariable_documentation,
676 * (end[1] == '*' ? -1 : 1))); 676 make_number ((pos + end + 1 - buf)
677 * (end[1] == '*' ? -1 : 1)));
677 } 678 }
678 679
679 /* Attach a docstring to a function? */ 680 /* Attach a docstring to a function? */
680 else if (p[1] == 'F') 681 else if (p[1] == 'F')
681 store_function_docstring (sym, pos + end + 1 - buf); 682 {
682 683 if (!NILP (Ffboundp (sym)))
684 store_function_docstring (sym, pos + end + 1 - buf);
685 }
683 else if (p[1] == 'S') 686 else if (p[1] == 'S')
684 ; /* Just a source file name boundary marker. Ignore it. */ 687 ; /* Just a source file name boundary marker. Ignore it. */
685 688
diff --git a/src/dosfns.c b/src/dosfns.c
index 8ef672fb8bb..d4b96e9df90 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -710,7 +710,7 @@ Implicitly modified when the TZ variable is changed. */);
710#endif 710#endif
711 711
712 DEFVAR_LISP ("dos-display-scancodes", Vdos_display_scancodes, 712 DEFVAR_LISP ("dos-display-scancodes", Vdos_display_scancodes,
713 doc: /* *Controls whether DOS raw keyboard events are displayed as you type. 713 doc: /* Whether DOS raw keyboard events are displayed as you type.
714When non-nil, the keyboard scan-codes are displayed at the bottom right 714When non-nil, the keyboard scan-codes are displayed at the bottom right
715corner of the display (typically at the end of the mode line). 715corner of the display (typically at the end of the mode line).
716The output format is: scan code:char code*modifiers. */); 716The output format is: scan code:char code*modifiers. */);
@@ -718,17 +718,17 @@ The output format is: scan code:char code*modifiers. */);
718 Vdos_display_scancodes = Qnil; 718 Vdos_display_scancodes = Qnil;
719 719
720 DEFVAR_INT ("dos-hyper-key", dos_hyper_key, 720 DEFVAR_INT ("dos-hyper-key", dos_hyper_key,
721 doc: /* *If set to 1, use right ALT key as hyper key. 721 doc: /* If set to 1, use right ALT key as hyper key.
722If set to 2, use right CTRL key as hyper key. */); 722If set to 2, use right CTRL key as hyper key. */);
723 dos_hyper_key = 0; 723 dos_hyper_key = 0;
724 724
725 DEFVAR_INT ("dos-super-key", dos_super_key, 725 DEFVAR_INT ("dos-super-key", dos_super_key,
726 doc: /* *If set to 1, use right ALT key as super key. 726 doc: /* If set to 1, use right ALT key as super key.
727If set to 2, use right CTRL key as super key. */); 727If set to 2, use right CTRL key as super key. */);
728 dos_super_key = 0; 728 dos_super_key = 0;
729 729
730 DEFVAR_INT ("dos-keypad-mode", dos_keypad_mode, 730 DEFVAR_INT ("dos-keypad-mode", dos_keypad_mode,
731 doc: /* *Controls what key code is returned by a key in the numeric keypad. 731 doc: /* Controls what key code is returned by a key in the numeric keypad.
732The `numlock ON' action is only taken if no modifier keys are pressed. 732The `numlock ON' action is only taken if no modifier keys are pressed.
733The value is an integer constructed by adding the following bits together: 733The value is an integer constructed by adding the following bits together:
734 734
diff --git a/src/emacs.c b/src/emacs.c
index 3a6620a3777..73be96f73bc 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -85,10 +85,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
85#include <sys/personality.h> 85#include <sys/personality.h>
86#endif 86#endif
87 87
88#ifdef HAVE_LIBXML2
89#include <libxml/parser.h>
90#endif
91
92#ifndef O_RDWR 88#ifndef O_RDWR
93#define O_RDWR 2 89#define O_RDWR 2
94#endif 90#endif
@@ -2130,7 +2126,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
2130#endif 2126#endif
2131 2127
2132#ifdef HAVE_LIBXML2 2128#ifdef HAVE_LIBXML2
2133 xmlCleanupParser (); 2129 xml_cleanup_parser ();
2134#endif 2130#endif
2135} 2131}
2136 2132
diff --git a/src/eval.c b/src/eval.c
index 4a3f5083b3b..cb0518f34ec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -808,8 +808,6 @@ The optional argument DOCSTRING is a documentation string for the
808variable. 808variable.
809 809
810To define a user option, use `defcustom' instead of `defvar'. 810To define a user option, use `defcustom' instead of `defvar'.
811The function `user-variable-p' also identifies a variable as a user
812option if its DOCSTRING starts with *, but this behavior is obsolete.
813usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 811usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
814 (Lisp_Object args) 812 (Lisp_Object args)
815{ 813{
@@ -923,71 +921,6 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
923 return sym; 921 return sym;
924} 922}
925 923
926/* Error handler used in Fuser_variable_p. */
927static Lisp_Object
928user_variable_p_eh (Lisp_Object ignore)
929{
930 return Qnil;
931}
932
933static Lisp_Object
934lisp_indirect_variable (Lisp_Object sym)
935{
936 struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
937 XSETSYMBOL (sym, s);
938 return sym;
939}
940
941DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
942 doc: /* Return t if VARIABLE is intended to be set and modified by users.
943\(The alternative is a variable used internally in a Lisp program.)
944
945This function returns t if (i) the first character of its
946documentation is `*', or (ii) it is customizable (its property list
947contains a non-nil value of `standard-value' or `custom-autoload'), or
948\(iii) it is an alias for a user variable.
949
950But condition (i) is considered obsolete, so for most purposes this is
951equivalent to `custom-variable-p'. */)
952 (Lisp_Object variable)
953{
954 Lisp_Object documentation;
955
956 if (!SYMBOLP (variable))
957 return Qnil;
958
959 /* If indirect and there's an alias loop, don't check anything else. */
960 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
961 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
962 Qt, user_variable_p_eh)))
963 return Qnil;
964
965 while (1)
966 {
967 documentation = Fget (variable, Qvariable_documentation);
968 if (INTEGERP (documentation) && XINT (documentation) < 0)
969 return Qt;
970 if (STRINGP (documentation)
971 && ((unsigned char) SREF (documentation, 0) == '*'))
972 return Qt;
973 /* If it is (STRING . INTEGER), a negative integer means a user variable. */
974 if (CONSP (documentation)
975 && STRINGP (XCAR (documentation))
976 && INTEGERP (XCDR (documentation))
977 && XINT (XCDR (documentation)) < 0)
978 return Qt;
979 /* Customizable? See `custom-variable-p'. */
980 if ((!NILP (Fget (variable, intern ("standard-value"))))
981 || (!NILP (Fget (variable, intern ("custom-autoload")))))
982 return Qt;
983
984 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
985 return Qnil;
986
987 /* An indirect variable? Let's follow the chain. */
988 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
989 }
990}
991 924
992DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 925DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
993 doc: /* Bind variables according to VARLIST then eval BODY. 926 doc: /* Bind variables according to VARLIST then eval BODY.
@@ -3630,7 +3563,7 @@ void
3630syms_of_eval (void) 3563syms_of_eval (void)
3631{ 3564{
3632 DEFVAR_INT ("max-specpdl-size", max_specpdl_size, 3565 DEFVAR_INT ("max-specpdl-size", max_specpdl_size,
3633 doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's. 3566 doc: /* Limit on number of Lisp variable bindings and `unwind-protect's.
3634If Lisp code tries to increase the total number past this amount, 3567If Lisp code tries to increase the total number past this amount,
3635an error is signaled. 3568an error is signaled.
3636You can safely use a value considerably larger than the default value, 3569You can safely use a value considerably larger than the default value,
@@ -3638,7 +3571,7 @@ if that proves inconveniently small. However, if you increase it too far,
3638Emacs could run out of memory trying to make the stack bigger. */); 3571Emacs could run out of memory trying to make the stack bigger. */);
3639 3572
3640 DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, 3573 DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth,
3641 doc: /* *Limit on depth in `eval', `apply' and `funcall' before error. 3574 doc: /* Limit on depth in `eval', `apply' and `funcall' before error.
3642 3575
3643This limit serves to catch infinite recursions for you before they cause 3576This limit serves to catch infinite recursions for you before they cause
3644actual stack overflow in C, which would be fatal for Emacs. 3577actual stack overflow in C, which would be fatal for Emacs.
@@ -3682,7 +3615,7 @@ before making `inhibit-quit' nil. */);
3682 DEFSYM (Qdebug, "debug"); 3615 DEFSYM (Qdebug, "debug");
3683 3616
3684 DEFVAR_LISP ("debug-on-error", Vdebug_on_error, 3617 DEFVAR_LISP ("debug-on-error", Vdebug_on_error,
3685 doc: /* *Non-nil means enter debugger if an error is signaled. 3618 doc: /* Non-nil means enter debugger if an error is signaled.
3686Does not apply to errors handled by `condition-case' or those 3619Does not apply to errors handled by `condition-case' or those
3687matched by `debug-ignored-errors'. 3620matched by `debug-ignored-errors'.
3688If the value is a list, an error only means to enter the debugger 3621If the value is a list, an error only means to enter the debugger
@@ -3694,7 +3627,7 @@ See also the variable `debug-on-quit'. */);
3694 Vdebug_on_error = Qnil; 3627 Vdebug_on_error = Qnil;
3695 3628
3696 DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, 3629 DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors,
3697 doc: /* *List of errors for which the debugger should not be called. 3630 doc: /* List of errors for which the debugger should not be called.
3698Each element may be a condition-name or a regexp that matches error messages. 3631Each element may be a condition-name or a regexp that matches error messages.
3699If any element applies to a given error, that error skips the debugger 3632If any element applies to a given error, that error skips the debugger
3700and just returns to top level. 3633and just returns to top level.
@@ -3703,7 +3636,7 @@ It does not apply to errors handled by `condition-case'. */);
3703 Vdebug_ignored_errors = Qnil; 3636 Vdebug_ignored_errors = Qnil;
3704 3637
3705 DEFVAR_BOOL ("debug-on-quit", debug_on_quit, 3638 DEFVAR_BOOL ("debug-on-quit", debug_on_quit,
3706 doc: /* *Non-nil means enter debugger if quit is signaled (C-g, for example). 3639 doc: /* Non-nil means enter debugger if quit is signaled (C-g, for example).
3707Does not apply if quit is handled by a `condition-case'. */); 3640Does not apply if quit is handled by a `condition-case'. */);
3708 debug_on_quit = 0; 3641 debug_on_quit = 0;
3709 3642
@@ -3732,7 +3665,7 @@ The Edebug package uses this to regain control. */);
3732 Vsignal_hook_function = Qnil; 3665 Vsignal_hook_function = Qnil;
3733 3666
3734 DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal, 3667 DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal,
3735 doc: /* *Non-nil means call the debugger regardless of condition handlers. 3668 doc: /* Non-nil means call the debugger regardless of condition handlers.
3736Note that `debug-on-error', `debug-on-quit' and friends 3669Note that `debug-on-error', `debug-on-quit' and friends
3737still determine whether to handle the particular condition. */); 3670still determine whether to handle the particular condition. */);
3738 Vdebug_on_signal = Qnil; 3671 Vdebug_on_signal = Qnil;
@@ -3789,7 +3722,6 @@ alist of active lexical bindings. */);
3789 defsubr (&Sdefvar); 3722 defsubr (&Sdefvar);
3790 defsubr (&Sdefvaralias); 3723 defsubr (&Sdefvaralias);
3791 defsubr (&Sdefconst); 3724 defsubr (&Sdefconst);
3792 defsubr (&Suser_variable_p);
3793 defsubr (&Slet); 3725 defsubr (&Slet);
3794 defsubr (&SletX); 3726 defsubr (&SletX);
3795 defsubr (&Swhile); 3727 defsubr (&Swhile);
diff --git a/src/fileio.c b/src/fileio.c
index 7efe919a9f0..3a74672b9a6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5611,7 +5611,7 @@ syms_of_fileio (void)
5611 DEFSYM (Qexcl, "excl"); 5611 DEFSYM (Qexcl, "excl");
5612 5612
5613 DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system, 5613 DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system,
5614 doc: /* *Coding system for encoding file names. 5614 doc: /* Coding system for encoding file names.
5615If it is nil, `default-file-name-coding-system' (which see) is used. */); 5615If it is nil, `default-file-name-coding-system' (which see) is used. */);
5616 Vfile_name_coding_system = Qnil; 5616 Vfile_name_coding_system = Qnil;
5617 5617
@@ -5765,7 +5765,7 @@ file is usually more useful if it contains the deleted text. */);
5765 5765
5766#ifdef HAVE_FSYNC 5766#ifdef HAVE_FSYNC
5767 DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync, 5767 DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync,
5768 doc: /* *Non-nil means don't call fsync in `write-region'. 5768 doc: /* Non-nil means don't call fsync in `write-region'.
5769This variable affects calls to `write-region' as well as save commands. 5769This variable affects calls to `write-region' as well as save commands.
5770A non-nil value may result in data loss! */); 5770A non-nil value may result in data loss! */);
5771 write_region_inhibit_fsync = 0; 5771 write_region_inhibit_fsync = 0;
diff --git a/src/fns.c b/src/fns.c
index 1edfe966098..a92a1c882fd 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4933,7 +4933,7 @@ Used by `featurep' and `require', and altered by `provide'. */);
4933#endif /* HAVE_LANGINFO_CODESET */ 4933#endif /* HAVE_LANGINFO_CODESET */
4934 4934
4935 DEFVAR_BOOL ("use-dialog-box", use_dialog_box, 4935 DEFVAR_BOOL ("use-dialog-box", use_dialog_box,
4936 doc: /* *Non-nil means mouse commands use dialog boxes to ask questions. 4936 doc: /* Non-nil means mouse commands use dialog boxes to ask questions.
4937This applies to `y-or-n-p' and `yes-or-no-p' questions asked by commands 4937This applies to `y-or-n-p' and `yes-or-no-p' questions asked by commands
4938invoked by mouse clicks and mouse menu items. 4938invoked by mouse clicks and mouse menu items.
4939 4939
@@ -4942,7 +4942,7 @@ non-nil. */);
4942 use_dialog_box = 1; 4942 use_dialog_box = 1;
4943 4943
4944 DEFVAR_BOOL ("use-file-dialog", use_file_dialog, 4944 DEFVAR_BOOL ("use-file-dialog", use_file_dialog,
4945 doc: /* *Non-nil means mouse commands use a file dialog to ask for files. 4945 doc: /* Non-nil means mouse commands use a file dialog to ask for files.
4946This applies to commands from menus and tool bar buttons even when 4946This applies to commands from menus and tool bar buttons even when
4947they are initiated from the keyboard. If `use-dialog-box' is nil, 4947they are initiated from the keyboard. If `use-dialog-box' is nil,
4948that disables the use of a file dialog, regardless of the value of 4948that disables the use of a file dialog, regardless of the value of
diff --git a/src/fontset.c b/src/fontset.c
index d06491ddf25..8a61f09f590 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -2227,7 +2227,7 @@ alternate fontnames (if any) are tried instead. */);
2227 2227
2228 DEFVAR_LISP ("vertical-centering-font-regexp", 2228 DEFVAR_LISP ("vertical-centering-font-regexp",
2229 Vvertical_centering_font_regexp, 2229 Vvertical_centering_font_regexp,
2230 doc: /* *Regexp matching font names that require vertical centering on display. 2230 doc: /* Regexp matching font names that require vertical centering on display.
2231When a character is displayed with such fonts, the character is displayed 2231When a character is displayed with such fonts, the character is displayed
2232at the vertical center of lines. */); 2232at the vertical center of lines. */);
2233 Vvertical_centering_font_regexp = Qnil; 2233 Vvertical_centering_font_regexp = Qnil;
diff --git a/src/fringe.c b/src/fringe.c
index 5285d09dfb0..62c50e0d420 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1754,7 +1754,7 @@ syms_of_fringe (void)
1754 defsubr (&Sset_fringe_bitmap_face); 1754 defsubr (&Sset_fringe_bitmap_face);
1755 1755
1756 DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe, 1756 DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe,
1757 doc: /* *Non-nil means that newline may flow into the right fringe. 1757 doc: /* Non-nil means that newline may flow into the right fringe.
1758This means that display lines which are exactly as wide as the window 1758This means that display lines which are exactly as wide as the window
1759(not counting the final newline) will only occupy one screen line, by 1759(not counting the final newline) will only occupy one screen line, by
1760showing (or hiding) the final newline in the right fringe; when point 1760showing (or hiding) the final newline in the right fringe; when point
diff --git a/src/gnutls.c b/src/gnutls.c
index 6b5cb47001b..70eea3b0b89 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -247,18 +247,27 @@ init_gnutls_functions (Lisp_Object libraries)
247#endif /* !WINDOWSNT */ 247#endif /* !WINDOWSNT */
248 248
249 249
250/* Function to log a simple message. */
250static void 251static void
251gnutls_log_function (int level, const char* string) 252gnutls_log_function (int level, const char* string)
252{ 253{
253 message ("gnutls.c: [%d] %s", level, string); 254 message ("gnutls.c: [%d] %s", level, string);
254} 255}
255 256
257/* Function to log a message and a string. */
256static void 258static void
257gnutls_log_function2 (int level, const char* string, const char* extra) 259gnutls_log_function2 (int level, const char* string, const char* extra)
258{ 260{
259 message ("gnutls.c: [%d] %s %s", level, string, extra); 261 message ("gnutls.c: [%d] %s %s", level, string, extra);
260} 262}
261 263
264/* Function to log a message and an integer. */
265static void
266gnutls_log_function2i (int level, const char* string, int extra)
267{
268 message ("gnutls.c: [%d] %s %d", level, string, extra);
269}
270
262static int 271static int
263emacs_gnutls_handshake (struct Lisp_Process *proc) 272emacs_gnutls_handshake (struct Lisp_Process *proc)
264{ 273{
@@ -399,10 +408,25 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte)
399 ssize_t rtnval; 408 ssize_t rtnval;
400 gnutls_session_t state = proc->gnutls_state; 409 gnutls_session_t state = proc->gnutls_state;
401 410
411 int log_level = proc->gnutls_log_level;
412
402 if (proc->gnutls_initstage != GNUTLS_STAGE_READY) 413 if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
403 { 414 {
404 emacs_gnutls_handshake (proc); 415 /* If the handshake count is under the limit, try the handshake
405 return -1; 416 again and increment the handshake count. This count is kept
417 per process (connection), not globally. */
418 if (proc->gnutls_handshakes_tried < GNUTLS_EMACS_HANDSHAKES_LIMIT)
419 {
420 proc->gnutls_handshakes_tried++;
421 emacs_gnutls_handshake (proc);
422 GNUTLS_LOG2i (5, log_level, "Retried handshake",
423 proc->gnutls_handshakes_tried);
424 return -1;
425 }
426
427 GNUTLS_LOG (2, log_level, "Giving up on handshake; resetting retries");
428 proc->gnutls_handshakes_tried = 0;
429 return 0;
406 } 430 }
407 rtnval = fn_gnutls_record_recv (state, buf, nbyte); 431 rtnval = fn_gnutls_record_recv (state, buf, nbyte);
408 if (rtnval >= 0) 432 if (rtnval >= 0)
diff --git a/src/gnutls.h b/src/gnutls.h
index 474da77aec5..37b9a2eb4df 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -23,6 +23,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <gnutls/gnutls.h> 23#include <gnutls/gnutls.h>
24#include <gnutls/x509.h> 24#include <gnutls/x509.h>
25 25
26/* This limits the attempts to handshake per process (connection). */
27#define GNUTLS_EMACS_HANDSHAKES_LIMIT 100
28
26typedef enum 29typedef enum
27{ 30{
28 /* Initialization stages. */ 31 /* Initialization stages. */
@@ -53,6 +56,8 @@ typedef enum
53 56
54#define GNUTLS_LOG2(level, max, string, extra) do { if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } } while (0) 57#define GNUTLS_LOG2(level, max, string, extra) do { if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } } while (0)
55 58
59#define GNUTLS_LOG2i(level, max, string, extra) do { if (level <= max) { gnutls_log_function2i (level, "(Emacs) " string, extra); } } while (0)
60
56extern EMACS_INT 61extern EMACS_INT
57emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte); 62emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte);
58extern EMACS_INT 63extern EMACS_INT
diff --git a/src/indent.c b/src/indent.c
index a1fcd2b1018..1531d2ffde8 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2021,6 +2021,7 @@ whether or not it is currently displayed in some window. */)
2021 EMACS_INT it_start; 2021 EMACS_INT it_start;
2022 int first_x, it_overshoot_count = 0; 2022 int first_x, it_overshoot_count = 0;
2023 int overshoot_handled = 0; 2023 int overshoot_handled = 0;
2024 int disp_string_at_start_p = 0;
2024 2025
2025 itdata = bidi_shelve_cache (); 2026 itdata = bidi_shelve_cache ();
2026 SET_TEXT_POS (pt, PT, PT_BYTE); 2027 SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -2035,6 +2036,8 @@ whether or not it is currently displayed in some window. */)
2035 { 2036 {
2036 const char *s = SSDATA (it.string); 2037 const char *s = SSDATA (it.string);
2037 const char *e = s + SBYTES (it.string); 2038 const char *e = s + SBYTES (it.string);
2039
2040 disp_string_at_start_p = it.string_from_display_prop_p;
2038 while (s < e) 2041 while (s < e)
2039 { 2042 {
2040 if (*s++ == '\n') 2043 if (*s++ == '\n')
@@ -2062,7 +2065,8 @@ whether or not it is currently displayed in some window. */)
2062 /* IT may move too far if truncate-lines is on and PT lies 2065 /* IT may move too far if truncate-lines is on and PT lies
2063 beyond the right margin. IT may also move too far if the 2066 beyond the right margin. IT may also move too far if the
2064 starting point is on a Lisp string that has embedded 2067 starting point is on a Lisp string that has embedded
2065 newlines. In these cases, backtrack. */ 2068 newlines, or spans several screen lines. In these cases,
2069 backtrack. */
2066 if (IT_CHARPOS (it) > it_start) 2070 if (IT_CHARPOS (it) > it_start)
2067 { 2071 {
2068 /* We need to backtrack also if the Lisp string contains no 2072 /* We need to backtrack also if the Lisp string contains no
@@ -2073,6 +2077,14 @@ whether or not it is currently displayed in some window. */)
2073 && it.method == GET_FROM_BUFFER 2077 && it.method == GET_FROM_BUFFER
2074 && it.c == '\n') 2078 && it.c == '\n')
2075 it_overshoot_count = 1; 2079 it_overshoot_count = 1;
2080 else if (disp_string_at_start_p && it.vpos > 0)
2081 {
2082 /* This is the case of a display string that spans
2083 several screen lines. In that case, we end up at the
2084 end of the string, and it.vpos tells us how many
2085 screen lines we need to backtrack. */
2086 it_overshoot_count = it.vpos;
2087 }
2076 if (it_overshoot_count > 0) 2088 if (it_overshoot_count > 0)
2077 move_it_by_lines (&it, -it_overshoot_count); 2089 move_it_by_lines (&it, -it_overshoot_count);
2078 2090
@@ -2151,7 +2163,7 @@ void
2151syms_of_indent (void) 2163syms_of_indent (void)
2152{ 2164{
2153 DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode, 2165 DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode,
2154 doc: /* *Indentation can insert tabs if this is non-nil. */); 2166 doc: /* Indentation can insert tabs if this is non-nil. */);
2155 indent_tabs_mode = 1; 2167 indent_tabs_mode = 1;
2156 2168
2157 defsubr (&Scurrent_indentation); 2169 defsubr (&Scurrent_indentation);
diff --git a/src/keyboard.c b/src/keyboard.c
index 359e6cd692e..66d76563518 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1884,7 +1884,7 @@ safe_run_hooks_error (Lisp_Object error_data)
1884 = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; 1884 = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit;
1885 Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; 1885 Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil;
1886 Lisp_Object args[4]; 1886 Lisp_Object args[4];
1887 args[0] = build_string ("Error in %s (%s): %s"); 1887 args[0] = build_string ("Error in %s (%s): %S");
1888 args[1] = hook; 1888 args[1] = hook;
1889 args[2] = fun; 1889 args[2] = fun;
1890 args[3] = error_data; 1890 args[3] = error_data;
@@ -12188,7 +12188,7 @@ whenever `deferred-action-list' is non-nil. */);
12188 Vdeferred_action_function = Qnil; 12188 Vdeferred_action_function = Qnil;
12189 12189
12190 DEFVAR_LISP ("delayed-warnings-list", Vdelayed_warnings_list, 12190 DEFVAR_LISP ("delayed-warnings-list", Vdelayed_warnings_list,
12191 doc: /* List of warnings to be displayed as soon as possible. 12191 doc: /* List of warnings to be displayed after this command.
12192Each element must be a list (TYPE MESSAGE [LEVEL [BUFFER-NAME]]), 12192Each element must be a list (TYPE MESSAGE [LEVEL [BUFFER-NAME]]),
12193as per the args of `display-warning' (which see). 12193as per the args of `display-warning' (which see).
12194If this variable is non-nil, `delayed-warnings-hook' will be run 12194If this variable is non-nil, `delayed-warnings-hook' will be run
diff --git a/src/lisp.h b/src/lisp.h
index 678c48e8ff3..1f98780e8e9 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1138,6 +1138,8 @@ struct Lisp_Symbol
1138 special (with `defvar' etc), and shouldn't be lexically bound. */ 1138 special (with `defvar' etc), and shouldn't be lexically bound. */
1139 unsigned declared_special : 1; 1139 unsigned declared_special : 1;
1140 1140
1141 unsigned spacer : 23;
1142
1141 /* The symbol's name, as a Lisp string. 1143 /* The symbol's name, as a Lisp string.
1142 The name "xname" is used to intentionally break code referring to 1144 The name "xname" is used to intentionally break code referring to
1143 the old field "name" of type pointer to struct Lisp_String. */ 1145 the old field "name" of type pointer to struct Lisp_String. */
@@ -3553,6 +3555,7 @@ EXFUN (Fmsdos_downcase_filename, 1);
3553#ifdef HAVE_LIBXML2 3555#ifdef HAVE_LIBXML2
3554/* Defined in xml.c */ 3556/* Defined in xml.c */
3555extern void syms_of_xml (void); 3557extern void syms_of_xml (void);
3558extern void xml_cleanup_parser (void);
3556#endif 3559#endif
3557 3560
3558#ifdef HAVE_MENUS 3561#ifdef HAVE_MENUS
diff --git a/src/lread.c b/src/lread.c
index 353f4a3064d..bfb37b4fc89 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4442,7 +4442,7 @@ were read in. */);
4442 Vread_circle = Qt; 4442 Vread_circle = Qt;
4443 4443
4444 DEFVAR_LISP ("load-path", Vload_path, 4444 DEFVAR_LISP ("load-path", Vload_path,
4445 doc: /* *List of directories to search for files to load. 4445 doc: /* List of directories to search for files to load.
4446Each element is a string (directory name) or nil (try default directory). 4446Each element is a string (directory name) or nil (try default directory).
4447Initialized based on EMACSLOADPATH environment variable, if any, 4447Initialized based on EMACSLOADPATH environment variable, if any,
4448otherwise to default specified by file `epaths.h' when Emacs was built. */); 4448otherwise to default specified by file `epaths.h' when Emacs was built. */);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index d7ca325e223..303445bc2d6 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -128,6 +128,7 @@ OBJ2 = $(BLD)/sysdep.$(O) \
128 $(BLD)/image.$(O) \ 128 $(BLD)/image.$(O) \
129 $(BLD)/terminal.$(O) \ 129 $(BLD)/terminal.$(O) \
130 $(BLD)/menu.$(O) \ 130 $(BLD)/menu.$(O) \
131 $(BLD)/xml.$(O) \
131 $(BLD)/w32term.$(O) \ 132 $(BLD)/w32term.$(O) \
132 $(BLD)/w32xfns.$(O) \ 133 $(BLD)/w32xfns.$(O) \
133 $(BLD)/w32fns.$(O) \ 134 $(BLD)/w32fns.$(O) \
@@ -225,7 +226,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \
225 process.c callproc.c unexw32.c \ 226 process.c callproc.c unexw32.c \
226 region-cache.c sound.c atimer.c \ 227 region-cache.c sound.c atimer.c \
227 doprnt.c intervals.c textprop.c composite.c \ 228 doprnt.c intervals.c textprop.c composite.c \
228 gnutls.c 229 gnutls.c xml.c
229SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ 230SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
230 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o 231 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
231obj = $(GLOBAL_SOURCES:.c=.o) 232obj = $(GLOBAL_SOURCES:.c=.o)
@@ -940,6 +941,13 @@ $(BLD)/gnutls.$(O) : \
940 $(LISP_H) \ 941 $(LISP_H) \
941 $(PROCESS_H) 942 $(PROCESS_H)
942 943
944$(BLD)/xml.$(O) : \
945 $(SRC)/xml.c \
946 $(SRC)/buffer.h \
947 $(SRC)/w32.h \
948 $(CONFIG_H) \
949 $(LISP_H)
950
943$(BLD)/image.$(O) : \ 951$(BLD)/image.$(O) : \
944 $(SRC)/image.c \ 952 $(SRC)/image.c \
945 $(SRC)/epaths.h \ 953 $(SRC)/epaths.h \
diff --git a/src/minibuf.c b/src/minibuf.c
index a9bdf06b735..05f9419ba34 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -72,7 +72,7 @@ Lisp_Object Qcompletion_ignore_case;
72static Lisp_Object Qminibuffer_completion_table; 72static Lisp_Object Qminibuffer_completion_table;
73static Lisp_Object Qminibuffer_completion_predicate; 73static Lisp_Object Qminibuffer_completion_predicate;
74static Lisp_Object Qminibuffer_completion_confirm; 74static Lisp_Object Qminibuffer_completion_confirm;
75static Lisp_Object Quser_variable_p; 75static Lisp_Object Qcustom_variable_p;
76 76
77static Lisp_Object Qminibuffer_default; 77static Lisp_Object Qminibuffer_default;
78 78
@@ -1094,10 +1094,11 @@ Prompt with PROMPT. */)
1094#endif /* NOTDEF */ 1094#endif /* NOTDEF */
1095 1095
1096DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, 1096DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
1097 doc: /* Read the name of a user variable and return it as a symbol. 1097 doc: /* Read the name of a user option and return it as a symbol.
1098Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element 1098Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
1099if it is a list. 1099if it is a list.
1100A user variable is one for which `user-variable-p' returns non-nil. */) 1100A user option, or customizable variable, is one for which
1101`custom-variable-p' returns non-nil. */)
1101 (Lisp_Object prompt, Lisp_Object default_value) 1102 (Lisp_Object prompt, Lisp_Object default_value)
1102{ 1103{
1103 Lisp_Object name, default_string; 1104 Lisp_Object name, default_string;
@@ -1110,7 +1111,7 @@ A user variable is one for which `user-variable-p' returns non-nil. */)
1110 default_string = default_value; 1111 default_string = default_value;
1111 1112
1112 name = Fcompleting_read (prompt, Vobarray, 1113 name = Fcompleting_read (prompt, Vobarray,
1113 Quser_variable_p, Qt, 1114 Qcustom_variable_p, Qt,
1114 Qnil, Qnil, default_string, Qnil); 1115 Qnil, Qnil, default_string, Qnil);
1115 if (NILP (name)) 1116 if (NILP (name))
1116 return name; 1117 return name;
@@ -1975,11 +1976,11 @@ syms_of_minibuf (void)
1975 staticpro (&last_minibuf_string); 1976 staticpro (&last_minibuf_string);
1976 last_minibuf_string = Qnil; 1977 last_minibuf_string = Qnil;
1977 1978
1978 DEFSYM (Quser_variable_p, "user-variable-p");
1979 DEFSYM (Qminibuffer_history, "minibuffer-history"); 1979 DEFSYM (Qminibuffer_history, "minibuffer-history");
1980 DEFSYM (Qbuffer_name_history, "buffer-name-history"); 1980 DEFSYM (Qbuffer_name_history, "buffer-name-history");
1981 Fset (Qbuffer_name_history, Qnil); 1981 Fset (Qbuffer_name_history, Qnil);
1982 1982
1983 DEFSYM (Qcustom_variable_p, "custom-variable-p");
1983 DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook"); 1984 DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook");
1984 DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook"); 1985 DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook");
1985 DEFSYM (Qhistory_length, "history-length"); 1986 DEFSYM (Qhistory_length, "history-length");
diff --git a/src/msdos.c b/src/msdos.c
index 885cedd3df0..5f46829aefd 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -4270,7 +4270,7 @@ syms_of_msdos (void)
4270 DEFSYM (Qreverse, "reverse"); 4270 DEFSYM (Qreverse, "reverse");
4271 4271
4272 DEFVAR_LISP ("dos-unsupported-char-glyph", Vdos_unsupported_char_glyph, 4272 DEFVAR_LISP ("dos-unsupported-char-glyph", Vdos_unsupported_char_glyph,
4273 doc: /* *Glyph to display instead of chars not supported by current codepage. 4273 doc: /* Glyph to display instead of chars not supported by current codepage.
4274This variable is used only by MS-DOS terminals. */); 4274This variable is used only by MS-DOS terminals. */);
4275 Vdos_unsupported_char_glyph = make_number ('\177'); 4275 Vdos_unsupported_char_glyph = make_number ('\177');
4276 4276
diff --git a/src/print.c b/src/print.c
index 404d6259aa4..c5c03274f77 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2158,7 +2158,7 @@ shared once again when the text is read back. */);
2158 Vprint_gensym = Qnil; 2158 Vprint_gensym = Qnil;
2159 2159
2160 DEFVAR_LISP ("print-circle", Vprint_circle, 2160 DEFVAR_LISP ("print-circle", Vprint_circle,
2161 doc: /* *Non-nil means print recursive structures using #N= and #N# syntax. 2161 doc: /* Non-nil means print recursive structures using #N= and #N# syntax.
2162If nil, printing proceeds recursively and may lead to 2162If nil, printing proceeds recursively and may lead to
2163`max-lisp-eval-depth' being exceeded or an error may occur: 2163`max-lisp-eval-depth' being exceeded or an error may occur:
2164\"Apparently circular structure being printed.\" Also see 2164\"Apparently circular structure being printed.\" Also see
@@ -2170,7 +2170,7 @@ where N is a positive decimal integer. */);
2170 Vprint_circle = Qnil; 2170 Vprint_circle = Qnil;
2171 2171
2172 DEFVAR_LISP ("print-continuous-numbering", Vprint_continuous_numbering, 2172 DEFVAR_LISP ("print-continuous-numbering", Vprint_continuous_numbering,
2173 doc: /* *Non-nil means number continuously across print calls. 2173 doc: /* Non-nil means number continuously across print calls.
2174This affects the numbers printed for #N= labels and #M# references. 2174This affects the numbers printed for #N= labels and #M# references.
2175See also `print-circle', `print-gensym', and `print-number-table'. 2175See also `print-circle', `print-gensym', and `print-number-table'.
2176This variable should not be set with `setq'; bind it with a `let' instead. */); 2176This variable should not be set with `setq'; bind it with a `let' instead. */);
diff --git a/src/process.c b/src/process.c
index f2f33a9eafc..65020299e75 100644
--- a/src/process.c
+++ b/src/process.c
@@ -640,7 +640,10 @@ make_process (Lisp_Object name)
640 640
641#ifdef HAVE_GNUTLS 641#ifdef HAVE_GNUTLS
642 p->gnutls_initstage = GNUTLS_STAGE_EMPTY; 642 p->gnutls_initstage = GNUTLS_STAGE_EMPTY;
643 /* Default log level. */
643 p->gnutls_log_level = 0; 644 p->gnutls_log_level = 0;
645 /* GnuTLS handshakes attempted for this connection. */
646 p->gnutls_handshakes_tried = 0;
644 p->gnutls_p = 0; 647 p->gnutls_p = 0;
645 p->gnutls_state = NULL; 648 p->gnutls_state = NULL;
646 p->gnutls_x509_cred = NULL; 649 p->gnutls_x509_cred = NULL;
@@ -7453,7 +7456,7 @@ syms_of_process (void)
7453 DEFSYM (Qargs, "args"); 7456 DEFSYM (Qargs, "args");
7454 7457
7455 DEFVAR_BOOL ("delete-exited-processes", delete_exited_processes, 7458 DEFVAR_BOOL ("delete-exited-processes", delete_exited_processes,
7456 doc: /* *Non-nil means delete processes immediately when they exit. 7459 doc: /* Non-nil means delete processes immediately when they exit.
7457A value of nil means don't delete them until `list-processes' is run. */); 7460A value of nil means don't delete them until `list-processes' is run. */);
7458 7461
7459 delete_exited_processes = 1; 7462 delete_exited_processes = 1;
diff --git a/src/process.h b/src/process.h
index 9efde261386..3eb94cb196b 100644
--- a/src/process.h
+++ b/src/process.h
@@ -134,6 +134,7 @@ struct Lisp_Process
134 gnutls_certificate_client_credentials gnutls_x509_cred; 134 gnutls_certificate_client_credentials gnutls_x509_cred;
135 gnutls_anon_client_credentials_t gnutls_anon_cred; 135 gnutls_anon_client_credentials_t gnutls_anon_cred;
136 int gnutls_log_level; 136 int gnutls_log_level;
137 int gnutls_handshakes_tried;
137 int gnutls_p; 138 int gnutls_p;
138#endif 139#endif
139}; 140};
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index b54bd985e6b..c1233c0e6ce 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -146,9 +146,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
146 || defined __ia64__ || defined __sh__ 146 || defined __ia64__ || defined __sh__
147#define GC_SETJMP_WORKS 1 147#define GC_SETJMP_WORKS 1
148#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 148#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
149#ifdef __mc68000__
150#define GC_LISP_OBJECT_ALIGNMENT 2
151#endif
152#ifdef __ia64__ 149#ifdef __ia64__
153#define GC_MARK_SECONDARY_STACK() \ 150#define GC_MARK_SECONDARY_STACK() \
154 do { \ 151 do { \
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 5eed3a177dc..e89ecb05931 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -159,6 +159,9 @@ struct sigaction {
159#undef HAVE_UTIMES 159#undef HAVE_UTIMES
160#undef HAVE_SETRLIMIT 160#undef HAVE_SETRLIMIT
161#undef HAVE_SETPGID 161#undef HAVE_SETPGID
162/* If you think about defining HAVE_GETCWD, don't: the alternative
163 getwd is redefined on w32.c, and does not really return the current
164 directory, to get the desired results elsewhere in Emacs */
162#undef HAVE_GETCWD 165#undef HAVE_GETCWD
163#define HAVE_SHUTDOWN 1 166#define HAVE_SHUTDOWN 1
164 167
diff --git a/src/syntax.c b/src/syntax.c
index 16012d9f88e..7a0e0fd7c52 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3494,7 +3494,7 @@ See the info node `(elisp)Syntax Properties' for a description of the
3494 3494
3495 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", 3495 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",
3496 open_paren_in_column_0_is_defun_start, 3496 open_paren_in_column_0_is_defun_start,
3497 doc: /* *Non-nil means an open paren in column 0 denotes the start of a defun. */); 3497 doc: /* Non-nil means an open paren in column 0 denotes the start of a defun. */);
3498 open_paren_in_column_0_is_defun_start = 1; 3498 open_paren_in_column_0_is_defun_start = 1;
3499 3499
3500 3500
diff --git a/src/w32menu.c b/src/w32menu.c
index b5cc6801a72..9091cb81627 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1173,18 +1173,23 @@ w32_dialog_show (FRAME_PTR f, int keymaps,
1173static int 1173static int
1174is_simple_dialog (Lisp_Object contents) 1174is_simple_dialog (Lisp_Object contents)
1175{ 1175{
1176 Lisp_Object options = XCDR (contents); 1176 Lisp_Object options;
1177 Lisp_Object name, yes, no, other; 1177 Lisp_Object name, yes, no, other;
1178 1178
1179 if (!CONSP (contents))
1180 return 0;
1181 options = XCDR (contents);
1182
1179 yes = build_string ("Yes"); 1183 yes = build_string ("Yes");
1180 no = build_string ("No"); 1184 no = build_string ("No");
1181 1185
1182 if (!CONSP (options)) 1186 if (!CONSP (options))
1183 return 0; 1187 return 0;
1184 1188
1185 name = XCAR (XCAR (options)); 1189 name = XCAR (options);
1186 if (!CONSP (options)) 1190 if (!CONSP (name))
1187 return 0; 1191 return 0;
1192 name = XCAR (name);
1188 1193
1189 if (!NILP (Fstring_equal (name, yes))) 1194 if (!NILP (Fstring_equal (name, yes)))
1190 other = no; 1195 other = no;
@@ -1197,7 +1202,10 @@ is_simple_dialog (Lisp_Object contents)
1197 if (!CONSP (options)) 1202 if (!CONSP (options))
1198 return 0; 1203 return 0;
1199 1204
1200 name = XCAR (XCAR (options)); 1205 name = XCAR (options);
1206 if (!CONSP (name))
1207 return 0;
1208 name = XCAR (name);
1201 if (NILP (Fstring_equal (name, other))) 1209 if (NILP (Fstring_equal (name, other)))
1202 return 0; 1210 return 0;
1203 1211
@@ -1223,6 +1231,7 @@ simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header)
1223 if (unicode_message_box) 1231 if (unicode_message_box)
1224 { 1232 {
1225 WCHAR *text, *title; 1233 WCHAR *text, *title;
1234 USE_SAFE_ALLOCA;
1226 1235
1227 if (STRINGP (temp)) 1236 if (STRINGP (temp))
1228 { 1237 {
@@ -1232,7 +1241,7 @@ simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header)
1232 one utf16 word, so we cannot simply use the character 1241 one utf16 word, so we cannot simply use the character
1233 length of temp. */ 1242 length of temp. */
1234 int utf8_len = strlen (utf8_text); 1243 int utf8_len = strlen (utf8_text);
1235 text = alloca ((utf8_len + 1) * sizeof (WCHAR)); 1244 SAFE_ALLOCA (text, WCHAR *, (utf8_len + 1) * sizeof (WCHAR));
1236 utf8to16 (utf8_text, utf8_len, text); 1245 utf8to16 (utf8_text, utf8_len, text);
1237 } 1246 }
1238 else 1247 else
@@ -1252,6 +1261,7 @@ simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header)
1252 } 1261 }
1253 1262
1254 answer = unicode_message_box (FRAME_W32_WINDOW (f), text, title, type); 1263 answer = unicode_message_box (FRAME_W32_WINDOW (f), text, title, type);
1264 SAFE_FREE ();
1255 } 1265 }
1256 else 1266 else
1257 { 1267 {
@@ -1358,6 +1368,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1358 char *out_string, *p, *q; 1368 char *out_string, *p, *q;
1359 int return_value; 1369 int return_value;
1360 size_t nlen, orig_len; 1370 size_t nlen, orig_len;
1371 USE_SAFE_ALLOCA;
1361 1372
1362 if (menu_separator_name_p (wv->name)) 1373 if (menu_separator_name_p (wv->name))
1363 { 1374 {
@@ -1373,7 +1384,8 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1373 1384
1374 if (wv->key != NULL) 1385 if (wv->key != NULL)
1375 { 1386 {
1376 out_string = alloca (strlen (wv->name) + strlen (wv->key) + 2); 1387 SAFE_ALLOCA (out_string, char *,
1388 strlen (wv->name) + strlen (wv->key) + 2);
1377 strcpy (out_string, wv->name); 1389 strcpy (out_string, wv->name);
1378 strcat (out_string, "\t"); 1390 strcat (out_string, "\t");
1379 strcat (out_string, wv->key); 1391 strcat (out_string, wv->key);
@@ -1407,7 +1419,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1407 if (nlen > orig_len) 1419 if (nlen > orig_len)
1408 { 1420 {
1409 p = out_string; 1421 p = out_string;
1410 out_string = alloca (nlen + 1); 1422 SAFE_ALLOCA (out_string, char *, nlen + 1);
1411 q = out_string; 1423 q = out_string;
1412 while (*p) 1424 while (*p)
1413 { 1425 {
@@ -1467,7 +1479,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1467 if (fuFlags & MF_OWNERDRAW) 1479 if (fuFlags & MF_OWNERDRAW)
1468 utf16_string = local_alloc ((utf8_len + 1) * sizeof (WCHAR)); 1480 utf16_string = local_alloc ((utf8_len + 1) * sizeof (WCHAR));
1469 else 1481 else
1470 utf16_string = alloca ((utf8_len + 1) * sizeof (WCHAR)); 1482 SAFE_ALLOCA (utf16_string, WCHAR *, (utf8_len + 1) * sizeof (WCHAR));
1471 1483
1472 utf8to16 (out_string, utf8_len, utf16_string); 1484 utf8to16 (out_string, utf8_len, utf16_string);
1473 return_value = unicode_append_menu (menu, fuFlags, 1485 return_value = unicode_append_menu (menu, fuFlags,
@@ -1536,6 +1548,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1536 FALSE, &info); 1548 FALSE, &info);
1537 } 1549 }
1538 } 1550 }
1551 SAFE_FREE ();
1539 return return_value; 1552 return return_value;
1540} 1553}
1541 1554
diff --git a/src/w32term.c b/src/w32term.c
index 8a0e9efc943..18a3753f9e9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6411,7 +6411,7 @@ the cursor have no effect. */);
6411 from cus-start.el and other places, like "M-x set-variable". */ 6411 from cus-start.el and other places, like "M-x set-variable". */
6412 DEFVAR_BOOL ("x-use-underline-position-properties", 6412 DEFVAR_BOOL ("x-use-underline-position-properties",
6413 x_use_underline_position_properties, 6413 x_use_underline_position_properties,
6414 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. 6414 doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
6415A value of nil means ignore them. If you encounter fonts with bogus 6415A value of nil means ignore them. If you encounter fonts with bogus
6416UNDERLINE_POSITION font properties, for example 7x13 on XFree prior 6416UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
6417to 4.1, set this to nil. You can also use `underline-minimum-offset' 6417to 4.1, set this to nil. You can also use `underline-minimum-offset'
@@ -6421,7 +6421,7 @@ sizes. */);
6421 6421
6422 DEFVAR_BOOL ("x-underline-at-descent-line", 6422 DEFVAR_BOOL ("x-underline-at-descent-line",
6423 x_underline_at_descent_line, 6423 x_underline_at_descent_line,
6424 doc: /* *Non-nil means to draw the underline at the same place as the descent line. 6424 doc: /* Non-nil means to draw the underline at the same place as the descent line.
6425A value of nil means to draw the underline according to the value of the 6425A value of nil means to draw the underline according to the value of the
6426variable `x-use-underline-position-properties', which is usually at the 6426variable `x-use-underline-position-properties', which is usually at the
6427baseline level. The default value is nil. */); 6427baseline level. The default value is nil. */);
diff --git a/src/window.c b/src/window.c
index 2a9d308b836..484cc825fb8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2567,6 +2567,7 @@ window-start value is reasonable when this function is called. */)
2567 Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; 2567 Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta;
2568 EMACS_INT startpos IF_LINT (= 0); 2568 EMACS_INT startpos IF_LINT (= 0);
2569 int top IF_LINT (= 0), new_top, resize_failed; 2569 int top IF_LINT (= 0), new_top, resize_failed;
2570 Mouse_HLInfo *hlinfo;
2570 2571
2571 w = decode_any_window (window); 2572 w = decode_any_window (window);
2572 XSETWINDOW (window, w); 2573 XSETWINDOW (window, w);
@@ -2647,6 +2648,20 @@ window-start value is reasonable when this function is called. */)
2647 } 2648 }
2648 2649
2649 BLOCK_INPUT; 2650 BLOCK_INPUT;
2651 hlinfo = MOUSE_HL_INFO (f);
2652 /* We are going to free the glyph matrices of WINDOW, and with that
2653 we might lose any information about glyph rows that have some of
2654 their glyphs highlighted in mouse face. (These rows are marked
2655 with a non-zero mouse_face_p flag.) If WINDOW indeed has some
2656 glyphs highlighted in mouse face, signal to frame's up-to-date
2657 hook that mouse highlight was overwritten, so that it will
2658 arrange for redisplaying the highlight. */
2659 if (EQ (hlinfo->mouse_face_window, window))
2660 {
2661 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
2662 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
2663 hlinfo->mouse_face_window = Qnil;
2664 }
2650 free_window_matrices (r); 2665 free_window_matrices (r);
2651 2666
2652 windows_or_buffers_changed++; 2667 windows_or_buffers_changed++;
diff --git a/src/xdisp.c b/src/xdisp.c
index b567893d719..2e83671007c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9020,7 +9020,6 @@ move_it_by_lines (struct it *it, int dvpos)
9020 { 9020 {
9021 /* DVPOS == 0 means move to the start of the screen line. */ 9021 /* DVPOS == 0 means move to the start of the screen line. */
9022 move_it_vertically_backward (it, 0); 9022 move_it_vertically_backward (it, 0);
9023 xassert (it->current_x == 0 && it->hpos == 0);
9024 /* Let next call to line_bottom_y calculate real line height */ 9023 /* Let next call to line_bottom_y calculate real line height */
9025 last_height = 0; 9024 last_height = 0;
9026 } 9025 }
@@ -9028,7 +9027,20 @@ move_it_by_lines (struct it *it, int dvpos)
9028 { 9027 {
9029 move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); 9028 move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS);
9030 if (!IT_POS_VALID_AFTER_MOVE_P (it)) 9029 if (!IT_POS_VALID_AFTER_MOVE_P (it))
9031 move_it_to (it, IT_CHARPOS (*it) + 1, -1, -1, -1, MOVE_TO_POS); 9030 {
9031 /* Only move to the next buffer position if we ended up in a
9032 string from display property, not in an overlay string
9033 (before-string or after-string). That is because the
9034 latter don't conceal the underlying buffer position, so
9035 we can ask to move the iterator to the exact position we
9036 are interested in. Note that, even if we are already at
9037 IT_CHARPOS (*it), the call below is not a no-op, as it
9038 will detect that we are at the end of the string, pop the
9039 iterator, and compute it->current_x and it->hpos
9040 correctly. */
9041 move_it_to (it, IT_CHARPOS (*it) + it->string_from_display_prop_p,
9042 -1, -1, -1, MOVE_TO_POS);
9043 }
9032 } 9044 }
9033 else 9045 else
9034 { 9046 {
@@ -13861,16 +13873,31 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13861 13873
13862 chprop = Fget_char_property (make_number (glyph_pos), Qcursor, 13874 chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
13863 glyph->object); 13875 glyph->object);
13876 if (!NILP (chprop))
13877 {
13878 /* If the string came from a `display' text property,
13879 look up the buffer position of that property and
13880 use that position to update bpos_max, as if we
13881 actually saw such a position in one of the row's
13882 glyphs. This helps with supporting integer values
13883 of `cursor' property on the display string in
13884 situations where most or all of the row's buffer
13885 text is completely covered by display properties,
13886 so that no glyph with valid buffer positions is
13887 ever seen in the row. */
13888 EMACS_INT prop_pos =
13889 string_buffer_position_lim (glyph->object, pos_before,
13890 pos_after, 0);
13891
13892 if (prop_pos >= pos_before)
13893 bpos_max = prop_pos - 1;
13894 }
13864 if (INTEGERP (chprop)) 13895 if (INTEGERP (chprop))
13865 { 13896 {
13866 bpos_covered = bpos_max + XINT (chprop); 13897 bpos_covered = bpos_max + XINT (chprop);
13867 /* If the `cursor' property covers buffer positions up 13898 /* If the `cursor' property covers buffer positions up
13868 to and including point, we should display cursor on 13899 to and including point, we should display cursor on
13869 this glyph. Note that overlays and text properties 13900 this glyph. Note that, if a `cursor' property on one
13870 with string values stop bidi reordering, so every
13871 buffer position to the left of the string is always
13872 smaller than any position to the right of the
13873 string. Therefore, if a `cursor' property on one
13874 of the string's characters has an integer value, we 13901 of the string's characters has an integer value, we
13875 will break out of the loop below _before_ we get to 13902 will break out of the loop below _before_ we get to
13876 the position match above. IOW, integer values of 13903 the position match above. IOW, integer values of
@@ -13930,6 +13957,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13930 13957
13931 chprop = Fget_char_property (make_number (glyph_pos), Qcursor, 13958 chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
13932 glyph->object); 13959 glyph->object);
13960 if (!NILP (chprop))
13961 {
13962 EMACS_INT prop_pos =
13963 string_buffer_position_lim (glyph->object, pos_before,
13964 pos_after, 0);
13965
13966 if (prop_pos >= pos_before)
13967 bpos_max = prop_pos - 1;
13968 }
13933 if (INTEGERP (chprop)) 13969 if (INTEGERP (chprop))
13934 { 13970 {
13935 bpos_covered = bpos_max + XINT (chprop); 13971 bpos_covered = bpos_max + XINT (chprop);
@@ -14067,15 +14103,18 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14067 || pos <= tem) 14103 || pos <= tem)
14068 { 14104 {
14069 /* If the string from which this glyph came is 14105 /* If the string from which this glyph came is
14070 found in the buffer at point, then we've 14106 found in the buffer at point, or at position
14071 found the glyph we've been looking for. If 14107 that is closer to point than pos_after, then
14072 it comes from an overlay (tem == 0), and it 14108 we've found the glyph we've been looking for.
14073 has the `cursor' property on one of its 14109 If it comes from an overlay (tem == 0), and
14110 it has the `cursor' property on one of its
14074 glyphs, record that glyph as a candidate for 14111 glyphs, record that glyph as a candidate for
14075 displaying the cursor. (As in the 14112 displaying the cursor. (As in the
14076 unidirectional version, we will display the 14113 unidirectional version, we will display the
14077 cursor on the last candidate we find.) */ 14114 cursor on the last candidate we find.) */
14078 if (tem == 0 || tem == pt_old) 14115 if (tem == 0
14116 || tem == pt_old
14117 || (tem - pt_old > 0 && tem < pos_after))
14079 { 14118 {
14080 /* The glyphs from this string could have 14119 /* The glyphs from this string could have
14081 been reordered. Find the one with the 14120 been reordered. Find the one with the
@@ -14113,7 +14152,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14113 } 14152 }
14114 } 14153 }
14115 14154
14116 if (tem == pt_old) 14155 if (tem == pt_old
14156 || (tem - pt_old > 0 && tem < pos_after))
14117 goto compute_x; 14157 goto compute_x;
14118 } 14158 }
14119 if (tem) 14159 if (tem)
@@ -18277,8 +18317,10 @@ append_space_for_newline (struct it *it, int default_face_p)
18277 it->c = it->char_to_display = ' '; 18317 it->c = it->char_to_display = ' ';
18278 it->len = 1; 18318 it->len = 1;
18279 18319
18320 /* If the default face was remapped, be sure to use the
18321 remapped face for the appended newline. */
18280 if (default_face_p) 18322 if (default_face_p)
18281 it->face_id = DEFAULT_FACE_ID; 18323 it->face_id = lookup_basic_face (it->f, DEFAULT_FACE_ID);
18282 else if (it->face_before_selective_p) 18324 else if (it->face_before_selective_p)
18283 it->face_id = it->saved_face_id; 18325 it->face_id = it->saved_face_id;
18284 face = FACE_FROM_ID (it->f, it->face_id); 18326 face = FACE_FROM_ID (it->f, it->face_id);
@@ -18314,7 +18356,7 @@ append_space_for_newline (struct it *it, int default_face_p)
18314static void 18356static void
18315extend_face_to_end_of_line (struct it *it) 18357extend_face_to_end_of_line (struct it *it)
18316{ 18358{
18317 struct face *face; 18359 struct face *face, *default_face;
18318 struct frame *f = it->f; 18360 struct frame *f = it->f;
18319 18361
18320 /* If line is already filled, do nothing. Non window-system frames 18362 /* If line is already filled, do nothing. Non window-system frames
@@ -18328,6 +18370,9 @@ extend_face_to_end_of_line (struct it *it)
18328 && !it->glyph_row->continued_p)) 18370 && !it->glyph_row->continued_p))
18329 return; 18371 return;
18330 18372
18373 /* The default face, possibly remapped. */
18374 default_face = FACE_FROM_ID (f, lookup_basic_face (f, DEFAULT_FACE_ID));
18375
18331 /* Face extension extends the background and box of IT->face_id 18376 /* Face extension extends the background and box of IT->face_id
18332 to the end of the line. If the background equals the background 18377 to the end of the line. If the background equals the background
18333 of the frame, we don't have to do anything. */ 18378 of the frame, we don't have to do anything. */
@@ -18365,7 +18410,7 @@ extend_face_to_end_of_line (struct it *it)
18365 if (it->glyph_row->used[TEXT_AREA] == 0) 18410 if (it->glyph_row->used[TEXT_AREA] == 0)
18366 { 18411 {
18367 it->glyph_row->glyphs[TEXT_AREA][0] = space_glyph; 18412 it->glyph_row->glyphs[TEXT_AREA][0] = space_glyph;
18368 it->glyph_row->glyphs[TEXT_AREA][0].face_id = it->face_id; 18413 it->glyph_row->glyphs[TEXT_AREA][0].face_id = face->id;
18369 it->glyph_row->used[TEXT_AREA] = 1; 18414 it->glyph_row->used[TEXT_AREA] = 1;
18370 } 18415 }
18371#ifdef HAVE_WINDOW_SYSTEM 18416#ifdef HAVE_WINDOW_SYSTEM
@@ -18401,7 +18446,7 @@ extend_face_to_end_of_line (struct it *it)
18401 face, to avoid painting the rest of the window with 18446 face, to avoid painting the rest of the window with
18402 the region face, if the region ends at ZV. */ 18447 the region face, if the region ends at ZV. */
18403 if (it->glyph_row->ends_at_zv_p) 18448 if (it->glyph_row->ends_at_zv_p)
18404 it->face_id = DEFAULT_FACE_ID; 18449 it->face_id = default_face->id;
18405 else 18450 else
18406 it->face_id = face->id; 18451 it->face_id = face->id;
18407 append_stretch_glyph (it, make_number (0), stretch_width, 18452 append_stretch_glyph (it, make_number (0), stretch_width,
@@ -18434,7 +18479,7 @@ extend_face_to_end_of_line (struct it *it)
18434 avoid painting the rest of the window with the region face, 18479 avoid painting the rest of the window with the region face,
18435 if the region ends at ZV. */ 18480 if the region ends at ZV. */
18436 if (it->glyph_row->ends_at_zv_p) 18481 if (it->glyph_row->ends_at_zv_p)
18437 it->face_id = DEFAULT_FACE_ID; 18482 it->face_id = default_face->id;
18438 else 18483 else
18439 it->face_id = face->id; 18484 it->face_id = face->id;
18440 18485
@@ -19098,8 +19143,13 @@ display_line (struct it *it)
19098 /* A row that displays right-to-left text must always have 19143 /* A row that displays right-to-left text must always have
19099 its last face extended all the way to the end of line, 19144 its last face extended all the way to the end of line,
19100 even if this row ends in ZV, because we still write to 19145 even if this row ends in ZV, because we still write to
19101 the screen left to right. */ 19146 the screen left to right. We also need to extend the
19102 if (row->reversed_p) 19147 last face if the default face is remapped to some
19148 different face, otherwise the functions that clear
19149 portions of the screen will clear with the default face's
19150 background color. */
19151 if (row->reversed_p
19152 || lookup_basic_face (it->f, DEFAULT_FACE_ID) != DEFAULT_FACE_ID)
19103 extend_face_to_end_of_line (it); 19153 extend_face_to_end_of_line (it);
19104 break; 19154 break;
19105 } 19155 }
@@ -28472,14 +28522,14 @@ syms_of_xdisp (void)
28472 28522
28473#ifdef HAVE_WINDOW_SYSTEM 28523#ifdef HAVE_WINDOW_SYSTEM
28474 DEFVAR_BOOL ("x-stretch-cursor", x_stretch_cursor_p, 28524 DEFVAR_BOOL ("x-stretch-cursor", x_stretch_cursor_p,
28475 doc: /* *Non-nil means draw block cursor as wide as the glyph under it. 28525 doc: /* Non-nil means draw block cursor as wide as the glyph under it.
28476For example, if a block cursor is over a tab, it will be drawn as 28526For example, if a block cursor is over a tab, it will be drawn as
28477wide as that tab on the display. */); 28527wide as that tab on the display. */);
28478 x_stretch_cursor_p = 0; 28528 x_stretch_cursor_p = 0;
28479#endif 28529#endif
28480 28530
28481 DEFVAR_LISP ("show-trailing-whitespace", Vshow_trailing_whitespace, 28531 DEFVAR_LISP ("show-trailing-whitespace", Vshow_trailing_whitespace,
28482 doc: /* *Non-nil means highlight trailing whitespace. 28532 doc: /* Non-nil means highlight trailing whitespace.
28483The face used for trailing whitespace is `trailing-whitespace'. */); 28533The face used for trailing whitespace is `trailing-whitespace'. */);
28484 Vshow_trailing_whitespace = Qnil; 28534 Vshow_trailing_whitespace = Qnil;
28485 28535
@@ -28499,7 +28549,7 @@ A value of nil means no special handling of these characters. */);
28499 Vnobreak_char_display = Qt; 28549 Vnobreak_char_display = Qt;
28500 28550
28501 DEFVAR_LISP ("void-text-area-pointer", Vvoid_text_area_pointer, 28551 DEFVAR_LISP ("void-text-area-pointer", Vvoid_text_area_pointer,
28502 doc: /* *The pointer shape to show in void text areas. 28552 doc: /* The pointer shape to show in void text areas.
28503A value of nil means to show the text pointer. Other options are `arrow', 28553A value of nil means to show the text pointer. Other options are `arrow',
28504`text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'. */); 28554`text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'. */);
28505 Vvoid_text_area_pointer = Qarrow; 28555 Vvoid_text_area_pointer = Qarrow;
@@ -28532,14 +28582,14 @@ where to display overlay arrows. */);
28532 = Fcons (intern_c_string ("overlay-arrow-position"), Qnil); 28582 = Fcons (intern_c_string ("overlay-arrow-position"), Qnil);
28533 28583
28534 DEFVAR_INT ("scroll-step", emacs_scroll_step, 28584 DEFVAR_INT ("scroll-step", emacs_scroll_step,
28535 doc: /* *The number of lines to try scrolling a window by when point moves out. 28585 doc: /* The number of lines to try scrolling a window by when point moves out.
28536If that fails to bring point back on frame, point is centered instead. 28586If that fails to bring point back on frame, point is centered instead.
28537If this is zero, point is always centered after it moves off frame. 28587If this is zero, point is always centered after it moves off frame.
28538If you want scrolling to always be a line at a time, you should set 28588If you want scrolling to always be a line at a time, you should set
28539`scroll-conservatively' to a large value rather than set this to 1. */); 28589`scroll-conservatively' to a large value rather than set this to 1. */);
28540 28590
28541 DEFVAR_INT ("scroll-conservatively", scroll_conservatively, 28591 DEFVAR_INT ("scroll-conservatively", scroll_conservatively,
28542 doc: /* *Scroll up to this many lines, to bring point back on screen. 28592 doc: /* Scroll up to this many lines, to bring point back on screen.
28543If point moves off-screen, redisplay will scroll by up to 28593If point moves off-screen, redisplay will scroll by up to
28544`scroll-conservatively' lines in order to bring point just barely 28594`scroll-conservatively' lines in order to bring point just barely
28545onto the screen again. If that cannot be done, then redisplay 28595onto the screen again. If that cannot be done, then redisplay
@@ -28553,7 +28603,7 @@ A value of zero means always recenter point if it moves off screen. */);
28553 scroll_conservatively = 0; 28603 scroll_conservatively = 0;
28554 28604
28555 DEFVAR_INT ("scroll-margin", scroll_margin, 28605 DEFVAR_INT ("scroll-margin", scroll_margin,
28556 doc: /* *Number of lines of margin at the top and bottom of a window. 28606 doc: /* Number of lines of margin at the top and bottom of a window.
28557Recenter the window whenever point gets within this many lines 28607Recenter the window whenever point gets within this many lines
28558of the top or bottom of the window. */); 28608of the top or bottom of the window. */);
28559 scroll_margin = 0; 28609 scroll_margin = 0;
@@ -28589,20 +28639,20 @@ Any other value means to use the appropriate face, `mode-line',
28589 mode_line_inverse_video = 1; 28639 mode_line_inverse_video = 1;
28590 28640
28591 DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit, 28641 DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit,
28592 doc: /* *Maximum buffer size for which line number should be displayed. 28642 doc: /* Maximum buffer size for which line number should be displayed.
28593If the buffer is bigger than this, the line number does not appear 28643If the buffer is bigger than this, the line number does not appear
28594in the mode line. A value of nil means no limit. */); 28644in the mode line. A value of nil means no limit. */);
28595 Vline_number_display_limit = Qnil; 28645 Vline_number_display_limit = Qnil;
28596 28646
28597 DEFVAR_INT ("line-number-display-limit-width", 28647 DEFVAR_INT ("line-number-display-limit-width",
28598 line_number_display_limit_width, 28648 line_number_display_limit_width,
28599 doc: /* *Maximum line width (in characters) for line number display. 28649 doc: /* Maximum line width (in characters) for line number display.
28600If the average length of the lines near point is bigger than this, then the 28650If the average length of the lines near point is bigger than this, then the
28601line number may be omitted from the mode line. */); 28651line number may be omitted from the mode line. */);
28602 line_number_display_limit_width = 200; 28652 line_number_display_limit_width = 200;
28603 28653
28604 DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows, 28654 DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows,
28605 doc: /* *Non-nil means highlight region even in nonselected windows. */); 28655 doc: /* Non-nil means highlight region even in nonselected windows. */);
28606 highlight_nonselected_windows = 0; 28656 highlight_nonselected_windows = 0;
28607 28657
28608 DEFVAR_BOOL ("multiple-frames", multiple_frames, 28658 DEFVAR_BOOL ("multiple-frames", multiple_frames,
@@ -28674,7 +28724,7 @@ See `set-window-redisplay-end-trigger'. */);
28674 Vredisplay_end_trigger_functions = Qnil; 28724 Vredisplay_end_trigger_functions = Qnil;
28675 28725
28676 DEFVAR_LISP ("mouse-autoselect-window", Vmouse_autoselect_window, 28726 DEFVAR_LISP ("mouse-autoselect-window", Vmouse_autoselect_window,
28677 doc: /* *Non-nil means autoselect window with mouse pointer. 28727 doc: /* Non-nil means autoselect window with mouse pointer.
28678If nil, do not autoselect windows. 28728If nil, do not autoselect windows.
28679A positive number means delay autoselection by that many seconds: a 28729A positive number means delay autoselection by that many seconds: a
28680window is autoselected only after the mouse has remained in that 28730window is autoselected only after the mouse has remained in that
@@ -28694,7 +28744,7 @@ When customizing this variable make sure that the actual value of
28694 Vmouse_autoselect_window = Qnil; 28744 Vmouse_autoselect_window = Qnil;
28695 28745
28696 DEFVAR_LISP ("auto-resize-tool-bars", Vauto_resize_tool_bars, 28746 DEFVAR_LISP ("auto-resize-tool-bars", Vauto_resize_tool_bars,
28697 doc: /* *Non-nil means automatically resize tool-bars. 28747 doc: /* Non-nil means automatically resize tool-bars.
28698This dynamically changes the tool-bar's height to the minimum height 28748This dynamically changes the tool-bar's height to the minimum height
28699that is needed to make all tool-bar items visible. 28749that is needed to make all tool-bar items visible.
28700If value is `grow-only', the tool-bar's height is only increased 28750If value is `grow-only', the tool-bar's height is only increased
@@ -28702,15 +28752,15 @@ automatically; to decrease the tool-bar height, use \\[recenter]. */);
28702 Vauto_resize_tool_bars = Qt; 28752 Vauto_resize_tool_bars = Qt;
28703 28753
28704 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, 28754 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p,
28705 doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */); 28755 doc: /* Non-nil means raise tool-bar buttons when the mouse moves over them. */);
28706 auto_raise_tool_bar_buttons_p = 1; 28756 auto_raise_tool_bar_buttons_p = 1;
28707 28757
28708 DEFVAR_BOOL ("make-cursor-line-fully-visible", make_cursor_line_fully_visible_p, 28758 DEFVAR_BOOL ("make-cursor-line-fully-visible", make_cursor_line_fully_visible_p,
28709 doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); 28759 doc: /* Non-nil means to scroll (recenter) cursor line if it is not fully visible. */);
28710 make_cursor_line_fully_visible_p = 1; 28760 make_cursor_line_fully_visible_p = 1;
28711 28761
28712 DEFVAR_LISP ("tool-bar-border", Vtool_bar_border, 28762 DEFVAR_LISP ("tool-bar-border", Vtool_bar_border,
28713 doc: /* *Border below tool-bar in pixels. 28763 doc: /* Border below tool-bar in pixels.
28714If an integer, use it as the height of the border. 28764If an integer, use it as the height of the border.
28715If it is one of `internal-border-width' or `border-width', use the 28765If it is one of `internal-border-width' or `border-width', use the
28716value of the corresponding frame parameter. 28766value of the corresponding frame parameter.
@@ -28718,7 +28768,7 @@ Otherwise, no border is added below the tool-bar. */);
28718 Vtool_bar_border = Qinternal_border_width; 28768 Vtool_bar_border = Qinternal_border_width;
28719 28769
28720 DEFVAR_LISP ("tool-bar-button-margin", Vtool_bar_button_margin, 28770 DEFVAR_LISP ("tool-bar-button-margin", Vtool_bar_button_margin,
28721 doc: /* *Margin around tool-bar buttons in pixels. 28771 doc: /* Margin around tool-bar buttons in pixels.
28722If an integer, use that for both horizontal and vertical margins. 28772If an integer, use that for both horizontal and vertical margins.
28723Otherwise, value should be a pair of integers `(HORZ . VERT)' with 28773Otherwise, value should be a pair of integers `(HORZ . VERT)' with
28724HORZ specifying the horizontal margin, and VERT specifying the 28774HORZ specifying the horizontal margin, and VERT specifying the
@@ -28726,7 +28776,7 @@ vertical margin. */);
28726 Vtool_bar_button_margin = make_number (DEFAULT_TOOL_BAR_BUTTON_MARGIN); 28776 Vtool_bar_button_margin = make_number (DEFAULT_TOOL_BAR_BUTTON_MARGIN);
28727 28777
28728 DEFVAR_INT ("tool-bar-button-relief", tool_bar_button_relief, 28778 DEFVAR_INT ("tool-bar-button-relief", tool_bar_button_relief,
28729 doc: /* *Relief thickness of tool-bar buttons. */); 28779 doc: /* Relief thickness of tool-bar buttons. */);
28730 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF; 28780 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
28731 28781
28732 DEFVAR_LISP ("tool-bar-style", Vtool_bar_style, 28782 DEFVAR_LISP ("tool-bar-style", Vtool_bar_style,
@@ -28741,7 +28791,7 @@ It can be one of
28741 Vtool_bar_style = Qnil; 28791 Vtool_bar_style = Qnil;
28742 28792
28743 DEFVAR_INT ("tool-bar-max-label-size", tool_bar_max_label_size, 28793 DEFVAR_INT ("tool-bar-max-label-size", tool_bar_max_label_size,
28744 doc: /* *Maximum number of characters a label can have to be shown. 28794 doc: /* Maximum number of characters a label can have to be shown.
28745The tool bar style must also show labels for this to have any effect, see 28795The tool bar style must also show labels for this to have any effect, see
28746`tool-bar-style'. */); 28796`tool-bar-style'. */);
28747 tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE; 28797 tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE;
@@ -28756,7 +28806,7 @@ fontified regions the property `fontified'. */);
28756 28806
28757 DEFVAR_BOOL ("unibyte-display-via-language-environment", 28807 DEFVAR_BOOL ("unibyte-display-via-language-environment",
28758 unibyte_display_via_language_environment, 28808 unibyte_display_via_language_environment,
28759 doc: /* *Non-nil means display unibyte text according to language environment. 28809 doc: /* Non-nil means display unibyte text according to language environment.
28760Specifically, this means that raw bytes in the range 160-255 decimal 28810Specifically, this means that raw bytes in the range 160-255 decimal
28761are displayed by converting them to the equivalent multibyte characters 28811are displayed by converting them to the equivalent multibyte characters
28762according to the current language environment. As a result, they are 28812according to the current language environment. As a result, they are
@@ -28767,7 +28817,7 @@ but does not change the fact they are interpreted as raw bytes. */);
28767 unibyte_display_via_language_environment = 0; 28817 unibyte_display_via_language_environment = 0;
28768 28818
28769 DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height, 28819 DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height,
28770 doc: /* *Maximum height for resizing mini-windows (the minibuffer and the echo area). 28820 doc: /* Maximum height for resizing mini-windows (the minibuffer and the echo area).
28771If a float, it specifies a fraction of the mini-window frame's height. 28821If a float, it specifies a fraction of the mini-window frame's height.
28772If an integer, it specifies a number of lines. */); 28822If an integer, it specifies a number of lines. */);
28773 Vmax_mini_window_height = make_float (0.25); 28823 Vmax_mini_window_height = make_float (0.25);
@@ -28801,12 +28851,12 @@ point visible. */);
28801 DEFSYM (Qauto_hscroll_mode, "auto-hscroll-mode"); 28851 DEFSYM (Qauto_hscroll_mode, "auto-hscroll-mode");
28802 28852
28803 DEFVAR_INT ("hscroll-margin", hscroll_margin, 28853 DEFVAR_INT ("hscroll-margin", hscroll_margin,
28804 doc: /* *How many columns away from the window edge point is allowed to get 28854 doc: /* How many columns away from the window edge point is allowed to get
28805before automatic hscrolling will horizontally scroll the window. */); 28855before automatic hscrolling will horizontally scroll the window. */);
28806 hscroll_margin = 5; 28856 hscroll_margin = 5;
28807 28857
28808 DEFVAR_LISP ("hscroll-step", Vhscroll_step, 28858 DEFVAR_LISP ("hscroll-step", Vhscroll_step,
28809 doc: /* *How many columns to scroll the window when point gets too close to the edge. 28859 doc: /* How many columns to scroll the window when point gets too close to the edge.
28810When point is less than `hscroll-margin' columns from the window 28860When point is less than `hscroll-margin' columns from the window
28811edge, automatic hscrolling will scroll the window by the amount of columns 28861edge, automatic hscrolling will scroll the window by the amount of columns
28812determined by this variable. If its value is a positive integer, scroll that 28862determined by this variable. If its value is a positive integer, scroll that
@@ -28893,7 +28943,7 @@ To add a prefix to continuation lines, use `wrap-prefix'. */);
28893#endif /* GLYPH_DEBUG */ 28943#endif /* GLYPH_DEBUG */
28894 28944
28895 DEFVAR_INT ("overline-margin", overline_margin, 28945 DEFVAR_INT ("overline-margin", overline_margin,
28896 doc: /* *Space between overline and text, in pixels. 28946 doc: /* Space between overline and text, in pixels.
28897The default value is 2: the height of the overline (1 pixel) plus 1 pixel 28947The default value is 2: the height of the overline (1 pixel) plus 1 pixel
28898margin to the character height. */); 28948margin to the character height. */);
28899 overline_margin = 2; 28949 overline_margin = 2;
@@ -28914,7 +28964,7 @@ cursor shapes. */);
28914 display_hourglass_p = 1; 28964 display_hourglass_p = 1;
28915 28965
28916 DEFVAR_LISP ("hourglass-delay", Vhourglass_delay, 28966 DEFVAR_LISP ("hourglass-delay", Vhourglass_delay,
28917 doc: /* *Seconds to wait before displaying an hourglass pointer when Emacs is busy. */); 28967 doc: /* Seconds to wait before displaying an hourglass pointer when Emacs is busy. */);
28918 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); 28968 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
28919 28969
28920 hourglass_atimer = NULL; 28970 hourglass_atimer = NULL;
diff --git a/src/xfaces.c b/src/xfaces.c
index 476fb1e0366..972de234510 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6558,7 +6558,7 @@ syms_of_xfaces (void)
6558#endif 6558#endif
6559 6559
6560 DEFVAR_LISP ("font-list-limit", Vfont_list_limit, 6560 DEFVAR_LISP ("font-list-limit", Vfont_list_limit,
6561 doc: /* *Limit for font matching. 6561 doc: /* Limit for font matching.
6562If an integer > 0, font matching functions won't load more than 6562If an integer > 0, font matching functions won't load more than
6563that number of fonts when searching for a matching font. */); 6563that number of fonts when searching for a matching font. */);
6564 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT); 6564 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT);
@@ -6568,7 +6568,7 @@ that number of fonts when searching for a matching font. */);
6568 Vface_new_frame_defaults = Qnil; 6568 Vface_new_frame_defaults = Qnil;
6569 6569
6570 DEFVAR_LISP ("face-default-stipple", Vface_default_stipple, 6570 DEFVAR_LISP ("face-default-stipple", Vface_default_stipple,
6571 doc: /* *Default stipple pattern used on monochrome displays. 6571 doc: /* Default stipple pattern used on monochrome displays.
6572This stipple pattern is used on monochrome displays 6572This stipple pattern is used on monochrome displays
6573instead of shades of gray for a face background color. 6573instead of shades of gray for a face background color.
6574See `set-face-stipple' for possible values for this variable. */); 6574See `set-face-stipple' for possible values for this variable. */);
diff --git a/src/xfns.c b/src/xfns.c
index 6f08ada1bb9..df1b39b018f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5920,32 +5920,32 @@ Chinese, Japanese, and Korean. */);
5920 5920
5921/* This is not ifdef:ed, so other builds than GTK can customize it. */ 5921/* This is not ifdef:ed, so other builds than GTK can customize it. */
5922 DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog, 5922 DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
5923 doc: /* *Non-nil means prompt with the old GTK file selection dialog. 5923 doc: /* Non-nil means prompt with the old GTK file selection dialog.
5924If nil or if the file selection dialog is not available, the new GTK file 5924If nil or if the file selection dialog is not available, the new GTK file
5925chooser is used instead. To turn off all file dialogs set the 5925chooser is used instead. To turn off all file dialogs set the
5926variable `use-file-dialog'. */); 5926variable `use-file-dialog'. */);
5927 x_gtk_use_old_file_dialog = 0; 5927 x_gtk_use_old_file_dialog = 0;
5928 5928
5929 DEFVAR_BOOL ("x-gtk-show-hidden-files", x_gtk_show_hidden_files, 5929 DEFVAR_BOOL ("x-gtk-show-hidden-files", x_gtk_show_hidden_files,
5930 doc: /* *If non-nil, the GTK file chooser will by default show hidden files. 5930 doc: /* If non-nil, the GTK file chooser will by default show hidden files.
5931Note that this is just the default, there is a toggle button on the file 5931Note that this is just the default, there is a toggle button on the file
5932chooser to show or not show hidden files on a case by case basis. */); 5932chooser to show or not show hidden files on a case by case basis. */);
5933 x_gtk_show_hidden_files = 0; 5933 x_gtk_show_hidden_files = 0;
5934 5934
5935 DEFVAR_BOOL ("x-gtk-file-dialog-help-text", x_gtk_file_dialog_help_text, 5935 DEFVAR_BOOL ("x-gtk-file-dialog-help-text", x_gtk_file_dialog_help_text,
5936 doc: /* *If non-nil, the GTK file chooser will show additional help text. 5936 doc: /* If non-nil, the GTK file chooser will show additional help text.
5937If more space for files in the file chooser dialog is wanted, set this to nil 5937If more space for files in the file chooser dialog is wanted, set this to nil
5938to turn the additional text off. */); 5938to turn the additional text off. */);
5939 x_gtk_file_dialog_help_text = 1; 5939 x_gtk_file_dialog_help_text = 1;
5940 5940
5941 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar, 5941 DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar,
5942 doc: /* *If non-nil, a detached tool bar is shown in full. 5942 doc: /* If non-nil, a detached tool bar is shown in full.
5943The default is to just show an arrow and pressing on that arrow shows 5943The default is to just show an arrow and pressing on that arrow shows
5944the tool bar buttons. */); 5944the tool bar buttons. */);
5945 x_gtk_whole_detached_tool_bar = 0; 5945 x_gtk_whole_detached_tool_bar = 0;
5946 5946
5947 DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips, 5947 DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
5948 doc: /* *If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used. 5948 doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
5949Otherwise use Emacs own tooltip implementation. 5949Otherwise use Emacs own tooltip implementation.
5950When using Gtk+ tooltips, the tooltip face is not used. */); 5950When using Gtk+ tooltips, the tooltip face is not used. */);
5951 x_gtk_use_system_tooltips = 1; 5951 x_gtk_use_system_tooltips = 1;
diff --git a/src/xml.c b/src/xml.c
index 5c4b6ee35f0..786f0cd8818 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -28,6 +28,97 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include "lisp.h" 28#include "lisp.h"
29#include "buffer.h" 29#include "buffer.h"
30 30
31
32static Lisp_Object Qlibxml2_dll;
33
34#ifdef WINDOWSNT
35
36#include <windows.h>
37#include "w32.h"
38
39/* Macro for defining functions that will be loaded from the libxml2 DLL. */
40#define DEF_XML2_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
41
42/* Macro for loading libxml2 functions from the library. */
43#define LOAD_XML2_FN(lib,func) { \
44 fn_##func = (void *) GetProcAddress (lib, #func); \
45 if (!fn_##func) goto bad_library; \
46 }
47
48DEF_XML2_FN (htmlDocPtr, htmlReadMemory,
49 (const char *, int, const char *, const char *, int));
50DEF_XML2_FN (xmlDocPtr, xmlReadMemory,
51 (const char *, int, const char *, const char *, int));
52DEF_XML2_FN (xmlNodePtr, xmlDocGetRootElement, (xmlDocPtr));
53DEF_XML2_FN (void, xmlFreeDoc, (xmlDocPtr));
54DEF_XML2_FN (void, xmlCleanupParser, (void));
55DEF_XML2_FN (void, xmlCheckVersion, (int));
56
57static int
58libxml2_loaded_p (void)
59{
60 Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache);
61
62 if (CONSP (found))
63 return EQ (XCDR (found), Qt) ? 1 : 0;
64 return 0;
65}
66
67#else /* !WINDOWSNT */
68
69#define fn_htmlReadMemory htmlReadMemory
70#define fn_xmlReadMemory xmlReadMemory
71#define fn_xmlDocGetRootElement xmlDocGetRootElement
72#define fn_xmlFreeDoc xmlFreeDoc
73#define fn_xmlCleanupParser xmlCleanupParser
74#define fn_xmlCheckVersion xmlCheckVersion
75
76static inline int
77libxml2_loaded_p (void)
78{
79 return 1;
80}
81
82#endif /* !WINDOWSNT */
83
84static int
85init_libxml2_functions (Lisp_Object libraries)
86{
87#ifdef WINDOWSNT
88 if (libxml2_loaded_p ())
89 return 1;
90 else
91 {
92 HMODULE library;
93
94 if (!(library = w32_delayed_load (libraries, Qlibxml2_dll)))
95 {
96 message ("%s", "libxml2 library not found");
97 return 0;
98 }
99
100 /* LOAD_XML2_FN jumps to bad_library if it fails to find the
101 named function. */
102 LOAD_XML2_FN (library, htmlReadMemory);
103 LOAD_XML2_FN (library, xmlReadMemory);
104 LOAD_XML2_FN (library, xmlDocGetRootElement);
105 LOAD_XML2_FN (library, xmlFreeDoc);
106 LOAD_XML2_FN (library, xmlCleanupParser);
107 LOAD_XML2_FN (library, xmlCheckVersion);
108
109 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache);
110 return 1;
111 }
112
113 bad_library:
114 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache);
115
116 return 0;
117#else /* !WINDOWSNT */
118 return 1;
119#endif /* !WINDOWSNT */
120}
121
31static Lisp_Object 122static Lisp_Object
32make_dom (xmlNode *node) 123make_dom (xmlNode *node)
33{ 124{
@@ -92,7 +183,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
92 EMACS_INT bytes; 183 EMACS_INT bytes;
93 EMACS_INT istart, iend; 184 EMACS_INT istart, iend;
94 185
95 LIBXML_TEST_VERSION; 186 fn_xmlCheckVersion (LIBXML_VERSION);
96 187
97 validate_region (&start, &end); 188 validate_region (&start, &end);
98 189
@@ -111,16 +202,16 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
111 bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart); 202 bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
112 203
113 if (htmlp) 204 if (htmlp)
114 doc = htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 205 doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
115 bytes, burl, "utf-8", 206 bytes, burl, "utf-8",
116 HTML_PARSE_RECOVER|HTML_PARSE_NONET| 207 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
117 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| 208 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
118 HTML_PARSE_NOBLANKS); 209 HTML_PARSE_NOBLANKS);
119 else 210 else
120 doc = xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 211 doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
121 bytes, burl, "utf-8", 212 bytes, burl, "utf-8",
122 XML_PARSE_NONET|XML_PARSE_NOWARNING| 213 XML_PARSE_NONET|XML_PARSE_NOWARNING|
123 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); 214 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
124 215
125 if (doc != NULL) 216 if (doc != NULL)
126 { 217 {
@@ -139,19 +230,26 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
139 if (NILP (result)) { 230 if (NILP (result)) {
140 /* The document isn't just comments, so get the tree the 231 /* The document isn't just comments, so get the tree the
141 proper way. */ 232 proper way. */
142 xmlNode *node = xmlDocGetRootElement (doc); 233 xmlNode *node = fn_xmlDocGetRootElement (doc);
143 if (node != NULL) 234 if (node != NULL)
144 result = make_dom (node); 235 result = make_dom (node);
145 } else 236 } else
146 result = Fcons (intern ("top"), 237 result = Fcons (intern ("top"),
147 Fcons (Qnil, Fnreverse (Fcons (r, result)))); 238 Fcons (Qnil, Fnreverse (Fcons (r, result))));
148 239
149 xmlFreeDoc (doc); 240 fn_xmlFreeDoc (doc);
150 } 241 }
151 242
152 return result; 243 return result;
153} 244}
154 245
246void
247xml_cleanup_parser (void)
248{
249 if (libxml2_loaded_p ())
250 fn_xmlCleanupParser ();
251}
252
155DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, 253DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
156 Slibxml_parse_html_region, 254 Slibxml_parse_html_region,
157 2, 3, 0, 255 2, 3, 0,
@@ -159,7 +257,9 @@ DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
159If BASE-URL is non-nil, it is used to expand relative URLs. */) 257If BASE-URL is non-nil, it is used to expand relative URLs. */)
160 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) 258 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
161{ 259{
162 return parse_region (start, end, base_url, 1); 260 if (init_libxml2_functions (Vdynamic_library_alist))
261 return parse_region (start, end, base_url, 1);
262 return Qnil;
163} 263}
164 264
165DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, 265DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
@@ -169,7 +269,9 @@ DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
169If BASE-URL is non-nil, it is used to expand relative URLs. */) 269If BASE-URL is non-nil, it is used to expand relative URLs. */)
170 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) 270 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
171{ 271{
172 return parse_region (start, end, base_url, 0); 272 if (init_libxml2_functions (Vdynamic_library_alist))
273 return parse_region (start, end, base_url, 0);
274 return Qnil;
173} 275}
174 276
175 277
@@ -181,6 +283,8 @@ syms_of_xml (void)
181{ 283{
182 defsubr (&Slibxml_parse_html_region); 284 defsubr (&Slibxml_parse_html_region);
183 defsubr (&Slibxml_parse_xml_region); 285 defsubr (&Slibxml_parse_xml_region);
286
287 DEFSYM (Qlibxml2_dll, "libxml2");
184} 288}
185 289
186#endif /* HAVE_LIBXML2 */ 290#endif /* HAVE_LIBXML2 */
diff --git a/src/xsettings.c b/src/xsettings.c
index 066c6e795e9..69ef22f55d7 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -1024,7 +1024,7 @@ syms_of_xsettings (void)
1024 defsubr (&Sfont_get_system_normal_font); 1024 defsubr (&Sfont_get_system_normal_font);
1025 1025
1026 DEFVAR_BOOL ("font-use-system-font", use_system_font, 1026 DEFVAR_BOOL ("font-use-system-font", use_system_font,
1027 doc: /* *Non-nil means to apply the system defined font dynamically. 1027 doc: /* Non-nil means to apply the system defined font dynamically.
1028When this is non-nil and the system defined fixed width font changes, we 1028When this is non-nil and the system defined fixed width font changes, we
1029update frames dynamically. 1029update frames dynamically.
1030If this variable is nil, Emacs ignores system font changes. */); 1030If this variable is nil, Emacs ignores system font changes. */);
diff --git a/src/xterm.c b/src/xterm.c
index 29d4dd453cb..289bd6a8b71 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10848,7 +10848,7 @@ syms_of_xterm (void)
10848 10848
10849 DEFVAR_BOOL ("x-use-underline-position-properties", 10849 DEFVAR_BOOL ("x-use-underline-position-properties",
10850 x_use_underline_position_properties, 10850 x_use_underline_position_properties,
10851 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. 10851 doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
10852A value of nil means ignore them. If you encounter fonts with bogus 10852A value of nil means ignore them. If you encounter fonts with bogus
10853UNDERLINE_POSITION font properties, for example 7x13 on XFree prior 10853UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
10854to 4.1, set this to nil. You can also use `underline-minimum-offset' 10854to 4.1, set this to nil. You can also use `underline-minimum-offset'
@@ -10858,7 +10858,7 @@ sizes. */);
10858 10858
10859 DEFVAR_BOOL ("x-underline-at-descent-line", 10859 DEFVAR_BOOL ("x-underline-at-descent-line",
10860 x_underline_at_descent_line, 10860 x_underline_at_descent_line,
10861 doc: /* *Non-nil means to draw the underline at the same place as the descent line. 10861 doc: /* Non-nil means to draw the underline at the same place as the descent line.
10862A value of nil means to draw the underline according to the value of the 10862A value of nil means to draw the underline according to the value of the
10863variable `x-use-underline-position-properties', which is usually at the 10863variable `x-use-underline-position-properties', which is usually at the
10864baseline level. The default value is nil. */); 10864baseline level. The default value is nil. */);