aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog77
-rw-r--r--src/ChangeLog.102
-rw-r--r--src/ChangeLog.86
-rw-r--r--src/Makefile.in10
-rw-r--r--src/buffer.c2
-rw-r--r--src/charset.c2
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c7
-rw-r--r--src/config.in3
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs.c4
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c141
-rw-r--r--src/lisp.h6
-rw-r--r--src/term.c1
-rw-r--r--src/xml.c141
-rw-r--r--src/xterm.c156
17 files changed, 340 insertions, 224 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5a248bacc03..d62215e4eef 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -3,6 +3,69 @@
3 * ftfont.c (ftfont_check_otf): Fix the case of checking just 3 * ftfont.c (ftfont_check_otf): Fix the case of checking just
4 existence of GSUB or GPOS. 4 existence of GSUB or GPOS.
5 5
62010-09-14 Juanma Barranquero <lekktu@gmail.com>
7
8 * cmds.c (syms_of_cmds) <post-self-insert-hook>: Fix typos in docstring.
9
102010-09-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
11
12 * xml.c (parse_buffer): Renamed to parse_string(), since that's
13 what it does.
14 (parse_string): Return nil when the document can't be parsed.
15
162010-09-14 Jan Djärv <jan.h.d@swipnet.se>
17
18 * xterm.c (get_current_vm_state): New function.
19 (do_ewmh_fullscreen): Call get_current_vm_state and compare with
20 want_fullscreen so set_wm_state calls are few (Bug#7013).
21 (x_handle_net_wm_state): Move code to get_current_vm_state and
22 call that function.
23
242010-09-14 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change)
25
26 * term.c (tty_set_terminal_modes): Don't initialize twice (bug#7002).
27
282010-09-14 Kenichi Handa <handa@m17n.org>
29
30 * coding.c (encode_coding_iso_2022): Don't optimize for ASCII if
31 we may use designation or locking-shift.
32
332010-09-14 Kenichi Handa <handa@m17n.org>
34
35 * coding.c (detect_coding_emacs_mule): Fix checking of multibyte
36 sequence when the source is multibyte.
37
382010-09-14 Andreas Schwab <schwab@linux-m68k.org>
39
40 * xml.c (Fxml_parse_string, Fxml_parse_string): Revert last change.
41 Don't make first argument optional. Doc fix.
42
432010-09-14 Leo <sdl.web@gmail.com> (tiny change)
44
45 * xml.c (Fxml_parse_string, Fhtml_parse_string): Fix up the
46 parameters for the doc string.
47
482010-09-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
49
50 * xml.c (Fhtml_parse_string, Fxml_parse_string): Mention BASE-URL.
51
522010-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
53
54 * fns.c (Fy_or_n_p): Move to lisp/subr.el.
55 (syms_of_fns): Don't defsubr Sy_or_n_p.
56 * lisp.h: Don't declare Fy_or_n_p.
57 * fileio.c (barf_or_query_if_file_exists): Fy_or_n_p -> y-or-n-p.
58
592010-09-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
60
61 * xml.c (Fxml_parse_buffer): New function to parse XML files.
62
632010-09-08 Lars Magne Ingebrigtsen <larsi@gnus.org>
64
65 * xml.c: New file.
66 (Fhtml_parse_buffer): New function to interface to the libxml2
67 html parsing function.
68
62010-09-05 Juanma Barranquero <lekktu@gmail.com> 692010-09-05 Juanma Barranquero <lekktu@gmail.com>
7 70
8 * biditype.h: Regenerate. 71 * biditype.h: Regenerate.
@@ -65,8 +128,8 @@
65 characters. 128 characters.
66 129
67 * term.c (encode_terminal_code): Fix the previous change. 130 * term.c (encode_terminal_code): Fix the previous change.
68 (produce_glyphs): Don't set it->char_to_display here. Don't 131 (produce_glyphs): Don't set it->char_to_display here.
69 handle unibyte-display-via-language-environment here. 132 Don't handle unibyte-display-via-language-environment here.
70 (produce_special_glyphs): Set temp_it.char_to_display before 133 (produce_special_glyphs): Set temp_it.char_to_display before
71 calling produce_glyphs. 134 calling produce_glyphs.
72 135
@@ -85,9 +148,9 @@
85 (produce_stretch_glyph): Set it2.char_to_display too before 148 (produce_stretch_glyph): Set it2.char_to_display too before
86 calling x_produce_glyphs. 149 calling x_produce_glyphs.
87 (x_produce_glyphs): Simplify by using the same code for ASCII and 150 (x_produce_glyphs): Simplify by using the same code for ASCII and
88 non-ASCII characters. Don't set it->char_to_display here. Don't 151 non-ASCII characters. Don't set it->char_to_display here.
89 handle unibyte-display-via-language-environment here. For a 152 Don't handle unibyte-display-via-language-environment here. For a
90 charater of no glyph, use font->space_width instead of FONT_WIDTH. 153 character of no glyph, use font->space_width instead of FONT_WIDTH.
91 154
922010-08-31 Stefan Monnier <monnier@iro.umontreal.ca> 1552010-08-31 Stefan Monnier <monnier@iro.umontreal.ca>
93 156
@@ -109,7 +172,7 @@
1092010-08-29 Kenichi Handa <handa@m17n.org> 1722010-08-29 Kenichi Handa <handa@m17n.org>
110 173
111 * term.c (encode_terminal_code): Encode byte chars to the 174 * term.c (encode_terminal_code): Encode byte chars to the
112 correspnding bytes. 175 corresponding bytes.
113 176
1142010-08-29 Jan Djärv <jan.h.d@swipnet.se> 1772010-08-29 Jan Djärv <jan.h.d@swipnet.se>
115 178
@@ -20249,7 +20312,7 @@
20249 20312
20250 * search.c (search_buffer): Give up BM search on case-fold-search 20313 * search.c (search_buffer): Give up BM search on case-fold-search
20251 if one of a target character has a case-equivalence of different 20314 if one of a target character has a case-equivalence of different
20252 byte length even if that target charcter is an ASCII. 20315 byte length even if that target character is an ASCII.
20253 (simple_search): Fix calculation of byte length of matched text. 20316 (simple_search): Fix calculation of byte length of matched text.
20254 (boyer_moore): Fix handling of case-equivalent multibyte characters. 20317 (boyer_moore): Fix handling of case-equivalent multibyte characters.
20255 20318
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index dd847f8a64e..14a0f012b06 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -6914,7 +6914,7 @@
6914 6914
6915 * search.c (search_buffer): Give up BM search on case-fold-search 6915 * search.c (search_buffer): Give up BM search on case-fold-search
6916 if one of a target character has a case-equivalence of different 6916 if one of a target character has a case-equivalence of different
6917 charset even if that target charcter is an ASCII. 6917 charset even if that target character is an ASCII.
6918 6918
6919 * casefiddle.c (casify_object): Fix for the case that case 6919 * casefiddle.c (casify_object): Fix for the case that case
6920 conversion change the byte length. 6920 conversion change the byte length.
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index 4dd3d0dd071..4dac2b262b7 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -13869,10 +13869,10 @@
138691998-08-31 Kenichi Handa <handa@etl.go.jp> 138691998-08-31 Kenichi Handa <handa@etl.go.jp>
13870 13870
13871 * charset.c (unibyte_char_to_multibyte): 13871 * charset.c (unibyte_char_to_multibyte):
13872 Vnonacii_translation_table will convert a 7-bit charcater. 13872 Vnonacii_translation_table will convert a 7-bit character.
13873 (multibyte_char_to_unibyte): Handle the case that 13873 (multibyte_char_to_unibyte): Handle the case that
13874 Vnonacii_translation_table converts a multibyte charcater to a 13874 Vnonacii_translation_table converts a multibyte character to a
13875 unibyte charcter of less than 128. 13875 unibyte character of less than 128.
13876 (init_charset_once): Initialize nonascii_insert_offset and 13876 (init_charset_once): Initialize nonascii_insert_offset and
13877 Vnonacii_translation_table. 13877 Vnonacii_translation_table.
13878 13878
diff --git a/src/Makefile.in b/src/Makefile.in
index 9ee5631ef70..d91b95d86e3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -226,6 +226,8 @@ RSVG_CFLAGS= @RSVG_CFLAGS@
226IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ 226IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
227IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ 227IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
228 228
229LIBXML2_LIBS = @LIBXML2_LIBS@
230LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
229 231
230## widget.o if USE_X_TOOLKIT, otherwise empty. 232## widget.o if USE_X_TOOLKIT, otherwise empty.
231WIDGET_OBJ=@WIDGET_OBJ@ 233WIDGET_OBJ=@WIDGET_OBJ@
@@ -320,7 +322,8 @@ MKDEPDIR=@MKDEPDIR@
320## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. 322## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
321ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ 323ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \
322 ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ 324 ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \
323 ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} \ 325 ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} \
326 ${LIBXML2_CFLAGS} ${DBUS_CFLAGS} \
324 ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ 327 ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \
325 ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ 328 ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \
326 ${C_WARNINGS_SWITCH} ${CFLAGS} 329 ${C_WARNINGS_SWITCH} ${CFLAGS}
@@ -349,7 +352,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
349 syntax.o $(UNEXEC_OBJ) bytecode.o \ 352 syntax.o $(UNEXEC_OBJ) bytecode.o \
350 process.o callproc.o \ 353 process.o callproc.o \
351 region-cache.o sound.o atimer.o \ 354 region-cache.o sound.o atimer.o \
352 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ 355 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o xml.o \
353 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) 356 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
354 357
355## Object files used on some machine or other. 358## Object files used on some machine or other.
@@ -595,7 +598,8 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
595## duplicated symbols. If the standard libraries were compiled 598## duplicated symbols. If the standard libraries were compiled
596## with GCC, we might need LIB_GCC again after them. 599## with GCC, we might need LIB_GCC again after them.
597LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ 600LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
598 $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 601 $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \
602 ${LIBXML2_LIBS} $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
599 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ 603 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
600 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 604 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
601 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 605 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
diff --git a/src/buffer.c b/src/buffer.c
index 39fabf581bb..84b60779b34 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2345,7 +2345,7 @@ current buffer is cleared. */)
2345 { 2345 {
2346 c = STRING_CHAR_AND_LENGTH (p, bytes); 2346 c = STRING_CHAR_AND_LENGTH (p, bytes);
2347 /* Delete all bytes for this 8-bit character but the 2347 /* Delete all bytes for this 8-bit character but the
2348 last one, and change the last one to the charcter 2348 last one, and change the last one to the character
2349 code. */ 2349 code. */
2350 bytes--; 2350 bytes--;
2351 del_range_2 (pos, pos, pos + bytes, pos + bytes, 0); 2351 del_range_2 (pos, pos, pos + bytes, pos + bytes, 0);
diff --git a/src/charset.c b/src/charset.c
index 036d7146db6..8051b11330e 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -427,7 +427,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
427 427
428 428
429/* Read a hexadecimal number (preceded by "0x") from the file FP while 429/* Read a hexadecimal number (preceded by "0x") from the file FP while
430 paying attention to comment charcter '#'. */ 430 paying attention to comment character '#'. */
431 431
432static INLINE unsigned 432static INLINE unsigned
433read_hex (FILE *fp, int *eof) 433read_hex (FILE *fp, int *eof)
diff --git a/src/cmds.c b/src/cmds.c
index f12e759b7a6..0e305e1fce4 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -524,7 +524,7 @@ syms_of_cmds (void)
524 524
525 DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook, 525 DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook,
526 doc: /* Hook run at the end of `self-insert-command'. 526 doc: /* Hook run at the end of `self-insert-command'.
527This run is run after inserting the charater. */); 527This is run after inserting the character. */);
528 Vpost_self_insert_hook = Qnil; 528 Vpost_self_insert_hook = Qnil;
529 529
530 defsubr (&Sforward_point); 530 defsubr (&Sforward_point);
diff --git a/src/coding.c b/src/coding.c
index 6012978b60a..d6285ed9245 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2008,7 +2008,7 @@ detect_coding_emacs_mule (struct coding_system *coding,
2008 } 2008 }
2009 else 2009 else
2010 { 2010 {
2011 int more_bytes = emacs_mule_bytes[*src_base] - 1; 2011 int more_bytes = emacs_mule_bytes[c] - 1;
2012 2012
2013 while (more_bytes > 0) 2013 while (more_bytes > 0)
2014 { 2014 {
@@ -4490,7 +4490,10 @@ encode_coding_iso_2022 (struct coding_system *coding)
4490 charset_list = CODING_ATTR_CHARSET_LIST (attrs); 4490 charset_list = CODING_ATTR_CHARSET_LIST (attrs);
4491 coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs)); 4491 coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs));
4492 4492
4493 ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); 4493 ascii_compatible
4494 = (! NILP (CODING_ATTR_ASCII_COMPAT (attrs))
4495 && ! (CODING_ISO_FLAGS (coding) & (CODING_ISO_FLAG_DESIGNATION
4496 | CODING_ISO_FLAG_LOCKING_SHIFT)));
4494 4497
4495 while (charbuf < charbuf_end) 4498 while (charbuf < charbuf_end)
4496 { 4499 {
diff --git a/src/config.in b/src/config.in
index 604a737a8b0..199afbd78ba 100644
--- a/src/config.in
+++ b/src/config.in
@@ -813,6 +813,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
813/* Define to 1 if you have the SM library (-lSM). */ 813/* Define to 1 if you have the SM library (-lSM). */
814#undef HAVE_X_SM 814#undef HAVE_X_SM
815 815
816/* Define to 1 if you have the libxml2 library (-lxml2). */
817#undef HAVE_LIBXML2
818
816/* Define to 1 if you want to use the X window system. */ 819/* Define to 1 if you want to use the X window system. */
817#undef HAVE_X_WINDOWS 820#undef HAVE_X_WINDOWS
818 821
diff --git a/src/editfns.c b/src/editfns.c
index 1bd6682c3b6..add2f37109b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3517,7 +3517,7 @@ usage: (format STRING &rest OBJECTS) */)
3517 int multibyte = 0; 3517 int multibyte = 0;
3518 /* When we make a multibyte string, we must pay attention to the 3518 /* When we make a multibyte string, we must pay attention to the
3519 byte combining problem, i.e., a byte may be combined with a 3519 byte combining problem, i.e., a byte may be combined with a
3520 multibyte charcter of the previous string. This flag tells if we 3520 multibyte character of the previous string. This flag tells if we
3521 must consider such a situation or not. */ 3521 must consider such a situation or not. */
3522 int maybe_combine_byte; 3522 int maybe_combine_byte;
3523 unsigned char *this_format; 3523 unsigned char *this_format;
diff --git a/src/emacs.c b/src/emacs.c
index 397d3d9ad27..33e0d60630b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1544,6 +1544,10 @@ main (int argc, char **argv)
1544#endif 1544#endif
1545#endif /* HAVE_X_WINDOWS */ 1545#endif /* HAVE_X_WINDOWS */
1546 1546
1547#ifdef HAVE_LIBXML2
1548 syms_of_xml ();
1549#endif
1550
1547 syms_of_menu (); 1551 syms_of_menu ();
1548 1552
1549#ifdef HAVE_NTGUI 1553#ifdef HAVE_NTGUI
diff --git a/src/fileio.c b/src/fileio.c
index a04cd4e76f5..3d08e881e8f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1842,7 +1842,7 @@ barf_or_query_if_file_exists (Lisp_Object absname, const unsigned char *querystr
1842 tem = format2 ("File %s already exists; %s anyway? ", 1842 tem = format2 ("File %s already exists; %s anyway? ",
1843 absname, build_string (querystring)); 1843 absname, build_string (querystring));
1844 if (quick) 1844 if (quick)
1845 tem = Fy_or_n_p (tem); 1845 tem = call1 (intern ("y-or-n-p"), tem);
1846 else 1846 else
1847 tem = do_yes_or_no_p (tem); 1847 tem = do_yes_or_no_p (tem);
1848 UNGCPRO; 1848 UNGCPRO;
diff --git a/src/fns.c b/src/fns.c
index 12d13186ce7..19590a2140d 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2444,146 +2444,6 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string. */)
2444 return sequence; 2444 return sequence;
2445} 2445}
2446 2446
2447/* Anything that calls this function must protect from GC! */
2448
2449DEFUN ("y-or-n-p", Fy_or_n_p, Sy_or_n_p, 1, 1, 0,
2450 doc: /* Ask user a "y or n" question. Return t if answer is "y".
2451Takes one argument, which is the string to display to ask the question.
2452It should end in a space; `y-or-n-p' adds `(y or n) ' to it.
2453No confirmation of the answer is requested; a single character is enough.
2454Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses
2455the bindings in `query-replace-map'; see the documentation of that variable
2456for more information. In this case, the useful bindings are `act', `skip',
2457`recenter', and `quit'.\)
2458
2459Under a windowing system a dialog box will be used if `last-nonmenu-event'
2460is nil and `use-dialog-box' is non-nil. */)
2461 (Lisp_Object prompt)
2462{
2463 register Lisp_Object obj, key, def, map;
2464 register int answer;
2465 Lisp_Object xprompt;
2466 Lisp_Object args[2];
2467 struct gcpro gcpro1, gcpro2;
2468 int count = SPECPDL_INDEX ();
2469
2470 specbind (Qcursor_in_echo_area, Qt);
2471
2472 map = Fsymbol_value (intern ("query-replace-map"));
2473
2474 CHECK_STRING (prompt);
2475 xprompt = prompt;
2476 GCPRO2 (prompt, xprompt);
2477
2478#ifdef HAVE_WINDOW_SYSTEM
2479 if (display_hourglass_p)
2480 cancel_hourglass ();
2481#endif
2482
2483 while (1)
2484 {
2485
2486#ifdef HAVE_MENUS
2487 if (FRAME_WINDOW_P (SELECTED_FRAME ())
2488 && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
2489 && use_dialog_box
2490 && have_menus_p ())
2491 {
2492 Lisp_Object pane, menu;
2493 redisplay_preserve_echo_area (3);
2494 pane = Fcons (Fcons (build_string ("Yes"), Qt),
2495 Fcons (Fcons (build_string ("No"), Qnil),
2496 Qnil));
2497 menu = Fcons (prompt, pane);
2498 obj = Fx_popup_dialog (Qt, menu, Qnil);
2499 answer = !NILP (obj);
2500 break;
2501 }
2502#endif /* HAVE_MENUS */
2503 cursor_in_echo_area = 1;
2504 choose_minibuf_frame ();
2505
2506 {
2507 Lisp_Object pargs[3];
2508
2509 /* Colorize prompt according to `minibuffer-prompt' face. */
2510 pargs[0] = build_string ("%s(y or n) ");
2511 pargs[1] = intern ("face");
2512 pargs[2] = intern ("minibuffer-prompt");
2513 args[0] = Fpropertize (3, pargs);
2514 args[1] = xprompt;
2515 Fmessage (2, args);
2516 }
2517
2518 if (minibuffer_auto_raise)
2519 {
2520 Lisp_Object mini_frame;
2521
2522 mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
2523
2524 Fraise_frame (mini_frame);
2525 }
2526
2527 temporarily_switch_to_single_kboard (SELECTED_FRAME ());
2528 obj = read_filtered_event (1, 0, 0, 0, Qnil);
2529 cursor_in_echo_area = 0;
2530 /* If we need to quit, quit with cursor_in_echo_area = 0. */
2531 QUIT;
2532
2533 key = Fmake_vector (make_number (1), obj);
2534 def = Flookup_key (map, key, Qt);
2535
2536 if (EQ (def, intern ("skip")))
2537 {
2538 answer = 0;
2539 break;
2540 }
2541 else if (EQ (def, intern ("act")))
2542 {
2543 answer = 1;
2544 break;
2545 }
2546 else if (EQ (def, intern ("recenter")))
2547 {
2548 Frecenter (Qnil);
2549 xprompt = prompt;
2550 continue;
2551 }
2552 else if (EQ (def, intern ("quit")))
2553 Vquit_flag = Qt;
2554 /* We want to exit this command for exit-prefix,
2555 and this is the only way to do it. */
2556 else if (EQ (def, intern ("exit-prefix")))
2557 Vquit_flag = Qt;
2558
2559 QUIT;
2560
2561 /* If we don't clear this, then the next call to read_char will
2562 return quit_char again, and we'll enter an infinite loop. */
2563 Vquit_flag = Qnil;
2564
2565 Fding (Qnil);
2566 Fdiscard_input ();
2567 if (EQ (xprompt, prompt))
2568 {
2569 args[0] = build_string ("Please answer y or n. ");
2570 args[1] = prompt;
2571 xprompt = Fconcat (2, args);
2572 }
2573 }
2574 UNGCPRO;
2575
2576 if (! noninteractive)
2577 {
2578 cursor_in_echo_area = -1;
2579 message_with_string (answer ? "%s(y or n) y" : "%s(y or n) n",
2580 xprompt, 0);
2581 }
2582
2583 unbind_to (count, Qnil);
2584 return answer ? Qt : Qnil;
2585}
2586
2587/* This is how C code calls `yes-or-no-p' and allows the user 2447/* This is how C code calls `yes-or-no-p' and allows the user
2588 to redefined it. 2448 to redefined it.
2589 2449
@@ -5058,7 +4918,6 @@ this variable. */);
5058 defsubr (&Smapcar); 4918 defsubr (&Smapcar);
5059 defsubr (&Smapc); 4919 defsubr (&Smapc);
5060 defsubr (&Smapconcat); 4920 defsubr (&Smapconcat);
5061 defsubr (&Sy_or_n_p);
5062 defsubr (&Syes_or_no_p); 4921 defsubr (&Syes_or_no_p);
5063 defsubr (&Sload_average); 4922 defsubr (&Sload_average);
5064 defsubr (&Sfeaturep); 4923 defsubr (&Sfeaturep);
diff --git a/src/lisp.h b/src/lisp.h
index 89514bf9ecb..781261d9779 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2516,7 +2516,6 @@ EXFUN (Ffillarray, 2);
2516EXFUN (Fnconc, MANY); 2516EXFUN (Fnconc, MANY);
2517EXFUN (Fmapcar, 2); 2517EXFUN (Fmapcar, 2);
2518EXFUN (Fmapconcat, 3); 2518EXFUN (Fmapconcat, 3);
2519EXFUN (Fy_or_n_p, 1);
2520extern Lisp_Object do_yes_or_no_p (Lisp_Object); 2519extern Lisp_Object do_yes_or_no_p (Lisp_Object);
2521EXFUN (Frequire, 3); 2520EXFUN (Frequire, 3);
2522EXFUN (Fprovide, 2); 2521EXFUN (Fprovide, 2);
@@ -3577,6 +3576,11 @@ extern char *x_get_keysym_name (int);
3577EXFUN (Fmsdos_downcase_filename, 1); 3576EXFUN (Fmsdos_downcase_filename, 1);
3578#endif 3577#endif
3579 3578
3579#ifdef HAVE_LIBXML2
3580/* Defined in xml.c */
3581extern void syms_of_xml (void);
3582#endif
3583
3580#ifdef HAVE_MENUS 3584#ifdef HAVE_MENUS
3581/* Defined in (x|w32)fns.c, nsfns.m... */ 3585/* Defined in (x|w32)fns.c, nsfns.m... */
3582extern int have_menus_p (void); 3586extern int have_menus_p (void);
diff --git a/src/term.c b/src/term.c
index f090cdd2792..2deca1014e8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -247,7 +247,6 @@ tty_set_terminal_modes (struct terminal *terminal)
247 cmputc ('\n'); 247 cmputc ('\n');
248 } 248 }
249 249
250 OUTPUT_IF (tty, tty->TS_termcap_modes);
251 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal); 250 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
252 OUTPUT_IF (tty, tty->TS_keypad_mode); 251 OUTPUT_IF (tty, tty->TS_keypad_mode);
253 losecursor (tty); 252 losecursor (tty);
diff --git a/src/xml.c b/src/xml.c
new file mode 100644
index 00000000000..ddecabb5317
--- /dev/null
+++ b/src/xml.c
@@ -0,0 +1,141 @@
1/* Interface to libxml2.
2 Copyright (C) 2010 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18
19#include <config.h>
20
21#ifdef HAVE_LIBXML2
22
23#include <setjmp.h>
24#include <libxml/tree.h>
25#include <libxml/parser.h>
26#include <libxml/HTMLparser.h>
27
28#include "lisp.h"
29#include "buffer.h"
30
31Lisp_Object make_dom (xmlNode *node)
32{
33 if (node->type == XML_ELEMENT_NODE) {
34 Lisp_Object result = Fcons (intern (node->name), Qnil);
35 xmlNode *child;
36 xmlAttr *property;
37
38 /* First add the attributes. */
39 property = node->properties;
40 while (property != NULL) {
41 if (property->children &&
42 property->children->content) {
43 char *pname = xmalloc (strlen (property->name) + 2);
44 *pname = ':';
45 strcpy(pname + 1, property->name);
46 result = Fcons (Fcons (intern (pname),
47 build_string(property->children->content)),
48 result);
49 xfree (pname);
50 }
51 property = property->next;
52 }
53 /* Then add the children of the node. */
54 child = node->children;
55 while (child != NULL) {
56 result = Fcons (make_dom (child), result);
57 child = child->next;
58 }
59 return Fnreverse (result);
60 } else if (node->type == XML_TEXT_NODE) {
61 Lisp_Object content = Qnil;
62
63 if (node->content)
64 content = build_string (node->content);
65
66 return Fcons (intern (node->name), content);
67 } else
68 return Qnil;
69}
70
71static Lisp_Object
72parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp)
73{
74 xmlDoc *doc;
75 xmlNode *node;
76 Lisp_Object result = Qnil;
77 int ibeg, iend;
78 char *burl = "";
79
80 LIBXML_TEST_VERSION;
81
82 CHECK_STRING (string);
83
84 if (! NILP (base_url)) {
85 CHECK_STRING (base_url);
86 burl = SDATA (base_url);
87 }
88
89 if (htmlp)
90 doc = htmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8",
91 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
92 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR);
93 else
94 doc = xmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8",
95 XML_PARSE_NONET|XML_PARSE_NOWARNING|
96 XML_PARSE_NOERROR);
97
98 if (doc != NULL) {
99 node = xmlDocGetRootElement (doc);
100 if (node != NULL)
101 result = make_dom (node);
102
103 xmlFreeDoc (doc);
104 xmlCleanupParser ();
105 }
106
107 return result;
108}
109
110DEFUN ("html-parse-string", Fhtml_parse_string, Shtml_parse_string,
111 1, 2, 0,
112 doc: /* Parse STRING as an HTML document and return the parse tree.
113If BASE-URL is non-nil, it will be used to expand relative URLs in
114the HTML document. */)
115 (Lisp_Object string, Lisp_Object base_url)
116{
117 return parse_string (string, base_url, 1);
118}
119
120DEFUN ("xml-parse-string", Fxml_parse_string, Sxml_parse_string,
121 1, 2, 0,
122 doc: /* Parse STRING as an XML document and return the parse tree.
123If BASE-URL is non-nil, it will be used to expand relative URLs in
124the XML document. */)
125 (Lisp_Object string, Lisp_Object base_url)
126{
127 return parse_string (string, base_url, 0);
128}
129
130
131/***********************************************************************
132 Initialization
133 ***********************************************************************/
134void
135syms_of_xml (void)
136{
137 defsubr (&Shtml_parse_string);
138 defsubr (&Sxml_parse_string);
139}
140
141#endif /* HAVE_LIBXML2 */
diff --git a/src/xterm.c b/src/xterm.c
index 2ebe8a80378..c1d1aada530 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8285,19 +8285,89 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8285 "_NET_WM_STATE_STICKY", NULL); 8285 "_NET_WM_STATE_STICKY", NULL);
8286} 8286}
8287 8287
8288/* Return the current _NET_WM_STATE.
8289 SIZE_STATE is set to one of the FULLSCREEN_* values.
8290 STICKY is set to 1 if the sticky state is set, 0 if not. */
8291
8292static void
8293get_current_vm_state (struct frame *f,
8294 Window window,
8295 int *size_state,
8296 int *sticky)
8297{
8298 Atom actual_type;
8299 unsigned long actual_size, bytes_remaining;
8300 int i, rc, actual_format;
8301 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8302 long max_len = 65536;
8303 Display *dpy = FRAME_X_DISPLAY (f);
8304 unsigned char *tmp_data = NULL;
8305 Atom target_type = XA_ATOM;
8306
8307 *sticky = 0;
8308 *size_state = FULLSCREEN_NONE;
8309
8310 BLOCK_INPUT;
8311 x_catch_errors (dpy);
8312 rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state,
8313 0, max_len, False, target_type,
8314 &actual_type, &actual_format, &actual_size,
8315 &bytes_remaining, &tmp_data);
8316
8317 if (rc != Success || actual_type != target_type || x_had_errors_p (dpy))
8318 {
8319 if (tmp_data) XFree (tmp_data);
8320 x_uncatch_errors ();
8321 UNBLOCK_INPUT;
8322 return;
8323 }
8324
8325 x_uncatch_errors ();
8326
8327 for (i = 0; i < actual_size; ++i)
8328 {
8329 Atom a = ((Atom*)tmp_data)[i];
8330 if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
8331 {
8332 if (*size_state == FULLSCREEN_HEIGHT)
8333 *size_state = FULLSCREEN_MAXIMIZED;
8334 else
8335 *size_state = FULLSCREEN_WIDTH;
8336 }
8337 else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert)
8338 {
8339 if (*size_state == FULLSCREEN_WIDTH)
8340 *size_state = FULLSCREEN_MAXIMIZED;
8341 else
8342 *size_state = FULLSCREEN_HEIGHT;
8343 }
8344 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom)
8345 *size_state = FULLSCREEN_BOTH;
8346 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
8347 *sticky = 1;
8348 }
8349
8350 if (tmp_data) XFree (tmp_data);
8351 UNBLOCK_INPUT;
8352}
8353
8288/* Do fullscreen as specified in extended window manager hints */ 8354/* Do fullscreen as specified in extended window manager hints */
8289 8355
8290static int 8356static int
8291do_ewmh_fullscreen (struct frame *f) 8357do_ewmh_fullscreen (struct frame *f)
8292{ 8358{
8293 int have_net_atom = wm_supports (f, "_NET_WM_STATE"); 8359 int have_net_atom = wm_supports (f, "_NET_WM_STATE");
8360 Lisp_Object lval = get_frame_param (f, Qfullscreen);
8361 int cur, dummy;
8362
8363 get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
8294 8364
8295 /* Some window managers don't say they support _NET_WM_STATE, but they do say 8365 /* Some window managers don't say they support _NET_WM_STATE, but they do say
8296 they support _NET_WM_STATE_FULLSCREEN. Try that also. */ 8366 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
8297 if (!have_net_atom) 8367 if (!have_net_atom)
8298 have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); 8368 have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN");
8299 8369
8300 if (have_net_atom) 8370 if (have_net_atom && cur != f->want_fullscreen)
8301 { 8371 {
8302 Lisp_Object frame; 8372 Lisp_Object frame;
8303 const char *fs = "_NET_WM_STATE_FULLSCREEN"; 8373 const char *fs = "_NET_WM_STATE_FULLSCREEN";
@@ -8306,26 +8376,41 @@ do_ewmh_fullscreen (struct frame *f)
8306 8376
8307 XSETFRAME (frame, f); 8377 XSETFRAME (frame, f);
8308 8378
8309 set_wm_state (frame, 0, fs, NULL); 8379 /* Keep number of calls to set_wm_state as low as possible.
8310 set_wm_state (frame, 0, fh, NULL); 8380 Some window managers, or possible Gtk+, hangs when too many
8311 set_wm_state (frame, 0, fw, NULL); 8381 are sent at once. */
8312
8313 /* If there are _NET_ atoms we assume we have extended window manager
8314 hints. */
8315 switch (f->want_fullscreen) 8382 switch (f->want_fullscreen)
8316 { 8383 {
8317 case FULLSCREEN_BOTH: 8384 case FULLSCREEN_BOTH:
8385 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
8386 || cur == FULLSCREEN_HEIGHT)
8387 set_wm_state (frame, 0, fw, fh);
8318 set_wm_state (frame, 1, fs, NULL); 8388 set_wm_state (frame, 1, fs, NULL);
8319 break; 8389 break;
8320 case FULLSCREEN_WIDTH: 8390 case FULLSCREEN_WIDTH:
8321 set_wm_state (frame, 1, fw, NULL); 8391 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
8392 || cur == FULLSCREEN_MAXIMIZED)
8393 set_wm_state (frame, 0, fs, fh);
8394 if (cur != FULLSCREEN_MAXIMIZED)
8395 set_wm_state (frame, 1, fw, NULL);
8322 break; 8396 break;
8323 case FULLSCREEN_HEIGHT: 8397 case FULLSCREEN_HEIGHT:
8324 set_wm_state (frame, 1, fh, NULL); 8398 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
8399 || cur == FULLSCREEN_MAXIMIZED)
8400 set_wm_state (frame, 0, fs, fw);
8401 if (cur != FULLSCREEN_MAXIMIZED)
8402 set_wm_state (frame, 1, fh, NULL);
8325 break; 8403 break;
8326 case FULLSCREEN_MAXIMIZED: 8404 case FULLSCREEN_MAXIMIZED:
8405 if (cur == FULLSCREEN_BOTH)
8406 set_wm_state (frame, 0, fs, NULL);
8327 set_wm_state (frame, 1, fw, fh); 8407 set_wm_state (frame, 1, fw, fh);
8328 break; 8408 break;
8409 case FULLSCREEN_NONE:
8410 if (cur == FULLSCREEN_BOTH)
8411 set_wm_state (frame, 0, fs, NULL);
8412 else
8413 set_wm_state (frame, 0, fw, fh);
8329 } 8414 }
8330 8415
8331 f->want_fullscreen = FULLSCREEN_NONE; 8416 f->want_fullscreen = FULLSCREEN_NONE;
@@ -8351,57 +8436,11 @@ XTfullscreen_hook (FRAME_PTR f)
8351static void 8436static void
8352x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) 8437x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8353{ 8438{
8354 Atom actual_type; 8439 int value = FULLSCREEN_NONE;
8355 unsigned long actual_size, bytes_remaining;
8356 int i, rc, actual_format, value = FULLSCREEN_NONE;
8357 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8358 long max_len = 65536;
8359 Display *dpy = FRAME_X_DISPLAY (f);
8360 unsigned char *tmp_data = NULL;
8361 Atom target_type = XA_ATOM;
8362 Lisp_Object lval; 8440 Lisp_Object lval;
8363 int sticky = 0; 8441 int sticky = 0;
8364 8442
8365 BLOCK_INPUT; 8443 get_current_vm_state (f, event->window, &value, &sticky);
8366 x_catch_errors (dpy);
8367 rc = XGetWindowProperty (dpy, event->window,
8368 event->atom, 0, max_len, False, target_type,
8369 &actual_type, &actual_format, &actual_size,
8370 &bytes_remaining, &tmp_data);
8371
8372 if (rc != Success || actual_type != target_type || x_had_errors_p (dpy))
8373 {
8374 if (tmp_data) XFree (tmp_data);
8375 x_uncatch_errors ();
8376 UNBLOCK_INPUT;
8377 return;
8378 }
8379
8380 x_uncatch_errors ();
8381
8382 for (i = 0; i < actual_size; ++i)
8383 {
8384 Atom a = ((Atom*)tmp_data)[i];
8385 if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
8386 {
8387 if (value == FULLSCREEN_HEIGHT)
8388 value = FULLSCREEN_MAXIMIZED;
8389 else
8390 value = FULLSCREEN_WIDTH;
8391 }
8392 else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert)
8393 {
8394 if (value == FULLSCREEN_WIDTH)
8395 value = FULLSCREEN_MAXIMIZED;
8396 else
8397 value = FULLSCREEN_HEIGHT;
8398 }
8399 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom)
8400 value = FULLSCREEN_BOTH;
8401 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
8402 sticky = 1;
8403 }
8404
8405 lval = Qnil; 8444 lval = Qnil;
8406 switch (value) 8445 switch (value)
8407 { 8446 {
@@ -8421,9 +8460,6 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8421 8460
8422 store_frame_param (f, Qfullscreen, lval); 8461 store_frame_param (f, Qfullscreen, lval);
8423 store_frame_param (f, Qsticky, sticky ? Qt : Qnil); 8462 store_frame_param (f, Qsticky, sticky ? Qt : Qnil);
8424
8425 if (tmp_data) XFree (tmp_data);
8426 UNBLOCK_INPUT;
8427} 8463}
8428 8464
8429/* Check if we need to resize the frame due to a fullscreen request. 8465/* Check if we need to resize the frame due to a fullscreen request.