aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-06-07 08:00:27 +0000
committerKaroly Lorentey2004-06-07 08:00:27 +0000
commit620c7a273359e1b13adee5896933ce9fa122c860 (patch)
tree8f521c5cec6811ff47163f3bbd96e2eb02020658 /src
parentc98e2d50e4f0f0eaf69520092cb94531545b221d (diff)
parenta0a2334679b7278ca0577a733c8ba8d0362a1a38 (diff)
downloademacs-620c7a273359e1b13adee5896933ce9fa122c860.tar.gz
emacs-620c7a273359e1b13adee5896933ce9fa122c860.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377 (Fdisplay_supports_face_attributes_p): Work around bootstrapping problem * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-379 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381 Face merging cleanups git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-190
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog83
-rw-r--r--src/coding.c34
-rw-r--r--src/keymap.c7
-rw-r--r--src/macfns.c10
-rw-r--r--src/minibuf.c2
-rw-r--r--src/process.c39
-rw-r--r--src/xfaces.c295
7 files changed, 287 insertions, 183 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d9000d6dd05..0770eaeff69 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,62 @@
12004-06-07 Miles Bader <miles@gnu.org>
2
3 * (struct named_merge_point): New type.
4 (push_named_merge_point): New function.
5 (merge_named_face): New function.
6 (merge_face_ref, face_at_buffer_position, face_at_string_position):
7 Use `merge_named_face'.
8 (merge_face_inheritance): Function removed.
9 (merge_face_ref): Renamed from `merge_face_vector_with_property'.
10 Add new `err_msgs' and `named_merge_points' args. Return error
11 status. Only print error messages if ERR_MSGS is true. Don't try to
12 do :inherit attribute validation.
13 (merge_face_heights): Handle `unspecified' in both directions.
14 (merge_face_vectors): Rename `cycle_check' arg to `named_merge_points'.
15 Call `merge_face_ref' instead of `merge_face_inheritance'.
16 (Fdisplay_supports_face_attributes_p, Fface_attributes_as_vector)
17 (compute_char_face, face_at_buffer_position)
18 (face_at_string_position): Call `merge_face_ref' instead of
19 `merge_face_vector_with_property'.
20
212004-06-07 Kenichi Handa <handa@m17n.org>
22
23 * coding.c (find_safe_codings): Check NILP (safe_codings) only at
24 the necessary places.
25
262004-06-07 Kim F. Storm <storm@cua.dk>
27
28 * process.c (Fdelete_process): Undo 2004-05-28 change.
29 Instead, call status_notify also for network process.
30 (status_message): Use process instead of status as arg.
31 Give messages "deleted" or "connection broken by remote peer" for
32 an exited network process.
33 (status_notify): Change call to status_message.
34 (read_process_output): Increase readmax to 4096. Do not increase
35 buffer size for datagram channels (default is now large enough).
36
372004-06-06 Steven Tamm <tamm@Steven-Tamms-Computer.local>
38
39 * macfns.c (x_create_tip_frame): Fix Mac OS X 10.1 compilation
40 problem due to newly defined variable.
41
422004-06-06 Miles Bader <miles@gnu.org>
43
44 * xfaces.c (Fdisplay_supports_face_attributes_p): Give up
45 immediately if non-interactive or not initialized.
46
472004-06-05 Richard M. Stallman <rms@gnu.org>
48
49 * minibuf.c (Fcompleting_read): Doc fix.
50
512004-06-05 Andreas Schwab <schwab@suse.de>
52
53 * macfns.c (x_create_tip_frame): Fix declaration after statement.
54
552004-06-05 Juanma Barranquero <lektu@terra.es>
56
57 * keymap.c (Fdescribe_vector): Fix docstring.
58 (Fkey_description, Fglobal_key_binding): Fix typo in docstring.
59
12004-06-05 Miles Bader <miles@gnu.org> 602004-06-05 Miles Bader <miles@gnu.org>
2 61
3 * xfaces.c (tty_supports_face_attributes_p): Make sure the specified 62 * xfaces.c (tty_supports_face_attributes_p): Make sure the specified
@@ -18,7 +77,7 @@
18 (Ftty_supports_face_attributes_p): Function deleted. 77 (Ftty_supports_face_attributes_p): Function deleted.
19 (Fdisplay_supports_face_attributes_p): New function. 78 (Fdisplay_supports_face_attributes_p): New function.
20 (syms_of_xfaces): Initialize Sdisplay_supports_face_attributes_p. 79 (syms_of_xfaces): Initialize Sdisplay_supports_face_attributes_p.
21 (face_attr_equal_p): New function 80 (face_attr_equal_p): New function.
22 (lface_equal_p): Use it. 81 (lface_equal_p): Use it.
23 82
242004-06-03 Juanma Barranquero <lektu@terra.es> 832004-06-03 Juanma Barranquero <lektu@terra.es>
@@ -3828,7 +3887,7 @@
3828 3887
38292003-07-09 Kim F. Storm <storm@cua.dk> 38882003-07-09 Kim F. Storm <storm@cua.dk>
3830 3889
3831 * xterm.c (use_xim) [!USE_XIM]: Default to disable XIM if emacs 3890 * xterm.c (use_xim) [!USE_XIM]: Default to disable XIM if Emacs
3832 was configured with --without-xim. 3891 was configured with --without-xim.
3833 (x_term_init) [!USE_XIM]: Use `useXIM' resource to turn on XIM. 3892 (x_term_init) [!USE_XIM]: Use `useXIM' resource to turn on XIM.
3834 3893
@@ -4685,7 +4744,7 @@
4685 window to only preserve the display margins in one of the windows. 4744 window to only preserve the display margins in one of the windows.
4686 When splitting horizontally, call adjust_window_margins on both 4745 When splitting horizontally, call adjust_window_margins on both
4687 windows to ensure that the text area of the new windows is non too 4746 windows to ensure that the text area of the new windows is non too
4688 narrow. This fixes a bug which could cause emacs to trap if the 4747 narrow. This fixes a bug which could cause Emacs to trap if the
4689 width of the split window was less than the width of the display 4748 width of the split window was less than the width of the display
4690 margins. 4749 margins.
4691 (window_box_text_cols): Renamed from window_internal_width. 4750 (window_box_text_cols): Renamed from window_internal_width.
@@ -4716,7 +4775,7 @@
4716 (Fset_window_margins): Do nothing if display margins are not 4775 (Fset_window_margins): Do nothing if display margins are not
4717 really changed. Otherwise, call adjust_window_margins to ensure 4776 really changed. Otherwise, call adjust_window_margins to ensure
4718 the text area doesn't get too narrow. This fixes a bug which 4777 the text area doesn't get too narrow. This fixes a bug which
4719 could cause emacs to trap if setting display margins wider than 4778 could cause Emacs to trap if setting display margins wider than
4720 the width of the window. 4779 the width of the window.
4721 (Fset_window_fringes): New defun to allow user to specifically set 4780 (Fset_window_fringes): New defun to allow user to specifically set
4722 this window's fringe widths and position vs. display margins. 4781 this window's fringe widths and position vs. display margins.
@@ -7990,7 +8049,7 @@
7990 * process.c (Fformat_network_address): New function. 8049 * process.c (Fformat_network_address): New function.
7991 (syms_of_process): Defsubr it. 8050 (syms_of_process): Defsubr it.
7992 (list_processes_1): Use it to format :local/:remote address if 8051 (list_processes_1): Use it to format :local/:remote address if
7993 service/host is not set; before emacs would crash in that case. 8052 service/host is not set; before Emacs would crash in that case.
7994 (Fmake_network_process): Don't use Ffind_operation_coding_system 8053 (Fmake_network_process): Don't use Ffind_operation_coding_system
7995 to setup coding system if host or service is not set. 8054 to setup coding system if host or service is not set.
7996 8055
@@ -9288,11 +9347,11 @@
92882002-07-11 Juanma Barranquero <lektu@terra.es> 93472002-07-11 Juanma Barranquero <lektu@terra.es>
9289 9348
9290 * alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, coding.c, 9349 * alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, coding.c,
9291 composite.c, dired.c, dispnew.c, editfns.c, emacs.c, eval.c, 9350 * composite.c, dired.c, dispnew.c, editfns.c, emacs.c, eval.c,
9292 fileio.c, fns.c, insdel.c, keyboard.c, keymap.c, lread.c, macfns.c, 9351 * fileio.c, fns.c, insdel.c, keyboard.c, keymap.c, lread.c, macfns.c,
9293 macmenu.c, macros.c, minibuf.c, print.c, process.c, sound.c, 9352 * macmenu.c, macros.c, minibuf.c, print.c, process.c, sound.c,
9294 textprop.c, w32fns.c, w32menu.c, window.c, xfaces.c, xfns.c, 9353 * textprop.c, w32fns.c, w32menu.c, window.c, xfaces.c, xfns.c,
9295 xmenu.c, xselect.c, xterm.c: Use SPECPDL_INDEX wherever makes sense. 9354 * xmenu.c, xselect.c, xterm.c: Use SPECPDL_INDEX wherever makes sense.
9296 9355
92972002-07-10 Juanma Barranquero <lektu@terra.es> 93562002-07-10 Juanma Barranquero <lektu@terra.es>
9298 9357
@@ -12315,7 +12374,7 @@
123152001-12-14 Andrew Innes <andrewi@gnu.org> 123742001-12-14 Andrew Innes <andrewi@gnu.org>
12316 12375
12317 * makefile.w32-in (EMACSLOADPATH): Define. 12376 * makefile.w32-in (EMACSLOADPATH): Define.
12318 ($(EMACS)): Run `list-load-path-shadows' after dumping emacs. 12377 ($(EMACS)): Run `list-load-path-shadows' after dumping Emacs.
12319 (bootstrap-temacs): Remove dependency on bootstrap-clean. 12378 (bootstrap-temacs): Remove dependency on bootstrap-clean.
12320 12379
123212001-12-13 Eli Zaretskii <eliz@is.elta.co.il> 123802001-12-13 Eli Zaretskii <eliz@is.elta.co.il>
@@ -13612,7 +13671,7 @@
13612 13671
136132001-10-28 Pavel Jan,Am(Bk <Pavel@Janik.cz> 136722001-10-28 Pavel Jan,Am(Bk <Pavel@Janik.cz>
13614 13673
13615 * emacs.c: Use argv[0] instead of emacs when -t was specified. 13674 * emacs.c: Use argv[0] instead of "emacs" when -t was specified.
13616 13675
13617 * keyboard.c: Change doc-string comments to `new style' [w/`doc:' 13676 * keyboard.c: Change doc-string comments to `new style' [w/`doc:'
13618 keyword]. 13677 keyword].
diff --git a/src/coding.c b/src/coding.c
index 7e90b985143..328507de499 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6566,8 +6566,8 @@ highest priority. */)
6566 possible coding systems. If it is nil, it means that we have not 6566 possible coding systems. If it is nil, it means that we have not
6567 yet found any coding systems. 6567 yet found any coding systems.
6568 6568
6569 WORK_TABLE is a copy of the char-table Vchar_coding_system_table. An 6569 WORK_TABLE a char-table of which element is set to t once the
6570 element of WORK_TABLE is set to t once the element is looked up. 6570 element is looked up.
6571 6571
6572 If a non-ASCII single byte char is found, set 6572 If a non-ASCII single byte char is found, set
6573 *single_byte_char_found to 1. */ 6573 *single_byte_char_found to 1. */
@@ -6582,6 +6582,8 @@ find_safe_codings (p, pend, safe_codings, work_table, single_byte_char_found)
6582 Lisp_Object val, ch; 6582 Lisp_Object val, ch;
6583 Lisp_Object prev, tail; 6583 Lisp_Object prev, tail;
6584 6584
6585 if (NILP (safe_codings))
6586 goto done_safe_codings;
6585 while (p < pend) 6587 while (p < pend)
6586 { 6588 {
6587 c = STRING_CHAR_AND_LENGTH (p, pend - p, len); 6589 c = STRING_CHAR_AND_LENGTH (p, pend - p, len);
@@ -6591,11 +6593,6 @@ find_safe_codings (p, pend, safe_codings, work_table, single_byte_char_found)
6591 continue; 6593 continue;
6592 if (SINGLE_BYTE_CHAR_P (c)) 6594 if (SINGLE_BYTE_CHAR_P (c))
6593 *single_byte_char_found = 1; 6595 *single_byte_char_found = 1;
6594 if (NILP (safe_codings))
6595 /* Already all coding systems are excluded. But, we can't
6596 terminate the loop here because non-ASCII single-byte char
6597 must be found. */
6598 continue;
6599 /* Check the safe coding systems for C. */ 6596 /* Check the safe coding systems for C. */
6600 ch = make_number (c); 6597 ch = make_number (c);
6601 val = Faref (work_table, ch); 6598 val = Faref (work_table, ch);
@@ -6673,12 +6670,33 @@ find_safe_codings (p, pend, safe_codings, work_table, single_byte_char_found)
6673 { 6670 {
6674 /* Exclude this coding system from SAFE_CODINGS. */ 6671 /* Exclude this coding system from SAFE_CODINGS. */
6675 if (EQ (tail, safe_codings)) 6672 if (EQ (tail, safe_codings))
6676 safe_codings = XCDR (safe_codings); 6673 {
6674 safe_codings = XCDR (safe_codings);
6675 if (NILP (safe_codings))
6676 goto done_safe_codings;
6677 }
6677 else 6678 else
6678 XSETCDR (prev, XCDR (tail)); 6679 XSETCDR (prev, XCDR (tail));
6679 } 6680 }
6680 } 6681 }
6681 } 6682 }
6683
6684 done_safe_codings:
6685 /* If the above loop was terminated before P reaches PEND, it means
6686 SAFE_CODINGS was set to nil. If we have not yet found an
6687 non-ASCII single-byte char, check it now. */
6688 if (! *single_byte_char_found)
6689 while (p < pend)
6690 {
6691 c = STRING_CHAR_AND_LENGTH (p, pend - p, len);
6692 p += len;
6693 if (! ASCII_BYTE_P (c)
6694 && SINGLE_BYTE_CHAR_P (c))
6695 {
6696 *single_byte_char_found = 1;
6697 break;
6698 }
6699 }
6682 return safe_codings; 6700 return safe_codings;
6683} 6701}
6684 6702
diff --git a/src/keymap.c b/src/keymap.c
index 60a6d177e35..30d66972094 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1624,7 +1624,7 @@ DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0,
1624 doc: /* Return the binding for command KEYS in current global keymap only. 1624 doc: /* Return the binding for command KEYS in current global keymap only.
1625KEYS is a string, a sequence of keystrokes. 1625KEYS is a string, a sequence of keystrokes.
1626The binding is probably a symbol with a function definition. 1626The binding is probably a symbol with a function definition.
1627This function's return values are the same as those of lookup-key 1627This function's return values are the same as those of `lookup-key'
1628\(which see). 1628\(which see).
1629 1629
1630If optional argument ACCEPT-DEFAULT is non-nil, recognize default 1630If optional argument ACCEPT-DEFAULT is non-nil, recognize default
@@ -1951,7 +1951,7 @@ Lisp_Object Qsingle_key_description, Qkey_description;
1951DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, 1951DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0,
1952 doc: /* Return a pretty description of key-sequence KEYS. 1952 doc: /* Return a pretty description of key-sequence KEYS.
1953Optional arg PREFIX is the sequence of keys leading up to KEYS. 1953Optional arg PREFIX is the sequence of keys leading up to KEYS.
1954Control characters turn into "C-foo" sequences, meta into "M-foo" 1954Control characters turn into "C-foo" sequences, meta into "M-foo",
1955spaces are put between sequence elements, etc. */) 1955spaces are put between sequence elements, etc. */)
1956 (keys, prefix) 1956 (keys, prefix)
1957 Lisp_Object keys, prefix; 1957 Lisp_Object keys, prefix;
@@ -3226,7 +3226,8 @@ describe_vector_princ (elt, fun)
3226 3226
3227DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, 3227DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0,
3228 doc: /* Insert a description of contents of VECTOR. 3228 doc: /* Insert a description of contents of VECTOR.
3229This is text showing the elements of vector matched against indices. */) 3229This is text showing the elements of vector matched against indices.
3230DESCRIBER is the output function used; nil means use `princ'. */)
3230 (vector, describer) 3231 (vector, describer)
3231 Lisp_Object vector, describer; 3232 Lisp_Object vector, describer;
3232{ 3233{
diff --git a/src/macfns.c b/src/macfns.c
index 4147325c288..5c1b7770640 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1,5 +1,5 @@
1/* Graphical user interface functions for Mac OS. 1/* Graphical user interface functions for Mac OS.
2 Copyright (C) 2000, 2001 Free Software Foundation, Inc. 2 Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -3803,13 +3803,15 @@ x_create_tip_frame (dpyinfo, parms, text)
3803 window_prompting = x_figure_window_size (f, parms, 0); 3803 window_prompting = x_figure_window_size (f, parms, 0);
3804 3804
3805 { 3805 {
3806 BLOCK_INPUT;
3807 Rect r; 3806 Rect r;
3808 3807
3808 BLOCK_INPUT;
3809 SetRect (&r, 0, 0, 1, 1); 3809 SetRect (&r, 0, 0, 1, 1);
3810 if (CreateNewWindow (kHelpWindowClass, 3810 if (CreateNewWindow (kHelpWindowClass,
3811 kWindowNoActivatesAttribute 3811#ifdef MAC_OS_X_VERSION_10_2
3812 | kWindowIgnoreClicksAttribute, 3812 kWindowIgnoreClicksAttribute |
3813#endif
3814 kWindowNoActivatesAttribute,
3813 &r, &tip_window) == noErr) 3815 &r, &tip_window) == noErr)
3814 { 3816 {
3815 FRAME_MAC_WINDOW (f) = tip_window; 3817 FRAME_MAC_WINDOW (f) = tip_window;
diff --git a/src/minibuf.c b/src/minibuf.c
index 8ed19516080..6dd55c5ea76 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1619,7 +1619,7 @@ HIST, if non-nil, specifies a history list and optionally the initial
1619 is the initial position (the position in the list used by the 1619 is the initial position (the position in the list used by the
1620 minibuffer history commands). For consistency, you should also 1620 minibuffer history commands). For consistency, you should also
1621 specify that element of the history as the value of 1621 specify that element of the history as the value of
1622 INITIAL-CONTENTS. (This is the only case in which you should use 1622 INITIAL-INPUT. (This is the only case in which you should use
1623 INITIAL-INPUT instead of DEF.) Positions are counted starting from 1623 INITIAL-INPUT instead of DEF.) Positions are counted starting from
1624 1 at the beginning of the list. The variable `history-length' 1624 1 at the beginning of the list. The variable `history-length'
1625 controls the maximum length of a history list. 1625 controls the maximum length of a history list.
diff --git a/src/process.c b/src/process.c
index c05bcbf88d5..d2789e0e42e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -445,10 +445,11 @@ decode_status (l, symbol, code, coredump)
445 445
446/* Return a string describing a process status list. */ 446/* Return a string describing a process status list. */
447 447
448Lisp_Object 448static Lisp_Object
449status_message (status) 449status_message (p)
450 Lisp_Object status; 450 struct Lisp_Process *p;
451{ 451{
452 Lisp_Object status = p->status;
452 Lisp_Object symbol; 453 Lisp_Object symbol;
453 int code, coredump; 454 int code, coredump;
454 Lisp_Object string, string2; 455 Lisp_Object string, string2;
@@ -469,6 +470,8 @@ status_message (status)
469 } 470 }
470 else if (EQ (symbol, Qexit)) 471 else if (EQ (symbol, Qexit))
471 { 472 {
473 if (NETCONN1_P (p))
474 return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n");
472 if (code == 0) 475 if (code == 0)
473 return build_string ("finished\n"); 476 return build_string ("finished\n");
474 string = Fnumber_to_string (make_number (code)); 477 string = Fnumber_to_string (make_number (code));
@@ -764,6 +767,7 @@ nil, indicating the current buffer's process. */)
764 { 767 {
765 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 768 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
766 XSETINT (XPROCESS (process)->tick, ++process_tick); 769 XSETINT (XPROCESS (process)->tick, ++process_tick);
770 status_notify ();
767 } 771 }
768 else if (XINT (XPROCESS (process)->infd) >= 0) 772 else if (XINT (XPROCESS (process)->infd) >= 0)
769 { 773 {
@@ -774,18 +778,7 @@ nil, indicating the current buffer's process. */)
774 XSETINT (XPROCESS (process)->tick, ++process_tick); 778 XSETINT (XPROCESS (process)->tick, ++process_tick);
775 status_notify (); 779 status_notify ();
776 } 780 }
777 /* Do not call remove_process here; either status_notify has already done 781 remove_process (process);
778 it, or will do so the next time emacs polls for input. Thus network
779 processes are not immediately removed, and their sentinel will be
780 called.
781
782 Since Fdelete_process is called by kill_buffer_processes, this also
783 means that a network process sentinel will run after the buffer is
784 dead, which would not be the case if status_notify() were called
785 unconditionally here. This way process sentinels observe consistent
786 behavior with regard to buffer-live-p.
787 */
788 /* remove_process (process); */
789 return Qnil; 782 return Qnil;
790} 783}
791 784
@@ -4703,7 +4696,7 @@ read_process_output_error_handler (error)
4703 starting with our buffered-ahead character if we have one. 4696 starting with our buffered-ahead character if we have one.
4704 Yield number of decoded characters read. 4697 Yield number of decoded characters read.
4705 4698
4706 This function reads at most 1024 characters. 4699 This function reads at most 4096 characters.
4707 If you want to read all available subprocess output, 4700 If you want to read all available subprocess output,
4708 you must call it repeatedly until it returns zero. 4701 you must call it repeatedly until it returns zero.
4709 4702
@@ -4723,7 +4716,7 @@ read_process_output (proc, channel)
4723 register int opoint; 4716 register int opoint;
4724 struct coding_system *coding = proc_decode_coding_system[channel]; 4717 struct coding_system *coding = proc_decode_coding_system[channel];
4725 int carryover = XINT (p->decoding_carryover); 4718 int carryover = XINT (p->decoding_carryover);
4726 int readmax = 1024; 4719 int readmax = 4096;
4727 4720
4728#ifdef VMS 4721#ifdef VMS
4729 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); 4722 VMS_PROC_STUFF *vs, *get_vms_process_pointer();
@@ -4756,16 +4749,6 @@ read_process_output (proc, channel)
4756 } 4749 }
4757#else /* not VMS */ 4750#else /* not VMS */
4758 4751
4759#ifdef DATAGRAM_SOCKETS
4760 /* A datagram is one packet; allow at least 1500+ bytes of data
4761 corresponding to the typical Ethernet frame size. */
4762 if (DATAGRAM_CHAN_P (channel))
4763 {
4764 /* carryover = 0; */ /* Does carryover make sense for datagrams? */
4765 readmax += 1024;
4766 }
4767#endif
4768
4769 chars = (char *) alloca (carryover + readmax); 4752 chars = (char *) alloca (carryover + readmax);
4770 if (carryover) 4753 if (carryover)
4771 /* See the comment above. */ 4754 /* See the comment above. */
@@ -6399,7 +6382,7 @@ status_notify ()
6399 /* Get the text to use for the message. */ 6382 /* Get the text to use for the message. */
6400 if (!NILP (p->raw_status_low)) 6383 if (!NILP (p->raw_status_low))
6401 update_status (p); 6384 update_status (p);
6402 msg = status_message (p->status); 6385 msg = status_message (p);
6403 6386
6404 /* If process is terminated, deactivate it or delete it. */ 6387 /* If process is terminated, deactivate it or delete it. */
6405 symbol = p->status; 6388 symbol = p->status;
diff --git a/src/xfaces.c b/src/xfaces.c
index 6e447e0cb0e..b48ccac9d9d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -463,6 +463,7 @@ int menu_face_changed_default;
463 463
464struct font_name; 464struct font_name;
465struct table_entry; 465struct table_entry;
466struct named_merge_point;
466 467
467static void map_tty_color P_ ((struct frame *, struct face *, 468static void map_tty_color P_ ((struct frame *, struct face *,
468 enum lface_attribute_index, int *)); 469 enum lface_attribute_index, int *));
@@ -521,11 +522,10 @@ static int face_numeric_slant P_ ((Lisp_Object));
521static int face_numeric_swidth P_ ((Lisp_Object)); 522static int face_numeric_swidth P_ ((Lisp_Object));
522static int face_fontset P_ ((Lisp_Object *)); 523static int face_fontset P_ ((Lisp_Object *));
523static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int, int*)); 524static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int, int*));
524static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*, Lisp_Object)); 525static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*,
525static void merge_face_inheritance P_ ((struct frame *f, Lisp_Object, 526 struct named_merge_point *));
526 Lisp_Object *, Lisp_Object)); 527static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *,
527static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object *, 528 int, struct named_merge_point *));
528 Lisp_Object));
529static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object, 529static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object,
530 Lisp_Object, int, int)); 530 Lisp_Object, int, int));
531static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int)); 531static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int));
@@ -3154,6 +3154,49 @@ check_lface (lface)
3154#endif /* GLYPH_DEBUG == 0 */ 3154#endif /* GLYPH_DEBUG == 0 */
3155 3155
3156 3156
3157
3158/* Face-merge cycle checking. */
3159
3160/* A `named merge point' is simply a point during face-merging where we
3161 look up a face by name. We keep a stack of which named lookups we're
3162 currently processing so that we can easily detect cycles, using a
3163 linked- list of struct named_merge_point structures, typically
3164 allocated on the stack frame of the named lookup functions which are
3165 active (so no consing is required). */
3166struct named_merge_point
3167{
3168 Lisp_Object face_name;
3169 struct named_merge_point *prev;
3170};
3171
3172
3173/* If a face merging cycle is detected for FACE_NAME, return 0,
3174 otherwise add NEW_NAMED_MERGE_POINT, which is initialized using
3175 FACE_NAME, as the head of the linked list
3176 pointed to by NAMED_MERGE_POINTS, and return 1. */
3177
3178static INLINE int
3179push_named_merge_point (struct named_merge_point *new_named_merge_point,
3180 Lisp_Object face_name,
3181 struct named_merge_point **named_merge_points)
3182{
3183 struct named_merge_point *prev;
3184
3185 for (prev = *named_merge_points; prev; prev = prev->prev)
3186 if (EQ (face_name, prev->face_name))
3187 break;
3188
3189 new_named_merge_point->face_name = face_name;
3190 new_named_merge_point->prev = *named_merge_points;
3191
3192 *named_merge_points = new_named_merge_point;
3193
3194 return 1;
3195}
3196
3197
3198
3199
3157/* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it 3200/* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it
3158 to make it a symvol. If FACE_NAME is an alias for another face, 3201 to make it a symvol. If FACE_NAME is an alias for another face,
3159 return that face's name. */ 3202 return that face's name. */
@@ -3404,6 +3447,8 @@ merge_face_heights (from, to, invalid, gcpro)
3404 else if (FLOATP (to)) 3447 else if (FLOATP (to))
3405 /* relative X relative => relative */ 3448 /* relative X relative => relative */
3406 result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to)); 3449 result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to));
3450 else if (UNSPECIFIEDP (to))
3451 result = from;
3407 } 3452 }
3408 else if (FUNCTIONP (from)) 3453 else if (FUNCTIONP (from))
3409 /* FROM is a function, which use to adjust TO. */ 3454 /* FROM is a function, which use to adjust TO. */
@@ -3435,14 +3480,15 @@ merge_face_heights (from, to, invalid, gcpro)
3435 completely specified and contain only absolute attributes. Every 3480 completely specified and contain only absolute attributes. Every
3436 specified attribute of FROM overrides the corresponding attribute of 3481 specified attribute of FROM overrides the corresponding attribute of
3437 TO; relative attributes in FROM are merged with the absolute value in 3482 TO; relative attributes in FROM are merged with the absolute value in
3438 TO and replace it. CYCLE_CHECK is used internally to detect loops in 3483 TO and replace it. NAMED_MERGE_POINTS is used internally to detect
3439 face inheritance; it should be Qnil when called from other places. */ 3484 loops in face inheritance; it should be 0 when called from other
3485 places. */
3440 3486
3441static INLINE void 3487static INLINE void
3442merge_face_vectors (f, from, to, cycle_check) 3488merge_face_vectors (f, from, to, named_merge_points)
3443 struct frame *f; 3489 struct frame *f;
3444 Lisp_Object *from, *to; 3490 Lisp_Object *from, *to;
3445 Lisp_Object cycle_check; 3491 struct named_merge_point *named_merge_points;
3446{ 3492{
3447 int i; 3493 int i;
3448 3494
@@ -3453,7 +3499,7 @@ merge_face_vectors (f, from, to, cycle_check)
3453 other code uses `unspecified' as a generic value for face attributes. */ 3499 other code uses `unspecified' as a generic value for face attributes. */
3454 if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) 3500 if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])
3455 && !NILP (from[LFACE_INHERIT_INDEX])) 3501 && !NILP (from[LFACE_INHERIT_INDEX]))
3456 merge_face_inheritance (f, from[LFACE_INHERIT_INDEX], to, cycle_check); 3502 merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points);
3457 3503
3458 /* If TO specifies a :font attribute, and FROM specifies some 3504 /* If TO specifies a :font attribute, and FROM specifies some
3459 font-related attribute, we need to clear TO's :font attribute 3505 font-related attribute, we need to clear TO's :font attribute
@@ -3472,7 +3518,8 @@ merge_face_vectors (f, from, to, cycle_check)
3472 if (!UNSPECIFIEDP (from[i])) 3518 if (!UNSPECIFIEDP (from[i]))
3473 { 3519 {
3474 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) 3520 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
3475 to[i] = merge_face_heights (from[i], to[i], to[i], cycle_check); 3521 to[i] = merge_face_heights (from[i], to[i], to[i],
3522 named_merge_points);
3476 else 3523 else
3477 to[i] = from[i]; 3524 to[i] = from[i];
3478 } 3525 }
@@ -3482,61 +3529,45 @@ merge_face_vectors (f, from, to, cycle_check)
3482 to[LFACE_INHERIT_INDEX] = Qnil; 3529 to[LFACE_INHERIT_INDEX] = Qnil;
3483} 3530}
3484 3531
3485/* Merge face attributes from the face on frame F whose name is 3532/* Merge the named face FACE_NAME on frame F, into the vector of face
3486 INHERITS, into the vector of face attributes TO; INHERITS may also be 3533 attributes TO. NAMED_MERGE_POINTS is used to detect loops in face
3487 a list of face names, in which case they are applied in order. 3534 inheritance. Returns true if FACE_NAME is a valid face name and
3488 CYCLE_CHECK is used to detect loops in face inheritance. 3535 merging succeeded. */
3489 Returns true if any of the inherited attributes are `font-related'. */
3490 3536
3491static void 3537static int
3492merge_face_inheritance (f, inherit, to, cycle_check) 3538merge_named_face (f, face_name, to, named_merge_points)
3493 struct frame *f; 3539 struct frame *f;
3494 Lisp_Object inherit; 3540 Lisp_Object face_name;
3495 Lisp_Object *to; 3541 Lisp_Object *to;
3496 Lisp_Object cycle_check; 3542 struct named_merge_point *named_merge_points;
3497{ 3543{
3498 if (SYMBOLP (inherit) && !EQ (inherit, Qunspecified)) 3544 struct named_merge_point named_merge_point;
3499 /* Inherit from the named face INHERIT. */
3500 {
3501 Lisp_Object lface;
3502
3503 /* Make sure we're not in an inheritance loop. */
3504 cycle_check = CYCLE_CHECK (cycle_check, inherit, 15);
3505 if (NILP (cycle_check))
3506 /* Cycle detected, ignore any further inheritance. */
3507 return;
3508 3545
3509 lface = lface_from_face_name (f, inherit, 0); 3546 if (push_named_merge_point (&named_merge_point,
3510 if (!NILP (lface)) 3547 face_name, &named_merge_points))
3511 merge_face_vectors (f, XVECTOR (lface)->contents, to, cycle_check);
3512 }
3513 else if (CONSP (inherit))
3514 /* Handle a list of inherited faces by calling ourselves recursively
3515 on each element. Note that we only do so for symbol elements, so
3516 it's not possible to infinitely recurse. */
3517 { 3548 {
3518 while (CONSP (inherit)) 3549 Lisp_Object from[LFACE_VECTOR_SIZE];
3519 { 3550 int ok = get_lface_attributes (f, face_name, from, 0);
3520 if (SYMBOLP (XCAR (inherit)))
3521 merge_face_inheritance (f, XCAR (inherit), to, cycle_check);
3522 3551
3523 /* Check for a circular inheritance list. */ 3552 if (ok)
3524 cycle_check = CYCLE_CHECK (cycle_check, inherit, 15); 3553 merge_face_vectors (f, from, to, named_merge_points);
3525 if (NILP (cycle_check))
3526 /* Cycle detected. */
3527 break;
3528 3554
3529 inherit = XCDR (inherit); 3555 return ok;
3530 }
3531 } 3556 }
3557 else
3558 return 0;
3532} 3559}
3533 3560
3534 3561
3535/* Given a Lisp face attribute vector TO and a Lisp object PROP that 3562/* Merge face attributes from the lisp `face reference' FACE_REF on
3536 is a face property, determine the resulting face attributes on 3563 frame F into the face attribute vector TO. If ERR_MSGS is non-zero,
3537 frame F, and store them in TO. PROP may be a single face 3564 problems with FACE_REF cause an error message to be shown. Return
3538 specification or a list of such specifications. Each face 3565 non-zero if no errors occurred (regardless of the value of ERR_MSGS).
3539 specification can be 3566 NAMED_MERGE_POINTS is used to detect loops in face inheritance or
3567 list structure; it may be 0 for most callers.
3568
3569 FACE_REF may be a single face specification or a list of such
3570 specifications. Each face specification can be:
3540 3571
3541 1. A symbol or string naming a Lisp face. 3572 1. A symbol or string naming a Lisp face.
3542 3573
@@ -3551,22 +3582,26 @@ merge_face_inheritance (f, inherit, to, cycle_check)
3551 Face specifications earlier in lists take precedence over later 3582 Face specifications earlier in lists take precedence over later
3552 specifications. */ 3583 specifications. */
3553 3584
3554static void 3585static int
3555merge_face_vector_with_property (f, to, prop) 3586merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
3556 struct frame *f; 3587 struct frame *f;
3588 Lisp_Object face_ref;
3557 Lisp_Object *to; 3589 Lisp_Object *to;
3558 Lisp_Object prop; 3590 int err_msgs;
3591 struct named_merge_point *named_merge_points;
3559{ 3592{
3560 if (CONSP (prop)) 3593 int ok = 1; /* Succeed without an error? */
3594
3595 if (CONSP (face_ref))
3561 { 3596 {
3562 Lisp_Object first = XCAR (prop); 3597 Lisp_Object first = XCAR (face_ref);
3563 3598
3564 if (EQ (first, Qforeground_color) 3599 if (EQ (first, Qforeground_color)
3565 || EQ (first, Qbackground_color)) 3600 || EQ (first, Qbackground_color))
3566 { 3601 {
3567 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR 3602 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR
3568 . COLOR). COLOR must be a string. */ 3603 . COLOR). COLOR must be a string. */
3569 Lisp_Object color_name = XCDR (prop); 3604 Lisp_Object color_name = XCDR (face_ref);
3570 Lisp_Object color = first; 3605 Lisp_Object color = first;
3571 3606
3572 if (STRINGP (color_name)) 3607 if (STRINGP (color_name))
@@ -3577,23 +3612,28 @@ merge_face_vector_with_property (f, to, prop)
3577 to[LFACE_BACKGROUND_INDEX] = color_name; 3612 to[LFACE_BACKGROUND_INDEX] = color_name;
3578 } 3613 }
3579 else 3614 else
3580 add_to_log ("Invalid face color", color_name, Qnil); 3615 {
3616 if (err_msgs)
3617 add_to_log ("Invalid face color", color_name, Qnil);
3618 ok = 0;
3619 }
3581 } 3620 }
3582 else if (SYMBOLP (first) 3621 else if (SYMBOLP (first)
3583 && *SDATA (SYMBOL_NAME (first)) == ':') 3622 && *SDATA (SYMBOL_NAME (first)) == ':')
3584 { 3623 {
3585 /* Assume this is the property list form. */ 3624 /* Assume this is the property list form. */
3586 while (CONSP (prop) && CONSP (XCDR (prop))) 3625 while (CONSP (face_ref) && CONSP (XCDR (face_ref)))
3587 { 3626 {
3588 Lisp_Object keyword = XCAR (prop); 3627 Lisp_Object keyword = XCAR (face_ref);
3589 Lisp_Object value = XCAR (XCDR (prop)); 3628 Lisp_Object value = XCAR (XCDR (face_ref));
3629 int err = 0;
3590 3630
3591 if (EQ (keyword, QCfamily)) 3631 if (EQ (keyword, QCfamily))
3592 { 3632 {
3593 if (STRINGP (value)) 3633 if (STRINGP (value))
3594 to[LFACE_FAMILY_INDEX] = value; 3634 to[LFACE_FAMILY_INDEX] = value;
3595 else 3635 else
3596 add_to_log ("Invalid face font family", value, Qnil); 3636 err = 1;
3597 } 3637 }
3598 else if (EQ (keyword, QCheight)) 3638 else if (EQ (keyword, QCheight))
3599 { 3639 {
@@ -3601,10 +3641,10 @@ merge_face_vector_with_property (f, to, prop)
3601 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], 3641 merge_face_heights (value, to[LFACE_HEIGHT_INDEX],
3602 Qnil, Qnil); 3642 Qnil, Qnil);
3603 3643
3604 if (NILP (new_height)) 3644 if (! NILP (new_height))
3605 add_to_log ("Invalid face font height", value, Qnil);
3606 else
3607 to[LFACE_HEIGHT_INDEX] = new_height; 3645 to[LFACE_HEIGHT_INDEX] = new_height;
3646 else
3647 err = 1;
3608 } 3648 }
3609 else if (EQ (keyword, QCweight)) 3649 else if (EQ (keyword, QCweight))
3610 { 3650 {
@@ -3612,7 +3652,7 @@ merge_face_vector_with_property (f, to, prop)
3612 && face_numeric_weight (value) >= 0) 3652 && face_numeric_weight (value) >= 0)
3613 to[LFACE_WEIGHT_INDEX] = value; 3653 to[LFACE_WEIGHT_INDEX] = value;
3614 else 3654 else
3615 add_to_log ("Invalid face weight", value, Qnil); 3655 err = 1;
3616 } 3656 }
3617 else if (EQ (keyword, QCslant)) 3657 else if (EQ (keyword, QCslant))
3618 { 3658 {
@@ -3620,7 +3660,7 @@ merge_face_vector_with_property (f, to, prop)
3620 && face_numeric_slant (value) >= 0) 3660 && face_numeric_slant (value) >= 0)
3621 to[LFACE_SLANT_INDEX] = value; 3661 to[LFACE_SLANT_INDEX] = value;
3622 else 3662 else
3623 add_to_log ("Invalid face slant", value, Qnil); 3663 err = 1;
3624 } 3664 }
3625 else if (EQ (keyword, QCunderline)) 3665 else if (EQ (keyword, QCunderline))
3626 { 3666 {
@@ -3629,7 +3669,7 @@ merge_face_vector_with_property (f, to, prop)
3629 || STRINGP (value)) 3669 || STRINGP (value))
3630 to[LFACE_UNDERLINE_INDEX] = value; 3670 to[LFACE_UNDERLINE_INDEX] = value;
3631 else 3671 else
3632 add_to_log ("Invalid face underline", value, Qnil); 3672 err = 1;
3633 } 3673 }
3634 else if (EQ (keyword, QCoverline)) 3674 else if (EQ (keyword, QCoverline))
3635 { 3675 {
@@ -3638,7 +3678,7 @@ merge_face_vector_with_property (f, to, prop)
3638 || STRINGP (value)) 3678 || STRINGP (value))
3639 to[LFACE_OVERLINE_INDEX] = value; 3679 to[LFACE_OVERLINE_INDEX] = value;
3640 else 3680 else
3641 add_to_log ("Invalid face overline", value, Qnil); 3681 err = 1;
3642 } 3682 }
3643 else if (EQ (keyword, QCstrike_through)) 3683 else if (EQ (keyword, QCstrike_through))
3644 { 3684 {
@@ -3647,7 +3687,7 @@ merge_face_vector_with_property (f, to, prop)
3647 || STRINGP (value)) 3687 || STRINGP (value))
3648 to[LFACE_STRIKE_THROUGH_INDEX] = value; 3688 to[LFACE_STRIKE_THROUGH_INDEX] = value;
3649 else 3689 else
3650 add_to_log ("Invalid face strike-through", value, Qnil); 3690 err = 1;
3651 } 3691 }
3652 else if (EQ (keyword, QCbox)) 3692 else if (EQ (keyword, QCbox))
3653 { 3693 {
@@ -3659,7 +3699,7 @@ merge_face_vector_with_property (f, to, prop)
3659 || NILP (value)) 3699 || NILP (value))
3660 to[LFACE_BOX_INDEX] = value; 3700 to[LFACE_BOX_INDEX] = value;
3661 else 3701 else
3662 add_to_log ("Invalid face box", value, Qnil); 3702 err = 1;
3663 } 3703 }
3664 else if (EQ (keyword, QCinverse_video) 3704 else if (EQ (keyword, QCinverse_video)
3665 || EQ (keyword, QCreverse_video)) 3705 || EQ (keyword, QCreverse_video))
@@ -3667,21 +3707,21 @@ merge_face_vector_with_property (f, to, prop)
3667 if (EQ (value, Qt) || NILP (value)) 3707 if (EQ (value, Qt) || NILP (value))
3668 to[LFACE_INVERSE_INDEX] = value; 3708 to[LFACE_INVERSE_INDEX] = value;
3669 else 3709 else
3670 add_to_log ("Invalid face inverse-video", value, Qnil); 3710 err = 1;
3671 } 3711 }
3672 else if (EQ (keyword, QCforeground)) 3712 else if (EQ (keyword, QCforeground))
3673 { 3713 {
3674 if (STRINGP (value)) 3714 if (STRINGP (value))
3675 to[LFACE_FOREGROUND_INDEX] = value; 3715 to[LFACE_FOREGROUND_INDEX] = value;
3676 else 3716 else
3677 add_to_log ("Invalid face foreground", value, Qnil); 3717 err = 1;
3678 } 3718 }
3679 else if (EQ (keyword, QCbackground)) 3719 else if (EQ (keyword, QCbackground))
3680 { 3720 {
3681 if (STRINGP (value)) 3721 if (STRINGP (value))
3682 to[LFACE_BACKGROUND_INDEX] = value; 3722 to[LFACE_BACKGROUND_INDEX] = value;
3683 else 3723 else
3684 add_to_log ("Invalid face background", value, Qnil); 3724 err = 1;
3685 } 3725 }
3686 else if (EQ (keyword, QCstipple)) 3726 else if (EQ (keyword, QCstipple))
3687 { 3727 {
@@ -3690,7 +3730,7 @@ merge_face_vector_with_property (f, to, prop)
3690 if (!NILP (pixmap_p)) 3730 if (!NILP (pixmap_p))
3691 to[LFACE_STIPPLE_INDEX] = value; 3731 to[LFACE_STIPPLE_INDEX] = value;
3692 else 3732 else
3693 add_to_log ("Invalid face stipple", value, Qnil); 3733 err = 1;
3694#endif 3734#endif
3695 } 3735 }
3696 else if (EQ (keyword, QCwidth)) 3736 else if (EQ (keyword, QCwidth))
@@ -3699,52 +3739,51 @@ merge_face_vector_with_property (f, to, prop)
3699 && face_numeric_swidth (value) >= 0) 3739 && face_numeric_swidth (value) >= 0)
3700 to[LFACE_SWIDTH_INDEX] = value; 3740 to[LFACE_SWIDTH_INDEX] = value;
3701 else 3741 else
3702 add_to_log ("Invalid face width", value, Qnil); 3742 err = 1;
3703 } 3743 }
3704 else if (EQ (keyword, QCinherit)) 3744 else if (EQ (keyword, QCinherit))
3705 { 3745 {
3706 if (SYMBOLP (value)) 3746 /* This is not really very useful; it's just like a
3707 to[LFACE_INHERIT_INDEX] = value; 3747 normal face reference. */
3708 else 3748 if (! merge_face_ref (f, value, to,
3709 { 3749 err_msgs, named_merge_points))
3710 Lisp_Object tail; 3750 err = 1;
3711 for (tail = value; CONSP (tail); tail = XCDR (tail))
3712 if (!SYMBOLP (XCAR (tail)))
3713 break;
3714 if (NILP (tail))
3715 to[LFACE_INHERIT_INDEX] = value;
3716 else
3717 add_to_log ("Invalid face inherit", value, Qnil);
3718 }
3719 } 3751 }
3720 else 3752 else
3721 add_to_log ("Invalid attribute %s in face property", 3753 err = 1;
3722 keyword, Qnil);
3723 3754
3724 prop = XCDR (XCDR (prop)); 3755 if (err)
3756 {
3757 add_to_log ("Invalid face attribute %S %S", keyword, value);
3758 ok = 0;
3759 }
3760
3761 face_ref = XCDR (XCDR (face_ref));
3725 } 3762 }
3726 } 3763 }
3727 else 3764 else
3728 { 3765 {
3729 /* This is a list of face specs. Specifications at the 3766 /* This is a list of face refs. Those at the beginning of the
3730 beginning of the list take precedence over later 3767 list take precedence over what follows, so we have to merge
3731 specifications, so we have to merge starting with the 3768 from the end backwards. */
3732 last specification. */ 3769 Lisp_Object next = XCDR (face_ref);
3733 Lisp_Object next = XCDR (prop); 3770
3734 if (!NILP (next)) 3771 if (! NILP (next))
3735 merge_face_vector_with_property (f, to, next); 3772 ok = merge_face_ref (f, next, to, err_msgs, named_merge_points);
3736 merge_face_vector_with_property (f, to, first); 3773
3774 if (! merge_face_ref (f, first, to, err_msgs, named_merge_points))
3775 ok = 0;
3737 } 3776 }
3738 } 3777 }
3739 else 3778 else
3740 { 3779 {
3741 /* PROP ought to be a face name. */ 3780 /* FACE_REF ought to be a face name. */
3742 Lisp_Object lface = lface_from_face_name (f, prop, 0); 3781 ok = merge_named_face (f, face_ref, to, named_merge_points);
3743 if (NILP (lface)) 3782 if (!ok && err_msgs)
3744 add_to_log ("Invalid face text property value: %s", prop, Qnil); 3783 add_to_log ("Invalid face reference: %s", face_ref, Qnil);
3745 else
3746 merge_face_vectors (f, XVECTOR (lface)->contents, to, Qnil);
3747 } 3784 }
3785
3786 return ok;
3748} 3787}
3749 3788
3750 3789
@@ -5572,7 +5611,8 @@ lookup_named_face (f, symbol, c)
5572 5611
5573 get_lface_attributes (f, symbol, symbol_attrs, 1); 5612 get_lface_attributes (f, symbol, symbol_attrs, 1);
5574 bcopy (default_face->lface, attrs, sizeof attrs); 5613 bcopy (default_face->lface, attrs, sizeof attrs);
5575 merge_face_vectors (f, symbol_attrs, attrs, Qnil); 5614 merge_face_vectors (f, symbol_attrs, attrs, 0);
5615
5576 return lookup_face (f, attrs, c, NULL); 5616 return lookup_face (f, attrs, c, NULL);
5577} 5617}
5578 5618
@@ -5711,7 +5751,7 @@ lookup_derived_face (f, symbol, c, face_id)
5711 5751
5712 get_lface_attributes (f, symbol, symbol_attrs, 1); 5752 get_lface_attributes (f, symbol, symbol_attrs, 1);
5713 bcopy (default_face->lface, attrs, sizeof attrs); 5753 bcopy (default_face->lface, attrs, sizeof attrs);
5714 merge_face_vectors (f, symbol_attrs, attrs, Qnil); 5754 merge_face_vectors (f, symbol_attrs, attrs, 0);
5715 return lookup_face (f, attrs, c, default_face); 5755 return lookup_face (f, attrs, c, default_face);
5716} 5756}
5717 5757
@@ -5724,9 +5764,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
5724 Lisp_Object lface; 5764 Lisp_Object lface;
5725 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 5765 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
5726 Qunspecified); 5766 Qunspecified);
5727 merge_face_vector_with_property (XFRAME (selected_frame), 5767 merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents,
5728 XVECTOR (lface)->contents, 5768 1, 0);
5729 plist);
5730 return lface; 5769 return lface;
5731} 5770}
5732 5771
@@ -5805,7 +5844,7 @@ x_supports_face_attributes_p (f, attrs, def_face)
5805 5844
5806 bcopy (def_attrs, merged_attrs, sizeof merged_attrs); 5845 bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
5807 5846
5808 merge_face_vectors (f, attrs, merged_attrs, Qnil); 5847 merge_face_vectors (f, attrs, merged_attrs, 0);
5809 5848
5810 face = FACE_FROM_ID (f, lookup_face (f, merged_attrs, 0, 0)); 5849 face = FACE_FROM_ID (f, lookup_face (f, merged_attrs, 0, 0));
5811 5850
@@ -6030,6 +6069,12 @@ face for italic. */)
6030 struct face *def_face; 6069 struct face *def_face;
6031 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6070 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6032 6071
6072 if (noninteractive || !initialized)
6073 /* We may not be able to access low-level face information in batch
6074 mode, or before being dumped, and this function is not going to
6075 be very useful in those cases anyway, so just give up. */
6076 return Qnil;
6077
6033 if (NILP (display)) 6078 if (NILP (display))
6034 frame = selected_frame; 6079 frame = selected_frame;
6035 else if (FRAMEP (display)) 6080 else if (FRAMEP (display))
@@ -6055,7 +6100,7 @@ face for italic. */)
6055 6100
6056 for (i = 0; i < LFACE_VECTOR_SIZE; i++) 6101 for (i = 0; i < LFACE_VECTOR_SIZE; i++)
6057 attrs[i] = Qunspecified; 6102 attrs[i] = Qunspecified;
6058 merge_face_vector_with_property (f, attrs, attributes); 6103 merge_face_ref (f, attributes, attrs, 1, 0);
6059 6104
6060 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 6105 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
6061 if (def_face == NULL) 6106 if (def_face == NULL)
@@ -6932,7 +6977,7 @@ realize_named_face (f, symbol, id)
6932 6977
6933 /* Merge SYMBOL's face with the default face. */ 6978 /* Merge SYMBOL's face with the default face. */
6934 get_lface_attributes (f, symbol, symbol_attrs, 1); 6979 get_lface_attributes (f, symbol, symbol_attrs, 1);
6935 merge_face_vectors (f, symbol_attrs, attrs, Qnil); 6980 merge_face_vectors (f, symbol_attrs, attrs, 0);
6936 6981
6937 /* Realize the face. */ 6982 /* Realize the face. */
6938 new_face = realize_face (c, attrs, 0, NULL, id); 6983 new_face = realize_face (c, attrs, 0, NULL, id);
@@ -7402,7 +7447,7 @@ compute_char_face (f, ch, prop)
7402 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 7447 Lisp_Object attrs[LFACE_VECTOR_SIZE];
7403 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 7448 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
7404 bcopy (default_face->lface, attrs, sizeof attrs); 7449 bcopy (default_face->lface, attrs, sizeof attrs);
7405 merge_face_vector_with_property (f, attrs, prop); 7450 merge_face_ref (f, prop, attrs, 1, 0);
7406 face_id = lookup_face (f, attrs, ch, NULL); 7451 face_id = lookup_face (f, attrs, ch, NULL);
7407 } 7452 }
7408 7453
@@ -7488,7 +7533,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
7488 7533
7489 /* Merge in attributes specified via text properties. */ 7534 /* Merge in attributes specified via text properties. */
7490 if (!NILP (prop)) 7535 if (!NILP (prop))
7491 merge_face_vector_with_property (f, attrs, prop); 7536 merge_face_ref (f, prop, attrs, 1, 0);
7492 7537
7493 /* Now merge the overlay data. */ 7538 /* Now merge the overlay data. */
7494 noverlays = sort_overlays (overlay_vec, noverlays, w); 7539 noverlays = sort_overlays (overlay_vec, noverlays, w);
@@ -7499,7 +7544,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
7499 7544
7500 prop = Foverlay_get (overlay_vec[i], propname); 7545 prop = Foverlay_get (overlay_vec[i], propname);
7501 if (!NILP (prop)) 7546 if (!NILP (prop))
7502 merge_face_vector_with_property (f, attrs, prop); 7547 merge_face_ref (f, prop, attrs, 1, 0);
7503 7548
7504 oend = OVERLAY_END (overlay_vec[i]); 7549 oend = OVERLAY_END (overlay_vec[i]);
7505 oendpos = OVERLAY_POSITION (oend); 7550 oendpos = OVERLAY_POSITION (oend);
@@ -7510,8 +7555,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
7510 /* If in the region, merge in the region face. */ 7555 /* If in the region, merge in the region face. */
7511 if (pos >= region_beg && pos < region_end) 7556 if (pos >= region_beg && pos < region_end)
7512 { 7557 {
7513 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); 7558 merge_named_face (f, Qregion, attrs, 0);
7514 merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
7515 7559
7516 if (region_end < endpos) 7560 if (region_end < endpos)
7517 endpos = region_end; 7561 endpos = region_end;
@@ -7607,16 +7651,13 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
7607 7651
7608 /* Merge in attributes specified via text properties. */ 7652 /* Merge in attributes specified via text properties. */
7609 if (!NILP (prop)) 7653 if (!NILP (prop))
7610 merge_face_vector_with_property (f, attrs, prop); 7654 merge_face_ref (f, prop, attrs, 1, 0);
7611 7655
7612 /* If in the region, merge in the region face. */ 7656 /* If in the region, merge in the region face. */
7613 if (bufpos 7657 if (bufpos
7614 && bufpos >= region_beg 7658 && bufpos >= region_beg
7615 && bufpos < region_end) 7659 && bufpos < region_end)
7616 { 7660 merge_named_face (f, Qregion, attrs, 0);
7617 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
7618 merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
7619 }
7620 7661
7621 /* Look up a realized face with the given face attributes, 7662 /* Look up a realized face with the given face attributes,
7622 or realize a new one for ASCII characters. */ 7663 or realize a new one for ASCII characters. */