aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorK. Handa2015-09-27 17:06:12 +0900
committerK. Handa2015-09-27 17:06:12 +0900
commit52beda922d2cb523a03661bf74b8678c8b45e440 (patch)
tree04617b37298746a61d5324a5b35c9b71f439d762 /src
parent94ed5167557112fb00eeca05e62589db744206de (diff)
parent1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff)
downloademacs-52beda922d2cb523a03661bf74b8678c8b45e440.tar.gz
emacs-52beda922d2cb523a03661bf74b8678c8b45e440.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
-rw-r--r--src/README13
-rw-r--r--src/buffer.c16
-rw-r--r--src/bytecode.c4
-rw-r--r--src/callproc.c4
-rw-r--r--src/category.c4
-rw-r--r--src/chartab.c2
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c9
-rw-r--r--src/data.c9
-rw-r--r--src/dbusbind.c10
-rw-r--r--src/dispextern.h4
-rw-r--r--src/dispnew.c4
-rw-r--r--src/doc.c2
-rw-r--r--src/doprnt.c2
-rw-r--r--src/editfns.c6
-rw-r--r--src/eval.c41
-rw-r--r--src/fileio.c34
-rw-r--r--src/floatfns.c8
-rw-r--r--src/fns.c24
-rw-r--r--src/font.c115
-rw-r--r--src/fontset.c95
-rw-r--r--src/frame.c7
-rw-r--r--src/frame.h7
-rw-r--r--src/gfilenotify.c92
-rw-r--r--src/image.c40
-rw-r--r--src/indent.c38
-rw-r--r--src/inotify.c49
-rw-r--r--src/keyboard.c4
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h10
-rw-r--r--src/lread.c2
-rw-r--r--src/macfont.m8
-rw-r--r--src/menu.c4
-rw-r--r--src/minibuf.c4
-rw-r--r--src/nsfns.m8
-rw-r--r--src/nsselect.m6
-rw-r--r--src/nsterm.m10
-rw-r--r--src/print.c4
-rw-r--r--src/process.c44
-rw-r--r--src/process.h20
-rw-r--r--src/search.c2
-rw-r--r--src/syntax.c141
-rw-r--r--src/syntax.h33
-rw-r--r--src/term.c7
-rw-r--r--src/termhooks.h6
-rw-r--r--src/terminal.c65
-rw-r--r--src/textprop.c2
-rw-r--r--src/vm-limit.c18
-rw-r--r--src/w16select.c2
-rw-r--r--src/w32fns.c12
-rw-r--r--src/w32notify.c39
-rw-r--r--src/window.c22
-rw-r--r--src/xdisp.c141
-rw-r--r--src/xfaces.c64
-rw-r--r--src/xfns.c14
-rw-r--r--src/xselect.c16
-rw-r--r--src/xterm.c11
57 files changed, 865 insertions, 501 deletions
diff --git a/src/README b/src/README
index ef08d14d075..adc782c10fc 100644
--- a/src/README
+++ b/src/README
@@ -4,16 +4,15 @@ See the end of the file for license conditions.
4 4
5This directory contains the source files for the C component of GNU Emacs. 5This directory contains the source files for the C component of GNU Emacs.
6Nothing in this directory is needed for using Emacs once it is built 6Nothing in this directory is needed for using Emacs once it is built
7and installed, if the dumped Emacs (on Unix systems) is copied elsewhere. 7and installed, if the dumped Emacs is copied elsewhere.
8 8
9See the files ../README and then ../INSTALL for installation instructions. 9See the files ../README and then ../INSTALL for installation instructions.
10 10
11Under GNU and Unix systems, the file `Makefile.in' is used as a 11The file 'Makefile.in' is used as a template by the script
12template by the script `../configure' to produce `Makefile'. This 12'../configure' to produce 'Makefile'. This is the file which actually
13is the file which actually controls the compilation of Emacs. 13controls the compilation of Emacs C source files. All of this should
14All of this should work transparently to the user; you should only 14work transparently; you should only need to change to the parent
15need to run `../configure', and then type `make'. 15directory, run './configure', and then run 'make'.
16
17 16
18This file is part of GNU Emacs. 17This file is part of GNU Emacs.
19 18
diff --git a/src/buffer.c b/src/buffer.c
index 33f7996a8c1..530fe114cc8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1042,7 +1042,7 @@ DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name,
1042 doc: /* Return a string that is the name of no existing buffer based on NAME. 1042 doc: /* Return a string that is the name of no existing buffer based on NAME.
1043If there is no live buffer named NAME, then return NAME. 1043If there is no live buffer named NAME, then return NAME.
1044Otherwise modify name by appending `<NUMBER>', incrementing NUMBER 1044Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
1045\(starting at 2) until an unused name is found, and then return that name. 1045(starting at 2) until an unused name is found, and then return that name.
1046Optional second argument IGNORE specifies a name that is okay to use (if 1046Optional second argument IGNORE specifies a name that is okay to use (if
1047it is in the sequence to be tried) even if a buffer with that name exists. 1047it is in the sequence to be tried) even if a buffer with that name exists.
1048 1048
@@ -1385,7 +1385,7 @@ DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick,
1385 Sbuffer_chars_modified_tick, 0, 1, 0, 1385 Sbuffer_chars_modified_tick, 0, 1, 0,
1386 doc: /* Return BUFFER's character-change tick counter. 1386 doc: /* Return BUFFER's character-change tick counter.
1387Each buffer has a character-change tick counter, which is set to the 1387Each buffer has a character-change tick counter, which is set to the
1388value of the buffer's tick counter \(see `buffer-modified-tick'), each 1388value of the buffer's tick counter (see `buffer-modified-tick'), each
1389time text in that buffer is inserted or deleted. By comparing the 1389time text in that buffer is inserted or deleted. By comparing the
1390values returned by two individual calls of `buffer-chars-modified-tick', 1390values returned by two individual calls of `buffer-chars-modified-tick',
1391you can tell whether a character change occurred in that buffer in 1391you can tell whether a character change occurred in that buffer in
@@ -3791,10 +3791,10 @@ If omitted, BUFFER defaults to the current buffer.
3791BEG and END may be integers or markers. 3791BEG and END may be integers or markers.
3792The fourth arg FRONT-ADVANCE, if non-nil, makes the marker 3792The fourth arg FRONT-ADVANCE, if non-nil, makes the marker
3793for the front of the overlay advance when text is inserted there 3793for the front of the overlay advance when text is inserted there
3794\(which means the text *is not* included in the overlay). 3794(which means the text *is not* included in the overlay).
3795The fifth arg REAR-ADVANCE, if non-nil, makes the marker 3795The fifth arg REAR-ADVANCE, if non-nil, makes the marker
3796for the rear of the overlay advance when text is inserted there 3796for the rear of the overlay advance when text is inserted there
3797\(which means the text *is* included in the overlay). */) 3797(which means the text *is* included in the overlay). */)
3798 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, 3798 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer,
3799 Lisp_Object front_advance, Lisp_Object rear_advance) 3799 Lisp_Object front_advance, Lisp_Object rear_advance)
3800{ 3800{
@@ -6014,7 +6014,7 @@ between 0.0 and 1.0, inclusive. */);
6014 doc: /* List of functions to call before each text change. 6014 doc: /* List of functions to call before each text change.
6015Two arguments are passed to each function: the positions of 6015Two arguments are passed to each function: the positions of
6016the beginning and end of the range of old text to be changed. 6016the beginning and end of the range of old text to be changed.
6017\(For an insertion, the beginning and end are at the same place.) 6017(For an insertion, the beginning and end are at the same place.)
6018No information is given about the length of the text after the change. 6018No information is given about the length of the text after the change.
6019 6019
6020Buffer changes made while executing the `before-change-functions' 6020Buffer changes made while executing the `before-change-functions'
@@ -6031,7 +6031,7 @@ from happening repeatedly and making Emacs nonfunctional. */);
6031Three arguments are passed to each function: the positions of 6031Three arguments are passed to each function: the positions of
6032the beginning and end of the range of changed text, 6032the beginning and end of the range of changed text,
6033and the length in chars of the pre-change text replaced by that range. 6033and the length in chars of the pre-change text replaced by that range.
6034\(For an insertion, the pre-change length is zero; 6034(For an insertion, the pre-change length is zero;
6035for a deletion, that length is the number of chars deleted, 6035for a deletion, that length is the number of chars deleted,
6036and the post-change beginning and end are at the same place.) 6036and the post-change beginning and end are at the same place.)
6037 6037
@@ -6076,7 +6076,7 @@ was modified between BEG and END. PROPERTY is the property name,
6076and VALUE is the old value. 6076and VALUE is the old value.
6077 6077
6078An entry (apply FUN-NAME . ARGS) means undo the change with 6078An entry (apply FUN-NAME . ARGS) means undo the change with
6079\(apply FUN-NAME ARGS). 6079(apply FUN-NAME ARGS).
6080 6080
6081An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo 6081An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo
6082in the active region. BEG and END is the range affected by this entry 6082in the active region. BEG and END is the range affected by this entry
@@ -6236,7 +6236,7 @@ to the default frame line height. A value of nil means add no extra space. */)
6236 doc: /* Non-nil means show a cursor in non-selected windows. 6236 doc: /* Non-nil means show a cursor in non-selected windows.
6237If nil, only shows a cursor in the selected window. 6237If nil, only shows a cursor in the selected window.
6238If t, displays a cursor related to the usual cursor type 6238If t, displays a cursor related to the usual cursor type
6239\(a solid box becomes hollow, a bar becomes a narrower bar). 6239(a solid box becomes hollow, a bar becomes a narrower bar).
6240You can also specify the cursor type as in the `cursor-type' variable. 6240You can also specify the cursor type as in the `cursor-type' variable.
6241Use Custom to set this variable and update the display." */); 6241Use Custom to set this variable and update the display." */);
6242 6242
diff --git a/src/bytecode.c b/src/bytecode.c
index 86d44aba46b..864db1a0bed 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -2000,9 +2000,9 @@ syms_of_bytecode (void)
2000 2000
2001 DEFVAR_LISP ("byte-code-meter", Vbyte_code_meter, 2001 DEFVAR_LISP ("byte-code-meter", Vbyte_code_meter,
2002 doc: /* A vector of vectors which holds a histogram of byte-code usage. 2002 doc: /* A vector of vectors which holds a histogram of byte-code usage.
2003\(aref (aref byte-code-meter 0) CODE) indicates how many times the byte 2003(aref (aref byte-code-meter 0) CODE) indicates how many times the byte
2004opcode CODE has been executed. 2004opcode CODE has been executed.
2005\(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0, 2005(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
2006indicates how many times the byte opcodes CODE1 and CODE2 have been 2006indicates how many times the byte opcodes CODE1 and CODE2 have been
2007executed in succession. */); 2007executed in succession. */);
2008 2008
diff --git a/src/callproc.c b/src/callproc.c
index 39f0eb6265e..e38844e2da6 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -226,7 +226,7 @@ The program's input comes from file INFILE (nil means `/dev/null').
226Insert output in DESTINATION before point; t means current buffer; nil for DESTINATION 226Insert output in DESTINATION before point; t means current buffer; nil for DESTINATION
227 means discard it; 0 means discard and don't wait; and `(:file FILE)', where 227 means discard it; 0 means discard and don't wait; and `(:file FILE)', where
228 FILE is a file name string, means that it should be written to that file 228 FILE is a file name string, means that it should be written to that file
229 \(if the file already exists it is overwritten). 229 (if the file already exists it is overwritten).
230DESTINATION can also have the form (REAL-BUFFER STDERR-FILE); in that case, 230DESTINATION can also have the form (REAL-BUFFER STDERR-FILE); in that case,
231REAL-BUFFER says what to do with standard output, as above, 231REAL-BUFFER says what to do with standard output, as above,
232while STDERR-FILE says what to do with standard error in the child. 232while STDERR-FILE says what to do with standard error in the child.
@@ -1462,7 +1462,7 @@ This function searches `process-environment' for VARIABLE.
1462 1462
1463If optional parameter ENV is a list, then search this list instead of 1463If optional parameter ENV is a list, then search this list instead of
1464`process-environment', and return t when encountering a negative entry 1464`process-environment', and return t when encountering a negative entry
1465\(an entry for a variable with no value). */) 1465(an entry for a variable with no value). */)
1466 (Lisp_Object variable, Lisp_Object env) 1466 (Lisp_Object variable, Lisp_Object env)
1467{ 1467{
1468 char *value; 1468 char *value;
diff --git a/src/category.c b/src/category.c
index bb4a75d3a4d..400116f6e03 100644
--- a/src/category.c
+++ b/src/category.c
@@ -464,7 +464,7 @@ Emacs treats a sequence of word constituent characters as a single
464word (i.e. finds no word boundary between them) only if they belong to 464word (i.e. finds no word boundary between them) only if they belong to
465the same script. But, exceptions are allowed in the following cases. 465the same script. But, exceptions are allowed in the following cases.
466 466
467\(1) The case that characters are in different scripts is controlled 467(1) The case that characters are in different scripts is controlled
468by the variable `word-combining-categories'. 468by the variable `word-combining-categories'.
469 469
470Emacs finds no word boundary between characters of different scripts 470Emacs finds no word boundary between characters of different scripts
@@ -478,7 +478,7 @@ For instance, to tell that Han characters followed by Hiragana
478characters can form a single word, the element `(?C . ?H)' should be 478characters can form a single word, the element `(?C . ?H)' should be
479in this list. 479in this list.
480 480
481\(2) The case that character are in the same script is controlled by 481(2) The case that character are in the same script is controlled by
482the variable `word-separating-categories'. 482the variable `word-separating-categories'.
483 483
484Emacs finds a word boundary between characters of the same script 484Emacs finds a word boundary between characters of the same script
diff --git a/src/chartab.c b/src/chartab.c
index bd14c4d172b..274bb60727c 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -534,7 +534,7 @@ DEFUN ("char-table-parent", Fchar_table_parent, Schar_table_parent,
534The value is either nil or another char-table. 534The value is either nil or another char-table.
535If CHAR-TABLE holds nil for a given character, 535If CHAR-TABLE holds nil for a given character,
536then the actual applicable value is inherited from the parent char-table 536then the actual applicable value is inherited from the parent char-table
537\(or from its parents, if necessary). */) 537(or from its parents, if necessary). */)
538 (Lisp_Object char_table) 538 (Lisp_Object char_table)
539{ 539{
540 CHECK_CHAR_TABLE (char_table); 540 CHECK_CHAR_TABLE (char_table);
diff --git a/src/cmds.c b/src/cmds.c
index a975a8ed4e0..7a575ae7348 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -108,7 +108,7 @@ right or to the left on the screen. This is in contrast with
108DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p", 108DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p",
109 doc: /* Move N lines forward (backward if N is negative). 109 doc: /* Move N lines forward (backward if N is negative).
110Precisely, if point is on line I, move to the start of line I + N 110Precisely, if point is on line I, move to the start of line I + N
111\("start of line" in the logical order). 111("start of line" in the logical order).
112If there isn't room, go as far as possible (no error). 112If there isn't room, go as far as possible (no error).
113 113
114Returns the count of lines left to move. If moving forward, 114Returns the count of lines left to move. If moving forward,
diff --git a/src/coding.c b/src/coding.c
index 1544f319b00..3fc6fb684c6 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -4295,6 +4295,9 @@ encode_invocation_designation (struct charset *charset,
4295 else 4295 else
4296 ENCODE_LOCKING_SHIFT_3; 4296 ENCODE_LOCKING_SHIFT_3;
4297 break; 4297 break;
4298
4299 default:
4300 break;
4298 } 4301 }
4299 } 4302 }
4300 4303
@@ -7292,6 +7295,8 @@ produce_annotation (struct coding_system *coding, ptrdiff_t pos)
7292 case CODING_ANNOTATE_CHARSET_MASK: 7295 case CODING_ANNOTATE_CHARSET_MASK:
7293 produce_charset (coding, charbuf, pos); 7296 produce_charset (coding, charbuf, pos);
7294 break; 7297 break;
7298 default:
7299 break;
7295 } 7300 }
7296 charbuf += len; 7301 charbuf += len;
7297 } 7302 }
@@ -9795,7 +9800,7 @@ DEFUN ("find-operation-coding-system", Ffind_operation_coding_system,
9795 doc: /* Choose a coding system for an operation based on the target name. 9800 doc: /* Choose a coding system for an operation based on the target name.
9796The value names a pair of coding systems: (DECODING-SYSTEM . ENCODING-SYSTEM). 9801The value names a pair of coding systems: (DECODING-SYSTEM . ENCODING-SYSTEM).
9797DECODING-SYSTEM is the coding system to use for decoding 9802DECODING-SYSTEM is the coding system to use for decoding
9798\(in case OPERATION does decoding), and ENCODING-SYSTEM is the coding system 9803(in case OPERATION does decoding), and ENCODING-SYSTEM is the coding system
9799for encoding (in case OPERATION does encoding). 9804for encoding (in case OPERATION does encoding).
9800 9805
9801The first argument OPERATION specifies an I/O primitive: 9806The first argument OPERATION specifies an I/O primitive:
@@ -11170,7 +11175,7 @@ the cdr part is used for encoding a text to be sent to a process. */);
11170Table of extra Latin codes in the range 128..159 (inclusive). 11175Table of extra Latin codes in the range 128..159 (inclusive).
11171This is a vector of length 256. 11176This is a vector of length 256.
11172If Nth element is non-nil, the existence of code N in a file 11177If Nth element is non-nil, the existence of code N in a file
11173\(or output of subprocess) doesn't prevent it to be detected as 11178(or output of subprocess) doesn't prevent it to be detected as
11174a coding system of ISO 2022 variant which has a flag 11179a coding system of ISO 2022 variant which has a flag
11175`accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file 11180`accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file
11176or reading output of a subprocess. 11181or reading output of a subprocess.
diff --git a/src/data.c b/src/data.c
index 88c5a309859..eda611055d8 100644
--- a/src/data.c
+++ b/src/data.c
@@ -226,8 +226,9 @@ for example, (type-of 1) returns `integer'. */)
226 return Qfloat; 226 return Qfloat;
227 case Lisp_Misc_Finalizer: 227 case Lisp_Misc_Finalizer:
228 return Qfinalizer; 228 return Qfinalizer;
229 default:
230 emacs_abort ();
229 } 231 }
230 emacs_abort ();
231 232
232 case Lisp_Vectorlike: 233 case Lisp_Vectorlike:
233 if (WINDOW_CONFIGURATIONP (object)) 234 if (WINDOW_CONFIGURATIONP (object))
@@ -790,7 +791,7 @@ SUBR must be a built-in function. */)
790DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0, 791DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
791 doc: /* Return the interactive form of CMD or nil if none. 792 doc: /* Return the interactive form of CMD or nil if none.
792If CMD is not a command, the return value is nil. 793If CMD is not a command, the return value is nil.
793Value, if non-nil, is a list \(interactive SPEC). */) 794Value, if non-nil, is a list (interactive SPEC). */)
794 (Lisp_Object cmd) 795 (Lisp_Object cmd)
795{ 796{
796 Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ 797 Lisp_Object fun = indirect_function (cmd); /* Check cycles. */
@@ -1659,8 +1660,8 @@ DEFUN ("make-local-variable", Fmake_local_variable, Smake_local_variable,
1659 1, 1, "vMake Local Variable: ", 1660 1, 1, "vMake Local Variable: ",
1660 doc: /* Make VARIABLE have a separate value in the current buffer. 1661 doc: /* Make VARIABLE have a separate value in the current buffer.
1661Other buffers will continue to share a common default value. 1662Other buffers will continue to share a common default value.
1662\(The buffer-local value of VARIABLE starts out as the same value 1663(The buffer-local value of VARIABLE starts out as the same value
1663VARIABLE previously had. If VARIABLE was void, it remains void.\) 1664VARIABLE previously had. If VARIABLE was void, it remains void.)
1664Return VARIABLE. 1665Return VARIABLE.
1665 1666
1666If the variable is already arranged to become local when set, 1667If the variable is already arranged to become local when set,
diff --git a/src/dbusbind.c b/src/dbusbind.c
index e5318fd51a1..181c7d016fd 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1233,20 +1233,20 @@ This is an internal function, it shall not be used outside dbus.el.
1233The following usages are expected: 1233The following usages are expected:
1234 1234
1235`dbus-call-method', `dbus-call-method-asynchronously': 1235`dbus-call-method', `dbus-call-method-asynchronously':
1236 \(dbus-message-internal 1236 (dbus-message-internal
1237 dbus-message-type-method-call BUS SERVICE PATH INTERFACE METHOD HANDLER 1237 dbus-message-type-method-call BUS SERVICE PATH INTERFACE METHOD HANDLER
1238 &optional :timeout TIMEOUT &rest ARGS) 1238 &optional :timeout TIMEOUT &rest ARGS)
1239 1239
1240`dbus-send-signal': 1240`dbus-send-signal':
1241 \(dbus-message-internal 1241 (dbus-message-internal
1242 dbus-message-type-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) 1242 dbus-message-type-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)
1243 1243
1244`dbus-method-return-internal': 1244`dbus-method-return-internal':
1245 \(dbus-message-internal 1245 (dbus-message-internal
1246 dbus-message-type-method-return BUS SERVICE SERIAL &rest ARGS) 1246 dbus-message-type-method-return BUS SERVICE SERIAL &rest ARGS)
1247 1247
1248`dbus-method-error-internal': 1248`dbus-method-error-internal':
1249 \(dbus-message-internal 1249 (dbus-message-internal
1250 dbus-message-type-error BUS SERVICE SERIAL &rest ARGS) 1250 dbus-message-type-error BUS SERVICE SERIAL &rest ARGS)
1251 1251
1252usage: (dbus-message-internal &rest REST) */) 1252usage: (dbus-message-internal &rest REST) */)
@@ -1796,7 +1796,7 @@ string which denotes a D-Bus interface, and MEMBER, also a string, is
1796either a method, a signal or a property INTERFACE is offering. All 1796either a method, a signal or a property INTERFACE is offering. All
1797arguments but BUS must not be nil. 1797arguments but BUS must not be nil.
1798 1798
1799The value in the hash table is a list of quadruple lists \((UNAME 1799The value in the hash table is a list of quadruple lists ((UNAME
1800SERVICE PATH OBJECT [RULE]) ...). SERVICE is the service name as 1800SERVICE PATH OBJECT [RULE]) ...). SERVICE is the service name as
1801registered, UNAME is the corresponding unique name. In case of 1801registered, UNAME is the corresponding unique name. In case of
1802registered methods and properties, UNAME is nil. PATH is the object 1802registered methods and properties, UNAME is nil. PATH is the object
diff --git a/src/dispextern.h b/src/dispextern.h
index e5adeab0dc0..e44b70bf562 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2378,10 +2378,6 @@ struct it
2378 struct it_slice slice; 2378 struct it_slice slice;
2379 ptrdiff_t image_id; 2379 ptrdiff_t image_id;
2380 } image; 2380 } image;
2381 /* method == GET_FROM_COMPOSITION */
2382 struct {
2383 Lisp_Object object;
2384 } comp;
2385 /* method == GET_FROM_STRETCH */ 2381 /* method == GET_FROM_STRETCH */
2386 struct { 2382 struct {
2387 Lisp_Object object; 2383 Lisp_Object object;
diff --git a/src/dispnew.c b/src/dispnew.c
index 18afe50dd9b..00d086e4161 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3004,7 +3004,7 @@ redraw_frame (struct frame *f)
3004 clear_frame (f); 3004 clear_frame (f);
3005 clear_current_matrices (f); 3005 clear_current_matrices (f);
3006 update_end (f); 3006 update_end (f);
3007 windows_or_buffers_changed = 13; 3007 fset_redisplay (f);
3008 /* Mark all windows as inaccurate, so that every window will have 3008 /* Mark all windows as inaccurate, so that every window will have
3009 its redisplay done. */ 3009 its redisplay done. */
3010 mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); 3010 mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0);
@@ -5665,7 +5665,7 @@ DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0,
5665SECONDS may be a floating-point value, meaning that you can wait for a 5665SECONDS may be a floating-point value, meaning that you can wait for a
5666fraction of a second. Optional second arg MILLISECONDS specifies an 5666fraction of a second. Optional second arg MILLISECONDS specifies an
5667additional wait period, in milliseconds; this is for backwards compatibility. 5667additional wait period, in milliseconds; this is for backwards compatibility.
5668\(Not all operating systems support waiting for a fraction of a second.) */) 5668(Not all operating systems support waiting for a fraction of a second.) */)
5669 (Lisp_Object seconds, Lisp_Object milliseconds) 5669 (Lisp_Object seconds, Lisp_Object milliseconds)
5670{ 5670{
5671 double duration = extract_float (seconds); 5671 double duration = extract_float (seconds);
diff --git a/src/doc.c b/src/doc.c
index b6963d2ab0b..68d4367182d 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -716,7 +716,7 @@ is not on any keys.
716Each substring of the form \\=\\{MAPVAR} is replaced by a summary of 716Each substring of the form \\=\\{MAPVAR} is replaced by a summary of
717the value of MAPVAR as a keymap. This summary is similar to the one 717the value of MAPVAR as a keymap. This summary is similar to the one
718produced by `describe-bindings'. The summary ends in two newlines 718produced by `describe-bindings'. The summary ends in two newlines
719\(used by the helper function `help-make-xrefs' to find the end of the 719(used by the helper function `help-make-xrefs' to find the end of the
720summary). 720summary).
721 721
722Each substring of the form \\=\\<MAPVAR> specifies the use of MAPVAR 722Each substring of the form \\=\\<MAPVAR> specifies the use of MAPVAR
diff --git a/src/doprnt.c b/src/doprnt.c
index 7c5a6afb94b..51f8fd72ba0 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -1,4 +1,4 @@
1/* Output like sprintf to a buffer of specified size. 1/* Output like sprintf to a buffer of specified size. -*- coding: utf-8 -*-
2 Also takes args differently: pass one pointer to the end 2 Also takes args differently: pass one pointer to the end
3 of the format string in addition to the format string itself. 3 of the format string in addition to the format string itself.
4 Copyright (C) 1985, 2001-2015 Free Software Foundation, Inc. 4 Copyright (C) 1985, 2001-2015 Free Software Foundation, Inc.
diff --git a/src/editfns.c b/src/editfns.c
index 831edb4c171..12e5ca8c001 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,4 +1,4 @@
1/* Lisp functions pertaining to editing. 1/* Lisp functions pertaining to editing. -*- coding: utf-8 -*-
2 2
3Copyright (C) 1985-1987, 1989, 1993-2015 Free Software Foundation, Inc. 3Copyright (C) 1985-1987, 1989, 1993-2015 Free Software Foundation, Inc.
4 4
@@ -3627,7 +3627,7 @@ save_restriction_restore (Lisp_Object data)
3627DEFUN ("save-restriction", Fsave_restriction, Ssave_restriction, 0, UNEVALLED, 0, 3627DEFUN ("save-restriction", Fsave_restriction, Ssave_restriction, 0, UNEVALLED, 0,
3628 doc: /* Execute BODY, saving and restoring current buffer's restrictions. 3628 doc: /* Execute BODY, saving and restoring current buffer's restrictions.
3629The buffer's restrictions make parts of the beginning and end invisible. 3629The buffer's restrictions make parts of the beginning and end invisible.
3630\(They are set up with `narrow-to-region' and eliminated with `widen'.) 3630(They are set up with `narrow-to-region' and eliminated with `widen'.)
3631This special form, `save-restriction', saves the current buffer's restrictions 3631This special form, `save-restriction', saves the current buffer's restrictions
3632when it is entered, and restores them when it is exited. 3632when it is entered, and restores them when it is exited.
3633So any `narrow-to-region' within BODY lasts only until the end of the form. 3633So any `narrow-to-region' within BODY lasts only until the end of the form.
@@ -4154,7 +4154,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
4154 || conversion == 'X')) 4154 || conversion == 'X'))
4155 error ("Invalid format operation %%%c", 4155 error ("Invalid format operation %%%c",
4156 STRING_CHAR ((unsigned char *) format - 1)); 4156 STRING_CHAR ((unsigned char *) format - 1));
4157 else if (! (INTEGERP (args[n]) || FLOATP (args[n]))) 4157 else if (! NUMBERP (args[n]))
4158 error ("Format specifier doesn't match argument type"); 4158 error ("Format specifier doesn't match argument type");
4159 else 4159 else
4160 { 4160 {
diff --git a/src/eval.c b/src/eval.c
index 77d435acbe6..ac98ca11bd4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -596,6 +596,11 @@ The return value is BASE-VARIABLE. */)
596 error ("Cannot make an internal variable an alias"); 596 error ("Cannot make an internal variable an alias");
597 case SYMBOL_LOCALIZED: 597 case SYMBOL_LOCALIZED:
598 error ("Don't know how to make a localized variable an alias"); 598 error ("Don't know how to make a localized variable an alias");
599 case SYMBOL_PLAINVAL:
600 case SYMBOL_VARALIAS:
601 break;
602 default:
603 emacs_abort ();
599 } 604 }
600 605
601 /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html 606 /* http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00834.html
@@ -640,6 +645,17 @@ default_toplevel_binding (Lisp_Object symbol)
640 if (EQ (specpdl_symbol (pdl), symbol)) 645 if (EQ (specpdl_symbol (pdl), symbol))
641 binding = pdl; 646 binding = pdl;
642 break; 647 break;
648
649 case SPECPDL_UNWIND:
650 case SPECPDL_UNWIND_PTR:
651 case SPECPDL_UNWIND_INT:
652 case SPECPDL_UNWIND_VOID:
653 case SPECPDL_BACKTRACE:
654 case SPECPDL_LET_LOCAL:
655 break;
656
657 default:
658 emacs_abort ();
643 } 659 }
644 } 660 }
645 return binding; 661 return binding;
@@ -689,7 +705,7 @@ If SYMBOL has a local binding, then this form affects the local
689binding. This is usually not what you want. Thus, if you need to 705binding. This is usually not what you want. Thus, if you need to
690load a file defining variables, with this form or with `defconst' or 706load a file defining variables, with this form or with `defconst' or
691`defcustom', you should always load that file _outside_ any bindings 707`defcustom', you should always load that file _outside_ any bindings
692for these variables. \(`defconst' and `defcustom' behave similarly in 708for these variables. (`defconst' and `defcustom' behave similarly in
693this respect.) 709this respect.)
694 710
695The optional argument DOCSTRING is a documentation string for the 711The optional argument DOCSTRING is a documentation string for the
@@ -1172,7 +1188,7 @@ suppresses the debugger).
1172When a handler handles an error, control returns to the `condition-case' 1188When a handler handles an error, control returns to the `condition-case'
1173and it executes the handler's BODY... 1189and it executes the handler's BODY...
1174with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. 1190with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error.
1175\(If VAR is nil, the handler can't access that information.) 1191(If VAR is nil, the handler can't access that information.)
1176Then the value of the last BODY form is returned from the `condition-case' 1192Then the value of the last BODY form is returned from the `condition-case'
1177expression. 1193expression.
1178 1194
@@ -2350,7 +2366,7 @@ may be nil, a function, or a list of functions. Call each
2350function in order with arguments ARGS, stopping at the first 2366function in order with arguments ARGS, stopping at the first
2351one that returns nil, and return nil. Otherwise (if all functions 2367one that returns nil, and return nil. Otherwise (if all functions
2352return non-nil, or if there are no functions to call), return non-nil 2368return non-nil, or if there are no functions to call), return non-nil
2353\(do not rely on the precise return value in this case). 2369(do not rely on the precise return value in this case).
2354 2370
2355Do not use `make-local-variable' to make a hook variable buffer-local. 2371Do not use `make-local-variable' to make a hook variable buffer-local.
2356Instead, use `add-hook' and specify t for the LOCAL argument. 2372Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -3462,6 +3478,17 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'.
3462 else 3478 else
3463 result = Fcons (Fcons (sym, val), result); 3479 result = Fcons (Fcons (sym, val), result);
3464 } 3480 }
3481 break;
3482
3483 case SPECPDL_UNWIND:
3484 case SPECPDL_UNWIND_PTR:
3485 case SPECPDL_UNWIND_INT:
3486 case SPECPDL_UNWIND_VOID:
3487 case SPECPDL_BACKTRACE:
3488 break;
3489
3490 default:
3491 emacs_abort ();
3465 } 3492 }
3466 } 3493 }
3467 } 3494 }
@@ -3504,6 +3531,14 @@ mark_specpdl (void)
3504 mark_object (specpdl_symbol (pdl)); 3531 mark_object (specpdl_symbol (pdl));
3505 mark_object (specpdl_old_value (pdl)); 3532 mark_object (specpdl_old_value (pdl));
3506 break; 3533 break;
3534
3535 case SPECPDL_UNWIND_PTR:
3536 case SPECPDL_UNWIND_INT:
3537 case SPECPDL_UNWIND_VOID:
3538 break;
3539
3540 default:
3541 emacs_abort ();
3507 } 3542 }
3508 } 3543 }
3509} 3544}
diff --git a/src/fileio.c b/src/fileio.c
index d4341f8fa59..e4b255a53ac 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -210,6 +210,22 @@ report_file_error (char const *string, Lisp_Object name)
210 report_file_errno (string, name, errno); 210 report_file_errno (string, name, errno);
211} 211}
212 212
213/* Like report_file_error, but reports a file-notify-error instead. */
214
215void
216report_file_notify_error (const char *string, Lisp_Object name)
217{
218 Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
219 synchronize_system_messages_locale ();
220 char *str = strerror (errno);
221 Lisp_Object errstring
222 = code_convert_string_norecord (build_unibyte_string (str),
223 Vlocale_coding_system, 0);
224 Lisp_Object errdata = Fcons (errstring, data);
225
226 xsignal (Qfile_notify_error, Fcons (build_string (string), errdata));
227}
228
213void 229void
214close_file_unwind (int fd) 230close_file_unwind (int fd)
215{ 231{
@@ -435,7 +451,7 @@ DEFUN ("unhandled-file-name-directory", Funhandled_file_name_directory,
435A `directly usable' directory name is one that may be used without the 451A `directly usable' directory name is one that may be used without the
436intervention of any file handler. 452intervention of any file handler.
437If FILENAME is a directly usable file itself, return 453If FILENAME is a directly usable file itself, return
438\(file-name-directory FILENAME). 454(file-name-directory FILENAME).
439If FILENAME refers to a file which is not accessible from a local process, 455If FILENAME refers to a file which is not accessible from a local process,
440then this should return nil. 456then this should return nil.
441The `call-process' and `start-process' functions use this function to 457The `call-process' and `start-process' functions use this function to
@@ -726,7 +742,7 @@ DEFUN ("make-temp-name", Fmake_temp_name, Smake_temp_name, 1, 1, 0,
726 doc: /* Generate temporary file name (string) starting with PREFIX (a string). 742 doc: /* Generate temporary file name (string) starting with PREFIX (a string).
727The Emacs process number forms part of the result, so there is no 743The Emacs process number forms part of the result, so there is no
728danger of generating a name being used by another Emacs process 744danger of generating a name being used by another Emacs process
729\(so long as only a single host can access the containing directory...). 745(so long as only a single host can access the containing directory...).
730 746
731This function tries to choose a name that has no existing file. 747This function tries to choose a name that has no existing file.
732For this to work, PREFIX should be an absolute file name. 748For this to work, PREFIX should be an absolute file name.
@@ -742,7 +758,7 @@ normally use `make-temp-file' instead. */)
742DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, 758DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
743 doc: /* Convert filename NAME to absolute, and canonicalize it. 759 doc: /* Convert filename NAME to absolute, and canonicalize it.
744Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative 760Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
745\(does not start with slash or tilde); both the directory name and 761(does not start with slash or tilde); both the directory name and
746a directory's file name are accepted. If DEFAULT-DIRECTORY is nil or 762a directory's file name are accepted. If DEFAULT-DIRECTORY is nil or
747missing, the current buffer's value of `default-directory' is used. 763missing, the current buffer's value of `default-directory' is used.
748NAME should be a string that is a valid file name for the underlying 764NAME should be a string that is a valid file name for the underlying
@@ -760,8 +776,8 @@ See also the function `substitute-in-file-name'.
760 776
761For technical reasons, this function can return correct but 777For technical reasons, this function can return correct but
762non-intuitive results for the root directory; for instance, 778non-intuitive results for the root directory; for instance,
763\(expand-file-name ".." "/") returns "/..". For this reason, use 779(expand-file-name ".." "/") returns "/..". For this reason, use
764\(directory-file-name (file-name-directory dirname)) to traverse a 780(directory-file-name (file-name-directory dirname)) to traverse a
765filesystem tree, not (expand-file-name ".." dirname). */) 781filesystem tree, not (expand-file-name ".." dirname). */)
766 (Lisp_Object name, Lisp_Object default_directory) 782 (Lisp_Object name, Lisp_Object default_directory)
767{ 783{
@@ -1444,7 +1460,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1444DEAFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, 1460DEAFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
1445 "Convert FILENAME to absolute, and canonicalize it.\n\ 1461 "Convert FILENAME to absolute, and canonicalize it.\n\
1446Second arg DEFAULT is directory to start with if FILENAME is relative\n\ 1462Second arg DEFAULT is directory to start with if FILENAME is relative\n\
1447\(does not start with slash); if DEFAULT is nil or missing,\n\ 1463(does not start with slash); if DEFAULT is nil or missing,\n\
1448the current buffer's value of default-directory is used.\n\ 1464the current buffer's value of default-directory is used.\n\
1449Filenames containing `.' or `..' as components are simplified;\n\ 1465Filenames containing `.' or `..' as components are simplified;\n\
1450initial `~/' expands to your home directory.\n\ 1466initial `~/' expands to your home directory.\n\
@@ -2453,7 +2469,7 @@ Use `file-symlink-p' to test for such links. */)
2453DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, 2469DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0,
2454 doc: /* Return t if FILENAME can be executed by you. 2470 doc: /* Return t if FILENAME can be executed by you.
2455For a directory, this means you can access files in that directory. 2471For a directory, this means you can access files in that directory.
2456\(It is generally better to use `file-accessible-directory-p' for that 2472(It is generally better to use `file-accessible-directory-p' for that
2457purpose, though.) */) 2473purpose, though.) */)
2458 (Lisp_Object filename) 2474 (Lisp_Object filename)
2459{ 2475{
@@ -5290,8 +5306,8 @@ DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,
5290Useful if the buffer was not read from the file normally 5306Useful if the buffer was not read from the file normally
5291or if the file itself has been changed for some known benign reason. 5307or if the file itself has been changed for some known benign reason.
5292An argument specifies the modification time value to use 5308An argument specifies the modification time value to use
5293\(instead of that of the visited file), in the form of a list 5309(instead of that of the visited file), in the form of a list
5294\(HIGH LOW USEC PSEC) or an integer flag as returned by 5310(HIGH LOW USEC PSEC) or an integer flag as returned by
5295`visited-file-modtime'. */) 5311`visited-file-modtime'. */)
5296 (Lisp_Object time_flag) 5312 (Lisp_Object time_flag)
5297{ 5313{
diff --git a/src/floatfns.c b/src/floatfns.c
index 63d35b8ad6b..46eb85ff8ca 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -170,7 +170,7 @@ Cause an error if X1 or X2 is not a float. */)
170DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0, 170DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0,
171 doc: /* Get significand and exponent of a floating point number. 171 doc: /* Get significand and exponent of a floating point number.
172Breaks the floating point number X into its binary significand SGNFCAND 172Breaks the floating point number X into its binary significand SGNFCAND
173\(a floating point value between 0.5 (included) and 1.0 (excluded)) 173(a floating point value between 0.5 (included) and 1.0 (excluded))
174and an integral exponent EXP for 2, such that: 174and an integral exponent EXP for 2, such that:
175 175
176 X = SGNFCAND * 2^EXP 176 X = SGNFCAND * 2^EXP
@@ -454,7 +454,7 @@ With optional DIVISOR, return the nearest integer to ARG/DIVISOR.
454 454
455Rounding a value equidistant between two integers may choose the 455Rounding a value equidistant between two integers may choose the
456integer closer to zero, or it may prefer an even integer, depending on 456integer closer to zero, or it may prefer an even integer, depending on
457your machine. For example, \(round 2.5\) can return 3 on some 457your machine. For example, (round 2.5) can return 3 on some
458systems, but 2 on others. */) 458systems, but 2 on others. */)
459 (Lisp_Object arg, Lisp_Object divisor) 459 (Lisp_Object arg, Lisp_Object divisor)
460{ 460{
@@ -491,7 +491,7 @@ fmod_float (Lisp_Object x, Lisp_Object y)
491 491
492DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, 492DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
493 doc: /* Return the smallest integer no less than ARG, as a float. 493 doc: /* Return the smallest integer no less than ARG, as a float.
494\(Round toward +inf.\) */) 494(Round toward +inf.) */)
495 (Lisp_Object arg) 495 (Lisp_Object arg)
496{ 496{
497 double d = extract_float (arg); 497 double d = extract_float (arg);
@@ -501,7 +501,7 @@ DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
501 501
502DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, 502DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
503 doc: /* Return the largest integer no greater than ARG, as a float. 503 doc: /* Return the largest integer no greater than ARG, as a float.
504\(Round towards -inf.\) */) 504(Round towards -inf.) */)
505 (Lisp_Object arg) 505 (Lisp_Object arg)
506{ 506{
507 double d = extract_float (arg); 507 double d = extract_float (arg);
diff --git a/src/fns.c b/src/fns.c
index aa917ac6ec9..b31bd817c44 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -224,7 +224,7 @@ DEFUN ("compare-strings", Fcompare_strings, Scompare_strings, 6, 7, 0,
224The arguments START1, END1, START2, and END2, if non-nil, are 224The arguments START1, END1, START2, and END2, if non-nil, are
225positions specifying which parts of STR1 or STR2 to compare. In 225positions specifying which parts of STR1 or STR2 to compare. In
226string STR1, compare the part between START1 (inclusive) and END1 226string STR1, compare the part between START1 (inclusive) and END1
227\(exclusive). If START1 is nil, it defaults to 0, the beginning of 227(exclusive). If START1 is nil, it defaults to 0, the beginning of
228the string; if END1 is nil, it defaults to the length of the string. 228the string; if END1 is nil, it defaults to the length of the string.
229Likewise, in string STR2, compare the part between START2 and END2. 229Likewise, in string STR2, compare the part between START2 and END2.
230Like in `substring', negative values are counted from the end. 230Like in `substring', negative values are counted from the end.
@@ -347,8 +347,8 @@ This function obeys the conventions for collation order in your
347locale settings. For example, punctuation and whitespace characters 347locale settings. For example, punctuation and whitespace characters
348might be considered less significant for sorting: 348might be considered less significant for sorting:
349 349
350\(sort '\("11" "12" "1 1" "1 2" "1.1" "1.2") \\='string-collate-lessp) 350(sort '("11" "12" "1 1" "1 2" "1.1" "1.2") \\='string-collate-lessp)
351 => \("11" "1 1" "1.1" "12" "1 2" "1.2") 351 => ("11" "1 1" "1.1" "12" "1 2" "1.2")
352 352
353The optional argument LOCALE, a string, overrides the setting of your 353The optional argument LOCALE, a string, overrides the setting of your
354current locale identifier for collation. The value is system 354current locale identifier for collation. The value is system
@@ -393,7 +393,7 @@ settings. For example, characters with different coding points but
393the same meaning might be considered as equal, like different grave 393the same meaning might be considered as equal, like different grave
394accent Unicode characters: 394accent Unicode characters:
395 395
396\(string-collate-equalp \(string ?\\uFF40) \(string ?\\u1FEF)) 396(string-collate-equalp (string ?\\uFF40) (string ?\\u1FEF))
397 => t 397 => t
398 398
399The optional argument LOCALE, a string, overrides the setting of your 399The optional argument LOCALE, a string, overrides the setting of your
@@ -1026,7 +1026,7 @@ to a multibyte character. In this case, the returned string is a
1026newly created string with no text properties. If STRING is multibyte 1026newly created string with no text properties. If STRING is multibyte
1027or entirely ASCII, it is returned unchanged. In particular, when 1027or entirely ASCII, it is returned unchanged. In particular, when
1028STRING is unibyte and entirely ASCII, the returned string is unibyte. 1028STRING is unibyte and entirely ASCII, the returned string is unibyte.
1029\(When the characters are all ASCII, Emacs primitives will treat the 1029(When the characters are all ASCII, Emacs primitives will treat the
1030string the same way whether it is unibyte or multibyte.) */) 1030string the same way whether it is unibyte or multibyte.) */)
1031 (Lisp_Object string) 1031 (Lisp_Object string)
1032{ 1032{
@@ -1225,14 +1225,14 @@ validate_subarray (Lisp_Object array, Lisp_Object from, Lisp_Object to,
1225DEFUN ("substring", Fsubstring, Ssubstring, 1, 3, 0, 1225DEFUN ("substring", Fsubstring, Ssubstring, 1, 3, 0,
1226 doc: /* Return a new string whose contents are a substring of STRING. 1226 doc: /* Return a new string whose contents are a substring of STRING.
1227The returned string consists of the characters between index FROM 1227The returned string consists of the characters between index FROM
1228\(inclusive) and index TO (exclusive) of STRING. FROM and TO are 1228(inclusive) and index TO (exclusive) of STRING. FROM and TO are
1229zero-indexed: 0 means the first character of STRING. Negative values 1229zero-indexed: 0 means the first character of STRING. Negative values
1230are counted from the end of STRING. If TO is nil, the substring runs 1230are counted from the end of STRING. If TO is nil, the substring runs
1231to the end of STRING. 1231to the end of STRING.
1232 1232
1233The STRING argument may also be a vector. In that case, the return 1233The STRING argument may also be a vector. In that case, the return
1234value is a new vector that contains the elements between index FROM 1234value is a new vector that contains the elements between index FROM
1235\(inclusive) and index TO (exclusive) of that vector argument. 1235(inclusive) and index TO (exclusive) of that vector argument.
1236 1236
1237With one argument, just copy STRING (with properties, if any). */) 1237With one argument, just copy STRING (with properties, if any). */)
1238 (Lisp_Object string, Lisp_Object from, Lisp_Object to) 1238 (Lisp_Object string, Lisp_Object from, Lisp_Object to)
@@ -2051,7 +2051,7 @@ merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred)
2051DEFUN ("plist-get", Fplist_get, Splist_get, 2, 2, 0, 2051DEFUN ("plist-get", Fplist_get, Splist_get, 2, 2, 0,
2052 doc: /* Extract a value from a property list. 2052 doc: /* Extract a value from a property list.
2053PLIST is a property list, which is a list of the form 2053PLIST is a property list, which is a list of the form
2054\(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value 2054(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
2055corresponding to the given PROP, or nil if PROP is not one of the 2055corresponding to the given PROP, or nil if PROP is not one of the
2056properties on the list. This function never signals an error. */) 2056properties on the list. This function never signals an error. */)
2057 (Lisp_Object plist, Lisp_Object prop) 2057 (Lisp_Object plist, Lisp_Object prop)
@@ -2086,7 +2086,7 @@ This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */)
2086DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0, 2086DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0,
2087 doc: /* Change value in PLIST of PROP to VAL. 2087 doc: /* Change value in PLIST of PROP to VAL.
2088PLIST is a property list, which is a list of the form 2088PLIST is a property list, which is a list of the form
2089\(PROP1 VALUE1 PROP2 VALUE2 ...). PROP is a symbol and VAL is any object. 2089(PROP1 VALUE1 PROP2 VALUE2 ...). PROP is a symbol and VAL is any object.
2090If PROP is already a property on the list, its value is set to VAL, 2090If PROP is already a property on the list, its value is set to VAL,
2091otherwise the new PROP VAL pair is added. The new plist is returned; 2091otherwise the new PROP VAL pair is added. The new plist is returned;
2092use `(setq x (plist-put x prop val))' to be sure to use the new value. 2092use `(setq x (plist-put x prop val))' to be sure to use the new value.
@@ -2130,7 +2130,7 @@ It can be retrieved with `(get SYMBOL PROPNAME)'. */)
2130DEFUN ("lax-plist-get", Flax_plist_get, Slax_plist_get, 2, 2, 0, 2130DEFUN ("lax-plist-get", Flax_plist_get, Slax_plist_get, 2, 2, 0,
2131 doc: /* Extract a value from a property list, comparing with `equal'. 2131 doc: /* Extract a value from a property list, comparing with `equal'.
2132PLIST is a property list, which is a list of the form 2132PLIST is a property list, which is a list of the form
2133\(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value 2133(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
2134corresponding to the given PROP, or nil if PROP is not 2134corresponding to the given PROP, or nil if PROP is not
2135one of the properties on the list. */) 2135one of the properties on the list. */)
2136 (Lisp_Object plist, Lisp_Object prop) 2136 (Lisp_Object plist, Lisp_Object prop)
@@ -2155,7 +2155,7 @@ one of the properties on the list. */)
2155DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0, 2155DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0,
2156 doc: /* Change value in PLIST of PROP to VAL, comparing with `equal'. 2156 doc: /* Change value in PLIST of PROP to VAL, comparing with `equal'.
2157PLIST is a property list, which is a list of the form 2157PLIST is a property list, which is a list of the form
2158\(PROP1 VALUE1 PROP2 VALUE2 ...). PROP and VAL are any objects. 2158(PROP1 VALUE1 PROP2 VALUE2 ...). PROP and VAL are any objects.
2159If PROP is already a property on the list, its value is set to VAL, 2159If PROP is already a property on the list, its value is set to VAL,
2160otherwise the new PROP VAL pair is added. The new plist is returned; 2160otherwise the new PROP VAL pair is added. The new plist is returned;
2161use `(setq x (lax-plist-put x prop val))' to be sure to use the new value. 2161use `(setq x (lax-plist-put x prop val))' to be sure to use the new value.
@@ -2867,7 +2867,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */)
2867DEFUN ("plist-member", Fplist_member, Splist_member, 2, 2, 0, 2867DEFUN ("plist-member", Fplist_member, Splist_member, 2, 2, 0,
2868 doc: /* Return non-nil if PLIST has the property PROP. 2868 doc: /* Return non-nil if PLIST has the property PROP.
2869PLIST is a property list, which is a list of the form 2869PLIST is a property list, which is a list of the form
2870\(PROP1 VALUE1 PROP2 VALUE2 ...\). PROP is a symbol. 2870(PROP1 VALUE1 PROP2 VALUE2 ...). PROP is a symbol.
2871Unlike `plist-get', this allows you to distinguish between a missing 2871Unlike `plist-get', this allows you to distinguish between a missing
2872property and a property with the value nil. 2872property and a property with the value nil.
2873The value is actually the tail of PLIST whose car is PROP. */) 2873The value is actually the tail of PLIST whose car is PROP. */)
diff --git a/src/font.c b/src/font.c
index 50b966ec83e..ce144e78a08 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4068,7 +4068,7 @@ DEFUN ("font-face-attributes", Ffont_face_attributes, Sfont_face_attributes, 1,
4068FONT is a font name, a font-spec, a font-entity, or a font-object. 4068FONT is a font name, a font-spec, a font-entity, or a font-object.
4069The return value is a list of the form 4069The return value is a list of the form
4070 4070
4071\(:family FAMILY :height HEIGHT :weight WEIGHT :slant SLANT :width WIDTH) 4071(:family FAMILY :height HEIGHT :weight WEIGHT :slant SLANT :width WIDTH)
4072 4072
4073where FAMILY, HEIGHT, WEIGHT, SLANT, and WIDTH are face attribute values 4073where FAMILY, HEIGHT, WEIGHT, SLANT, and WIDTH are face attribute values
4074compatible with `set-face-attribute'. Some of these key-attribute pairs 4074compatible with `set-face-attribute'. Some of these key-attribute pairs
@@ -4472,6 +4472,106 @@ where
4472 return val; 4472 return val;
4473} 4473}
4474 4474
4475/* Return a description of the font at POSITION in the current buffer.
4476 If the 2nd optional arg CH is non-nil, it is a character to check
4477 the font instead of the character at POSITION.
4478
4479 For a graphical display, return a cons (FONT-OBJECT . GLYPH-CODE).
4480 FONT-OBJECT is the font for the character at POSITION in the current
4481 buffer. This is computed from all the text properties and overlays
4482 that apply to POSITION. POSITION may be nil, in which case,
4483 FONT-SPEC is the font for displaying the character CH with the
4484 default face. GLYPH-CODE is the glyph code in the font to use for
4485 the character.
4486
4487 For a text terminal, return a nonnegative integer glyph code for
4488 the character, or a negative integer if the character is not
4489 displayable. Terminal glyph codes are system-dependent integers
4490 that represent displayable characters: for example, on a Linux x86
4491 console they represent VGA code points.
4492
4493 It returns nil in the following cases:
4494
4495 (1) The window system doesn't have a font for the character (thus
4496 it is displayed by an empty box).
4497
4498 (2) The character code is invalid.
4499
4500 (3) If POSITION is not nil, and the current buffer is not displayed
4501 in any window.
4502
4503 (4) For a text terminal, the terminal does not report glyph codes.
4504
4505 In addition, the returned font name may not take into account of
4506 such redisplay engine hooks as what used in jit-lock-mode if
4507 POSITION is currently not visible. */
4508
4509
4510DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
4511 doc: /* For internal use only. */)
4512 (Lisp_Object position, Lisp_Object ch)
4513{
4514 ptrdiff_t pos, pos_byte, dummy;
4515 int face_id;
4516 int c;
4517 struct frame *f;
4518
4519 if (NILP (position))
4520 {
4521 CHECK_CHARACTER (ch);
4522 c = XINT (ch);
4523 f = XFRAME (selected_frame);
4524 face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
4525 pos = -1;
4526 }
4527 else
4528 {
4529 Lisp_Object window;
4530 struct window *w;
4531
4532 CHECK_NUMBER_COERCE_MARKER (position);
4533 if (! (BEGV <= XINT (position) && XINT (position) < ZV))
4534 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
4535 pos = XINT (position);
4536 pos_byte = CHAR_TO_BYTE (pos);
4537 if (NILP (ch))
4538 c = FETCH_CHAR (pos_byte);
4539 else
4540 {
4541 CHECK_NATNUM (ch);
4542 c = XINT (ch);
4543 }
4544 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
4545 if (NILP (window))
4546 return Qnil;
4547 w = XWINDOW (window);
4548 f = XFRAME (w->frame);
4549 face_id = face_at_buffer_position (w, pos, &dummy,
4550 pos + 100, false, -1);
4551 }
4552 if (! CHAR_VALID_P (c))
4553 return Qnil;
4554
4555 if (! FRAME_WINDOW_P (f))
4556 return terminal_glyph_code (FRAME_TERMINAL (f), c);
4557
4558 /* We need the basic faces to be valid below, so recompute them if
4559 some code just happened to clear the face cache. */
4560 if (FRAME_FACE_CACHE (f)->used == 0)
4561 recompute_basic_faces (f);
4562
4563 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
4564 struct face *face = FACE_FROM_ID (f, face_id);
4565 if (! face->font)
4566 return Qnil;
4567 unsigned code = face->font->driver->encode_char (face->font, c);
4568 if (code == FONT_INVALID_CODE)
4569 return Qnil;
4570 Lisp_Object font_object;
4571 XSETFONT (font_object, face->font);
4572 return Fcons (font_object, INTEGER_TO_CONS (code));
4573}
4574
4475#if 0 4575#if 0
4476 4576
4477DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, 4577DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0,
@@ -4649,15 +4749,15 @@ ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font in
4649pixels. 4749pixels.
4650 4750
4651CAPABILITY is a list whose first element is a symbol representing the 4751CAPABILITY is a list whose first element is a symbol representing the
4652font format \(x, opentype, truetype, type1, pcf, or bdf) and the 4752font format (x, opentype, truetype, type1, pcf, or bdf) and the
4653remaining elements describe the details of the font capability. 4753remaining elements describe the details of the font capability.
4654 4754
4655If the font is OpenType font, the form of the list is 4755If the font is OpenType font, the form of the list is
4656 \(opentype GSUB GPOS) 4756 (opentype GSUB GPOS)
4657where GSUB shows which "GSUB" features the font supports, and GPOS 4757where GSUB shows which "GSUB" features the font supports, and GPOS
4658shows which "GPOS" features the font supports. Both GSUB and GPOS are 4758shows which "GPOS" features the font supports. Both GSUB and GPOS are
4659lists of the format: 4759lists of the format:
4660 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) 4760 ((SCRIPT (LANGSYS FEATURE ...) ...) ...)
4661 4761
4662If the font is not OpenType font, currently the length of the form is 4762If the font is not OpenType font, currently the length of the form is
4663one. 4763one.
@@ -4943,11 +5043,11 @@ where
4943 as follows: 5043 as follows:
4944 5044
4945 If the font is OpenType font, the form of the list is 5045 If the font is OpenType font, the form of the list is
4946 \(opentype GSUB GPOS) 5046 (opentype GSUB GPOS)
4947 where GSUB shows which "GSUB" features the font supports, and GPOS 5047 where GSUB shows which "GSUB" features the font supports, and GPOS
4948 shows which "GPOS" features the font supports. Both GSUB and GPOS are 5048 shows which "GPOS" features the font supports. Both GSUB and GPOS are
4949 lists of the form: 5049 lists of the form:
4950 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) 5050 ((SCRIPT (LANGSYS FEATURE ...) ...) ...)
4951 5051
4952 where 5052 where
4953 SCRIPT is a symbol representing OpenType script tag. 5053 SCRIPT is a symbol representing OpenType script tag.
@@ -5229,6 +5329,7 @@ syms_of_font (void)
5229 defsubr (&Sclear_font_cache); 5329 defsubr (&Sclear_font_cache);
5230 defsubr (&Sfont_shape_gstring); 5330 defsubr (&Sfont_shape_gstring);
5231 defsubr (&Sfont_variation_glyphs); 5331 defsubr (&Sfont_variation_glyphs);
5332 defsubr (&Sinternal_char_font);
5232#if 0 5333#if 0
5233 defsubr (&Sfont_drive_otf); 5334 defsubr (&Sfont_drive_otf);
5234 defsubr (&Sfont_otf_alternates); 5335 defsubr (&Sfont_otf_alternates);
@@ -5258,7 +5359,7 @@ where ENCODING is a charset or a char-table,
5258and REPERTORY is a charset, a char-table, or nil. 5359and REPERTORY is a charset, a char-table, or nil.
5259 5360
5260If ENCODING and REPERTORY are the same, the element can have the form 5361If ENCODING and REPERTORY are the same, the element can have the form
5261\(REGEXP . ENCODING). 5362(REGEXP . ENCODING).
5262 5363
5263ENCODING is for converting a character to a glyph code of the font. 5364ENCODING is for converting a character to a glyph code of the font.
5264If ENCODING is a charset, encoding a character by the charset gives 5365If ENCODING is a charset, encoding a character by the charset gives
diff --git a/src/fontset.c b/src/fontset.c
index 50fcc648548..e735989bcbf 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1787,100 +1787,6 @@ update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset)
1787} 1787}
1788 1788
1789 1789
1790/* Return a cons (FONT-OBJECT . GLYPH-CODE).
1791 FONT-OBJECT is the font for the character at POSITION in the current
1792 buffer. This is computed from all the text properties and overlays
1793 that apply to POSITION. POSITION may be nil, in which case,
1794 FONT-SPEC is the font for displaying the character CH with the
1795 default face.
1796
1797 GLYPH-CODE is the glyph code in the font to use for the character.
1798
1799 If the 2nd optional arg CH is non-nil, it is a character to check
1800 the font instead of the character at POSITION.
1801
1802 It returns nil in the following cases:
1803
1804 (1) The window system doesn't have a font for the character (thus
1805 it is displayed by an empty box).
1806
1807 (2) The character code is invalid.
1808
1809 (3) If POSITION is not nil, and the current buffer is not displayed
1810 in any window.
1811
1812 In addition, the returned font name may not take into account of
1813 such redisplay engine hooks as what used in jit-lock-mode if
1814 POSITION is currently not visible. */
1815
1816
1817DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
1818 doc: /* For internal use only. */)
1819 (Lisp_Object position, Lisp_Object ch)
1820{
1821 ptrdiff_t pos, pos_byte, dummy;
1822 int face_id;
1823 int c;
1824 struct frame *f;
1825 struct face *face;
1826
1827 if (NILP (position))
1828 {
1829 CHECK_CHARACTER (ch);
1830 c = XINT (ch);
1831 f = XFRAME (selected_frame);
1832 face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
1833 pos = -1;
1834 }
1835 else
1836 {
1837 Lisp_Object window;
1838 struct window *w;
1839
1840 CHECK_NUMBER_COERCE_MARKER (position);
1841 if (! (BEGV <= XINT (position) && XINT (position) < ZV))
1842 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
1843 pos = XINT (position);
1844 pos_byte = CHAR_TO_BYTE (pos);
1845 if (NILP (ch))
1846 c = FETCH_CHAR (pos_byte);
1847 else
1848 {
1849 CHECK_NATNUM (ch);
1850 c = XINT (ch);
1851 }
1852 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
1853 if (NILP (window))
1854 return Qnil;
1855 w = XWINDOW (window);
1856 f = XFRAME (w->frame);
1857 face_id = face_at_buffer_position (w, pos, &dummy,
1858 pos + 100, false, -1);
1859 }
1860 if (! CHAR_VALID_P (c))
1861 return Qnil;
1862 if (!FRAME_WINDOW_P (f))
1863 return Qnil;
1864 /* We need the basic faces to be valid below, so recompute them if
1865 some code just happened to clear the face cache. */
1866 if (FRAME_FACE_CACHE (f)->used == 0)
1867 recompute_basic_faces (f);
1868 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
1869 face = FACE_FROM_ID (f, face_id);
1870 if (face->font)
1871 {
1872 unsigned code = face->font->driver->encode_char (face->font, c);
1873 Lisp_Object font_object;
1874
1875 if (code == FONT_INVALID_CODE)
1876 return Qnil;
1877 XSETFONT (font_object, face->font);
1878 return Fcons (font_object, INTEGER_TO_CONS (code));
1879 }
1880 return Qnil;
1881}
1882
1883
1884DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0, 1790DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
1885 doc: /* Return information about a fontset FONTSET on frame FRAME. 1791 doc: /* Return information about a fontset FONTSET on frame FRAME.
1886 1792
@@ -2247,7 +2153,6 @@ at the vertical center of lines. */);
2247 defsubr (&Squery_fontset); 2153 defsubr (&Squery_fontset);
2248 defsubr (&Snew_fontset); 2154 defsubr (&Snew_fontset);
2249 defsubr (&Sset_fontset_font); 2155 defsubr (&Sset_fontset_font);
2250 defsubr (&Sinternal_char_font);
2251 defsubr (&Sfontset_info); 2156 defsubr (&Sfontset_info);
2252 defsubr (&Sfontset_font); 2157 defsubr (&Sfontset_font);
2253 defsubr (&Sfontset_list); 2158 defsubr (&Sfontset_list);
diff --git a/src/frame.c b/src/frame.c
index 6debcb8e7bc..121c55fdb20 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -634,7 +634,6 @@ make_frame (bool mini_p)
634 f->garbaged = true; 634 f->garbaged = true;
635 f->can_x_set_window_size = false; 635 f->can_x_set_window_size = false;
636 f->after_make_frame = false; 636 f->after_make_frame = false;
637 f->tool_bar_redisplayed_once = false;
638 f->column_width = 1; /* !FRAME_WINDOW_P value. */ 637 f->column_width = 1; /* !FRAME_WINDOW_P value. */
639 f->line_height = 1; /* !FRAME_WINDOW_P value. */ 638 f->line_height = 1; /* !FRAME_WINDOW_P value. */
640#ifdef HAVE_WINDOW_SYSTEM 639#ifdef HAVE_WINDOW_SYSTEM
@@ -3540,7 +3539,8 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3540 (f, bgcolor, Qnil); 3539 (f, bgcolor, Qnil);
3541 } 3540 }
3542 3541
3543 Fclear_face_cache (Qnil); 3542 clear_face_cache (true);
3543 windows_or_buffers_changed = 70;
3544} 3544}
3545 3545
3546 3546
@@ -3634,7 +3634,6 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3634#endif 3634#endif
3635 /* Recalculate toolbar height. */ 3635 /* Recalculate toolbar height. */
3636 f->n_tool_bar_rows = 0; 3636 f->n_tool_bar_rows = 0;
3637 f->tool_bar_redisplayed_once = false;
3638 3637
3639 /* Ensure we redraw it. */ 3638 /* Ensure we redraw it. */
3640 clear_current_matrices (f); 3639 clear_current_matrices (f);
@@ -5177,7 +5176,7 @@ keep it unchanged if this option is either t or a list containing
5177`vertical-scroll-bars'. 5176`vertical-scroll-bars'.
5178 5177
5179The default value is \\='(tool-bar-lines) on Lucid, Motif and Windows 5178The default value is \\='(tool-bar-lines) on Lucid, Motif and Windows
5180\(which means that adding/removing a tool bar does not change the frame 5179(which means that adding/removing a tool bar does not change the frame
5181height), nil on all other window systems including GTK+ (which means 5180height), nil on all other window systems including GTK+ (which means
5182that changing any of the parameters listed above may change the size of 5181that changing any of the parameters listed above may change the size of
5183the frame), and t otherwise (which means the frame size never changes 5182the frame), and t otherwise (which means the frame size never changes
diff --git a/src/frame.h b/src/frame.h
index 8ee37dfd695..af0dadb3d99 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -335,9 +335,8 @@ struct frame
335 /* Set to true after this frame was made by `make-frame'. */ 335 /* Set to true after this frame was made by `make-frame'. */
336 bool_bf after_make_frame : 1; 336 bool_bf after_make_frame : 1;
337 337
338 /* True means tool bar has been redisplayed at least once in current 338 /* Non-zero if this frame's faces need to be recomputed. */
339 session. */ 339 bool_bf face_change : 1;
340 bool_bf tool_bar_redisplayed_once : 1;
341 340
342 /* Bitfield area ends here. */ 341 /* Bitfield area ends here. */
343 342
@@ -618,7 +617,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
618} 617}
619#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */ 618#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
620 619
621#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1) 620#define NUMVAL(X) (NUMBERP (X) ? XFLOATINT (X) : -1)
622 621
623INLINE double 622INLINE double
624default_pixels_per_inch_x (void) 623default_pixels_per_inch_x (void)
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 5c6ebe65d87..8b6b0a0cd2d 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "process.h" 29#include "process.h"
30 30
31 31
32/* This is a list, elements are triples (DESCRIPTOR FILE FLAGS CALLBACK) */
32static Lisp_Object watch_list; 33static Lisp_Object watch_list;
33 34
34/* This is the callback function for arriving signals from 35/* This is the callback function for arriving signals from
@@ -41,7 +42,7 @@ dir_monitor_callback (GFileMonitor *monitor,
41 GFileMonitorEvent event_type, 42 GFileMonitorEvent event_type,
42 gpointer user_data) 43 gpointer user_data)
43{ 44{
44 Lisp_Object symbol, monitor_object, watch_object; 45 Lisp_Object symbol, monitor_object, watch_object, flags;
45 char *name = g_file_get_parse_name (file); 46 char *name = g_file_get_parse_name (file);
46 char *oname = other_file ? g_file_get_parse_name (other_file) : NULL; 47 char *oname = other_file ? g_file_get_parse_name (other_file) : NULL;
47 48
@@ -83,20 +84,36 @@ dir_monitor_callback (GFileMonitor *monitor,
83 84
84 if (CONSP (watch_object)) 85 if (CONSP (watch_object))
85 { 86 {
86 /* Construct an event. */
87 struct input_event event; 87 struct input_event event;
88 Lisp_Object otail = oname ? list1 (build_string (oname)) : Qnil; 88 Lisp_Object otail = oname ? list1 (build_string (oname)) : Qnil;
89 EVENT_INIT (event); 89
90 event.kind = FILE_NOTIFY_EVENT; 90 /* Check, whether event_type is expected. */
91 event.frame_or_window = Qnil; 91 flags = XCAR (XCDR (XCDR (watch_object)));
92 event.arg = list2 (Fcons (monitor_object, 92 if ((!NILP (Fmember (Qchange, flags)) &&
93 Fcons (symbol, 93 !NILP (Fmember (symbol, list5 (Qchanged, Qchanges_done_hint,
94 Fcons (build_string (name), 94 Qdeleted, Qcreated, Qmoved)))) ||
95 otail))), 95 (!NILP (Fmember (Qattribute_change, flags)) &&
96 XCDR (watch_object)); 96 ((EQ (symbol, Qattribute_changed)))))
97 97 {
98 /* Store it into the input event queue. */ 98 /* Construct an event. */
99 kbd_buffer_store_event (&event); 99 EVENT_INIT (event);
100 event.kind = FILE_NOTIFY_EVENT;
101 event.frame_or_window = Qnil;
102 event.arg = list2 (Fcons (monitor_object,
103 Fcons (symbol,
104 Fcons (build_string (name),
105 otail))),
106 XCAR (XCDR (XCDR (XCDR (watch_object)))));
107
108 /* Store it into the input event queue. */
109 kbd_buffer_store_event (&event);
110 // XD_DEBUG_MESSAGE ("%s", XD_OBJECT_TO_STRING (event.arg));
111 }
112
113 /* Cancel monitor if file or directory is deleted. */
114 if (!NILP (Fmember (symbol, list2 (Qdeleted, Qmoved))) &&
115 !g_file_monitor_is_cancelled (monitor))
116 g_file_monitor_cancel (monitor);
100 } 117 }
101 118
102 /* Cleanup. */ 119 /* Cleanup. */
@@ -119,9 +136,13 @@ watched for some reason, this function signals a `file-notify-error' error.
119FLAGS is a list of conditions to set what will be watched for. It can 136FLAGS is a list of conditions to set what will be watched for. It can
120include the following symbols: 137include the following symbols:
121 138
122 `watch-mounts' -- watch for mount events 139 `change' -- watch for file changes
123 `send-moved' -- pair `deleted' and `created' events caused by file 140 `attribute-change' -- watch for file attributes changes, like
124 renames and send a single `renamed' event instead 141 permissions or modification time
142 `watch-mounts' -- watch for mount events
143 `send-moved' -- pair `deleted' and `created' events caused by
144 file renames and send a single `renamed' event
145 instead
125 146
126When any event happens, Emacs will call the CALLBACK function passing 147When any event happens, Emacs will call the CALLBACK function passing
127it a single argument EVENT, which is of the form 148it a single argument EVENT, which is of the form
@@ -194,11 +215,15 @@ will be reported only in case of the `moved' event. */)
194 file); 215 file);
195 } 216 }
196 217
218 /* The default rate limit is 800 msec. We adapt this. */
219 g_file_monitor_set_rate_limit (monitor, 100);
220
221 /* Subscribe to the "changed" signal. */
197 g_signal_connect (monitor, "changed", 222 g_signal_connect (monitor, "changed",
198 (GCallback) dir_monitor_callback, NULL); 223 (GCallback) dir_monitor_callback, NULL);
199 224
200 /* Store watch object in watch list. */ 225 /* Store watch object in watch list. */
201 watch_object = Fcons (watch_descriptor, callback); 226 watch_object = list4 (watch_descriptor, file, flags, callback);
202 watch_list = Fcons (watch_object, watch_list); 227 watch_list = Fcons (watch_object, watch_list);
203 228
204 return watch_descriptor; 229 return watch_descriptor;
@@ -218,11 +243,12 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */)
218 243
219 eassert (INTEGERP (watch_descriptor)); 244 eassert (INTEGERP (watch_descriptor));
220 GFileMonitor *monitor = XINTPTR (watch_descriptor); 245 GFileMonitor *monitor = XINTPTR (watch_descriptor);
221 if (!g_file_monitor_cancel (monitor)) 246 if (!g_file_monitor_is_cancelled (monitor) &&
222 xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"), 247 !g_file_monitor_cancel (monitor))
223 watch_descriptor); 248 xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"),
249 watch_descriptor);
224 250
225 /* Remove watch descriptor from watch list. */ 251 /* Remove watch descriptor from watch list. */
226 watch_list = Fdelq (watch_object, watch_list); 252 watch_list = Fdelq (watch_object, watch_list);
227 253
228 /* Cleanup. */ 254 /* Cleanup. */
@@ -231,6 +257,27 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */)
231 return Qt; 257 return Qt;
232} 258}
233 259
260DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0,
261 doc: /* "Check a watch specified by its WATCH-DESCRIPTOR.
262
263WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'.
264
265A watch can become invalid if the file or directory it watches is
266deleted, or if the watcher thread exits abnormally for any other
267reason. Removing the watch by calling `gfile-rm-watch' also makes it
268invalid. */)
269 (Lisp_Object watch_descriptor)
270{
271 Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list);
272 if (NILP (watch_object))
273 return Qnil;
274 else
275 {
276 GFileMonitor *monitor = XINTPTR (watch_descriptor);
277 return g_file_monitor_is_cancelled (monitor) ? Qnil : Qt;
278 }
279}
280
234 281
235void 282void
236globals_of_gfilenotify (void) 283globals_of_gfilenotify (void)
@@ -246,8 +293,11 @@ syms_of_gfilenotify (void)
246{ 293{
247 defsubr (&Sgfile_add_watch); 294 defsubr (&Sgfile_add_watch);
248 defsubr (&Sgfile_rm_watch); 295 defsubr (&Sgfile_rm_watch);
296 defsubr (&Sgfile_valid_p);
249 297
250 /* Filter objects. */ 298 /* Filter objects. */
299 DEFSYM (Qchange, "change");
300 DEFSYM (Qattribute_change, "attribute-change");
251 DEFSYM (Qwatch_mounts, "watch-mounts"); /* G_FILE_MONITOR_WATCH_MOUNTS */ 301 DEFSYM (Qwatch_mounts, "watch-mounts"); /* G_FILE_MONITOR_WATCH_MOUNTS */
252 DEFSYM (Qsend_moved, "send-moved"); /* G_FILE_MONITOR_SEND_MOVED */ 302 DEFSYM (Qsend_moved, "send-moved"); /* G_FILE_MONITOR_SEND_MOVED */
253 303
diff --git a/src/image.c b/src/image.c
index 85cf801f6a9..b586c5341d7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -797,7 +797,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
797 return 0; 797 return 0;
798 798
799 case IMAGE_NUMBER_VALUE: 799 case IMAGE_NUMBER_VALUE:
800 if (!INTEGERP (value) && !FLOATP (value)) 800 if (! NUMBERP (value))
801 return 0; 801 return 0;
802 break; 802 break;
803 803
@@ -7499,6 +7499,12 @@ gif_image_p (Lisp_Object object)
7499# define GIFLIB_MAJOR 4 7499# define GIFLIB_MAJOR 4
7500# endif 7500# endif
7501 7501
7502/* GifErrorString is declared to return char const * when GIFLIB_MAJOR
7503 and GIFLIB_MINOR indicate 5.1 or later. Do not bother using it in
7504 earlier releases, where either it returns char * or GIFLIB_MINOR
7505 may be incorrect. */
7506# define HAVE_GIFERRORSTRING (5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR))
7507
7502# ifdef WINDOWSNT 7508# ifdef WINDOWSNT
7503 7509
7504/* GIF library details. */ 7510/* GIF library details. */
@@ -7514,7 +7520,9 @@ DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *));
7514# else 7520# else
7515DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); 7521DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
7516DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); 7522DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
7517DEF_DLL_FN (char *, GifErrorString, (int)); 7523# endif
7524# if HAVE_GIFERRORSTRING
7525DEF_DLL_FN (char const *, GifErrorString, (int));
7518# endif 7526# endif
7519 7527
7520static bool 7528static bool
@@ -7529,7 +7537,7 @@ init_gif_functions (void)
7529 LOAD_DLL_FN (library, DGifSlurp); 7537 LOAD_DLL_FN (library, DGifSlurp);
7530 LOAD_DLL_FN (library, DGifOpen); 7538 LOAD_DLL_FN (library, DGifOpen);
7531 LOAD_DLL_FN (library, DGifOpenFileName); 7539 LOAD_DLL_FN (library, DGifOpenFileName);
7532# if GIFLIB_MAJOR >= 5 7540# if HAVE_GIFERRORSTRING
7533 LOAD_DLL_FN (library, GifErrorString); 7541 LOAD_DLL_FN (library, GifErrorString);
7534# endif 7542# endif
7535 return 1; 7543 return 1;
@@ -7641,20 +7649,19 @@ gif_load (struct frame *f, struct image *img)
7641 /* Open the GIF file. */ 7649 /* Open the GIF file. */
7642#if GIFLIB_MAJOR < 5 7650#if GIFLIB_MAJOR < 5
7643 gif = DGifOpenFileName (SSDATA (encoded_file)); 7651 gif = DGifOpenFileName (SSDATA (encoded_file));
7644 if (gif == NULL)
7645 {
7646 image_error ("Cannot open `%s'", file);
7647 return 0;
7648 }
7649#else 7652#else
7650 gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err); 7653 gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
7654#endif
7651 if (gif == NULL) 7655 if (gif == NULL)
7652 { 7656 {
7657#if HAVE_GIFERRORSTRING
7653 image_error ("Cannot open `%s': %s", 7658 image_error ("Cannot open `%s': %s",
7654 file, build_string (GifErrorString (gif_err))); 7659 file, build_string (GifErrorString (gif_err)));
7660#else
7661 image_error ("Cannot open `%s'", file);
7662#endif
7655 return 0; 7663 return 0;
7656 } 7664 }
7657#endif
7658 } 7665 }
7659 else 7666 else
7660 { 7667 {
@@ -7672,20 +7679,19 @@ gif_load (struct frame *f, struct image *img)
7672 7679
7673#if GIFLIB_MAJOR < 5 7680#if GIFLIB_MAJOR < 5
7674 gif = DGifOpen (&memsrc, gif_read_from_memory); 7681 gif = DGifOpen (&memsrc, gif_read_from_memory);
7675 if (!gif)
7676 {
7677 image_error ("Cannot open memory source `%s'", img->spec);
7678 return 0;
7679 }
7680#else 7682#else
7681 gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err); 7683 gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
7684#endif
7682 if (!gif) 7685 if (!gif)
7683 { 7686 {
7687#if HAVE_GIFERRORSTRING
7684 image_error ("Cannot open memory source `%s': %s", 7688 image_error ("Cannot open memory source `%s': %s",
7685 img->spec, build_string (GifErrorString (gif_err))); 7689 img->spec, build_string (GifErrorString (gif_err)));
7690#else
7691 image_error ("Cannot open memory source `%s'", img->spec);
7692#endif
7686 return 0; 7693 return 0;
7687 } 7694 }
7688#endif
7689 } 7695 }
7690 7696
7691 /* Before reading entire contents, check the declared image size. */ 7697 /* Before reading entire contents, check the declared image size. */
@@ -7980,8 +7986,8 @@ gif_load (struct frame *f, struct image *img)
7980 7986
7981 if (gif_close (gif, &gif_err) == GIF_ERROR) 7987 if (gif_close (gif, &gif_err) == GIF_ERROR)
7982 { 7988 {
7983#if 5 <= GIFLIB_MAJOR 7989#if HAVE_GIFERRORSTRING
7984 char *error_text = GifErrorString (gif_err); 7990 char const *error_text = GifErrorString (gif_err);
7985 7991
7986 if (error_text) 7992 if (error_text)
7987 image_error ("Error closing `%s': %s", 7993 image_error ("Error closing `%s': %s",
diff --git a/src/indent.c b/src/indent.c
index 7e8f0a573a3..584f2179bc5 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -485,7 +485,9 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos)
485 : MOST_POSITIVE_FIXNUM); 485 : MOST_POSITIVE_FIXNUM);
486 486
487 if ((prop = Fplist_get (plist, QCwidth), 487 if ((prop = Fplist_get (plist, QCwidth),
488 RANGED_INTEGERP (0, prop, INT_MAX))) 488 RANGED_INTEGERP (0, prop, INT_MAX))
489 || (prop = Fplist_get (plist, QCrelative_width),
490 RANGED_INTEGERP (0, prop, INT_MAX)))
489 width = XINT (prop); 491 width = XINT (prop);
490 else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) 492 else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop)
491 && XFLOAT_DATA (prop) <= INT_MAX) 493 && XFLOAT_DATA (prop) <= INT_MAX)
@@ -504,6 +506,18 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos)
504 *endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); 506 *endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
505 else 507 else
506 get_property_and_range (pos, Qdisplay, &val, &start, endpos, Qnil); 508 get_property_and_range (pos, Qdisplay, &val, &start, endpos, Qnil);
509
510 /* For :relative-width, we need to multiply by the column
511 width of the character at POS, if it is greater than 1. */
512 if (!NILP (Fplist_get (plist, QCrelative_width))
513 && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
514 {
515 int b, wd;
516 unsigned char *p = BYTE_POS_ADDR (CHAR_TO_BYTE (pos));
517
518 MULTIBYTE_BYTES_WIDTH (p, buffer_display_table (), b, wd);
519 width *= wd;
520 }
507 return width; 521 return width;
508 } 522 }
509 } 523 }
@@ -2195,7 +2209,27 @@ whether or not it is currently displayed in some window. */)
2195 was originally hscrolled, the goal column is interpreted as 2209 was originally hscrolled, the goal column is interpreted as
2196 an addition to the hscroll amount. */ 2210 an addition to the hscroll amount. */
2197 if (lcols_given) 2211 if (lcols_given)
2198 move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X); 2212 {
2213 move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
2214 /* If we find ourselves in the middle of an overlay string
2215 which includes a newline after current string position,
2216 we need to move by lines until we get out of the string,
2217 and then reposition point at the requested X coordinate;
2218 if we don't, the cursor will be placed just after the
2219 string, which might not be the requested column. */
2220 if (nlines > 0 && it.area == TEXT_AREA)
2221 {
2222 while (it.method == GET_FROM_STRING
2223 && !it.string_from_display_prop_p
2224 && memchr (SSDATA (it.string) + IT_STRING_BYTEPOS (it),
2225 '\n',
2226 SBYTES (it.string) - IT_STRING_BYTEPOS (it)))
2227 {
2228 move_it_by_lines (&it, 1);
2229 move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
2230 }
2231 }
2232 }
2199 2233
2200 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 2234 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
2201 bidi_unshelve_cache (itdata, 0); 2235 bidi_unshelve_cache (itdata, 0);
diff --git a/src/inotify.c b/src/inotify.c
index eddad73e8f7..be8c1dd7553 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "frame.h" /* Required for termhooks.h. */ 29#include "frame.h" /* Required for termhooks.h. */
30#include "termhooks.h" 30#include "termhooks.h"
31 31
32#include <errno.h>
32#include <sys/inotify.h> 33#include <sys/inotify.h>
33#include <sys/ioctl.h> 34#include <sys/ioctl.h>
34 35
@@ -129,17 +130,14 @@ inotify_callback (int fd, void *_)
129 130
130 to_read = 0; 131 to_read = 0;
131 if (ioctl (fd, FIONREAD, &to_read) == -1) 132 if (ioctl (fd, FIONREAD, &to_read) == -1)
132 xsignal1 133 report_file_notify_error ("Error while retrieving file system events",
133 (Qfile_notify_error, 134 Qnil);
134 build_string ("Error while trying to retrieve file system events"));
135 buffer = xmalloc (to_read); 135 buffer = xmalloc (to_read);
136 n = read (fd, buffer, to_read); 136 n = read (fd, buffer, to_read);
137 if (n < 0) 137 if (n < 0)
138 { 138 {
139 xfree (buffer); 139 xfree (buffer);
140 xsignal1 140 report_file_notify_error ("Error while reading file system events", Qnil);
141 (Qfile_notify_error,
142 build_string ("Error while trying to read file system events"));
143 } 141 }
144 142
145 EVENT_INIT (event); 143 EVENT_INIT (event);
@@ -215,7 +213,10 @@ symbol_to_inotifymask (Lisp_Object symb)
215 else if (EQ (symb, Qt) || EQ (symb, Qall_events)) 213 else if (EQ (symb, Qt) || EQ (symb, Qall_events))
216 return IN_ALL_EVENTS; 214 return IN_ALL_EVENTS;
217 else 215 else
218 xsignal2 (Qfile_notify_error, build_string ("Unknown aspect"), symb); 216 {
217 errno = EINVAL;
218 report_file_notify_error ("Unknown aspect", symb);
219 }
219} 220}
220 221
221static uint32_t 222static uint32_t
@@ -307,9 +308,7 @@ is managed internally and there is no corresponding inotify_init. Use
307 { 308 {
308 inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC); 309 inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC);
309 if (inotifyfd < 0) 310 if (inotifyfd < 0)
310 xsignal1 311 report_file_notify_error ("File watching is not available", Qnil);
311 (Qfile_notify_error,
312 build_string ("File watching feature (inotify) is not available"));
313 watch_list = Qnil; 312 watch_list = Qnil;
314 add_read_fd (inotifyfd, &inotify_callback, NULL); 313 add_read_fd (inotifyfd, &inotify_callback, NULL);
315 } 314 }
@@ -318,17 +317,16 @@ is managed internally and there is no corresponding inotify_init. Use
318 encoded_file_name = ENCODE_FILE (file_name); 317 encoded_file_name = ENCODE_FILE (file_name);
319 watchdesc = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask); 318 watchdesc = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask);
320 if (watchdesc == -1) 319 if (watchdesc == -1)
321 xsignal2 (Qfile_notify_error, 320 report_file_notify_error ("Could not add watch for file", file_name);
322 build_string ("Could not add watch for file"), file_name);
323 321
324 watch_descriptor = make_watch_descriptor (watchdesc); 322 watch_descriptor = make_watch_descriptor (watchdesc);
325 323
326 /* Delete existing watch object. */ 324 /* Delete existing watch object. */
327 watch_object = Fassoc (watch_descriptor, watch_list); 325 watch_object = Fassoc (watch_descriptor, watch_list);
328 if (!NILP (watch_object)) 326 if (!NILP (watch_object))
329 watch_list = Fdelete (watch_object, watch_list); 327 watch_list = Fdelete (watch_object, watch_list);
330 328
331 /* Store watch object in watch list. */ 329 /* Store watch object in watch list. */
332 watch_object = Fcons (watch_descriptor, callback); 330 watch_object = Fcons (watch_descriptor, callback);
333 watch_list = Fcons (watch_object, watch_list); 331 watch_list = Fcons (watch_object, watch_list);
334 332
@@ -348,15 +346,14 @@ See inotify_rm_watch(2) for more information.
348 int wd = XINT (watch_descriptor); 346 int wd = XINT (watch_descriptor);
349 347
350 if (inotify_rm_watch (inotifyfd, wd) == -1) 348 if (inotify_rm_watch (inotifyfd, wd) == -1)
351 xsignal2 (Qfile_notify_error, 349 report_file_notify_error ("Could not rm watch", watch_descriptor);
352 build_string ("Could not rm watch"), watch_descriptor);
353 350
354 /* Remove watch descriptor from watch list. */ 351 /* Remove watch descriptor from watch list. */
355 watch_object = Fassoc (watch_descriptor, watch_list); 352 watch_object = Fassoc (watch_descriptor, watch_list);
356 if (!NILP (watch_object)) 353 if (!NILP (watch_object))
357 watch_list = Fdelete (watch_object, watch_list); 354 watch_list = Fdelete (watch_object, watch_list);
358 355
359 /* Cleanup if no more files are watched. */ 356 /* Cleanup if no more files are watched. */
360 if (NILP (watch_list)) 357 if (NILP (watch_list))
361 { 358 {
362 emacs_close (inotifyfd); 359 emacs_close (inotifyfd);
@@ -367,6 +364,21 @@ See inotify_rm_watch(2) for more information.
367 return Qt; 364 return Qt;
368} 365}
369 366
367DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0,
368 doc: /* "Check a watch specified by its WATCH-DESCRIPTOR.
369
370WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'.
371
372A watch can become invalid if the file or directory it watches is
373deleted, or if the watcher thread exits abnormally for any other
374reason. Removing the watch by calling `inotify-rm-watch' also makes
375it invalid. */)
376 (Lisp_Object watch_descriptor)
377{
378 Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list);
379 return NILP (watch_object) ? Qnil : Qt;
380}
381
370void 382void
371syms_of_inotify (void) 383syms_of_inotify (void)
372{ 384{
@@ -401,6 +413,7 @@ syms_of_inotify (void)
401 413
402 defsubr (&Sinotify_add_watch); 414 defsubr (&Sinotify_add_watch);
403 defsubr (&Sinotify_rm_watch); 415 defsubr (&Sinotify_rm_watch);
416 defsubr (&Sinotify_valid_p);
404 417
405 staticpro (&watch_list); 418 staticpro (&watch_list);
406 419
diff --git a/src/keyboard.c b/src/keyboard.c
index ccd340557dd..966af69c97b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11332,7 +11332,7 @@ See Info node `(elisp)Multiple Terminals'. */);
11332 11332
11333 DEFVAR_BOOL ("cannot-suspend", cannot_suspend, 11333 DEFVAR_BOOL ("cannot-suspend", cannot_suspend,
11334 doc: /* Non-nil means to always spawn a subshell instead of suspending. 11334 doc: /* Non-nil means to always spawn a subshell instead of suspending.
11335\(Even if the operating system has support for stopping a process.\) */); 11335(Even if the operating system has support for stopping a process.) */);
11336 cannot_suspend = false; 11336 cannot_suspend = false;
11337 11337
11338 DEFVAR_BOOL ("menu-prompting", menu_prompting, 11338 DEFVAR_BOOL ("menu-prompting", menu_prompting,
@@ -11538,7 +11538,7 @@ immediately after running `post-command-hook'. */);
11538 DEFVAR_LISP ("input-method-function", Vinput_method_function, 11538 DEFVAR_LISP ("input-method-function", Vinput_method_function,
11539 doc: /* If non-nil, the function that implements the current input method. 11539 doc: /* If non-nil, the function that implements the current input method.
11540It's called with one argument, a printing character that was just read. 11540It's called with one argument, a printing character that was just read.
11541\(That means a character with code 040...0176.) 11541(That means a character with code 040...0176.)
11542Typically this function uses `read-event' to read additional events. 11542Typically this function uses `read-event' to read additional events.
11543When it does so, it should first bind `input-method-function' to nil 11543When it does so, it should first bind `input-method-function' to nil
11544so it will not be called recursively. 11544so it will not be called recursively.
diff --git a/src/keymap.c b/src/keymap.c
index 3668d4b24e2..6a8d129ce2b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1687,7 +1687,7 @@ DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0,
1687KEYS is a string or vector, a sequence of keystrokes. 1687KEYS is a string or vector, a sequence of keystrokes.
1688The binding is probably a symbol with a function definition. 1688The binding is probably a symbol with a function definition.
1689This function's return values are the same as those of `lookup-key' 1689This function's return values are the same as those of `lookup-key'
1690\(which see). 1690(which see).
1691 1691
1692If optional argument ACCEPT-DEFAULT is non-nil, recognize default 1692If optional argument ACCEPT-DEFAULT is non-nil, recognize default
1693bindings; see the description of `lookup-key' for more details about this. */) 1693bindings; see the description of `lookup-key' for more details about this. */)
@@ -2492,7 +2492,7 @@ If FIRSTONLY is the symbol `non-ascii', return the first binding found,
2492no matter what it is. 2492no matter what it is.
2493If FIRSTONLY has another non-nil value, prefer bindings 2493If FIRSTONLY has another non-nil value, prefer bindings
2494that use the modifier key specified in `where-is-preferred-modifier' 2494that use the modifier key specified in `where-is-preferred-modifier'
2495\(or their meta variants) and entirely reject menu bindings. 2495(or their meta variants) and entirely reject menu bindings.
2496 2496
2497If optional 4th arg NOINDIRECT is non-nil, don't extract the commands inside 2497If optional 4th arg NOINDIRECT is non-nil, don't extract the commands inside
2498menu-items. This makes it possible to search for a menu-item itself. 2498menu-items. This makes it possible to search for a menu-item itself.
@@ -2723,7 +2723,7 @@ looked up in BUFFER.
2723The optional argument PREFIX, if non-nil, should be a key sequence; 2723The optional argument PREFIX, if non-nil, should be a key sequence;
2724then we display only bindings that start with that prefix. 2724then we display only bindings that start with that prefix.
2725The optional argument MENUS, if non-nil, says to mention menu bindings. 2725The optional argument MENUS, if non-nil, says to mention menu bindings.
2726\(Ordinarily these are omitted from the output.) */) 2726(Ordinarily these are omitted from the output.) */)
2727 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) 2727 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
2728{ 2728{
2729 Lisp_Object outbuf, shadow; 2729 Lisp_Object outbuf, shadow;
diff --git a/src/lisp.h b/src/lisp.h
index d2d385605ce..2d6661787cf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,4 +1,4 @@
1/* Fundamental definitions for GNU Emacs Lisp interpreter. 1/* Fundamental definitions for GNU Emacs Lisp interpreter. -*- coding: utf-8 -*-
2 2
3Copyright (C) 1985-1987, 1993-1995, 1997-2015 Free Software Foundation, 3Copyright (C) 1985-1987, 1993-1995, 1997-2015 Free Software Foundation,
4Inc. 4Inc.
@@ -2736,7 +2736,7 @@ XFLOATINT (Lisp_Object n)
2736INLINE void 2736INLINE void
2737CHECK_NUMBER_OR_FLOAT (Lisp_Object x) 2737CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
2738{ 2738{
2739 CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x); 2739 CHECK_TYPE (NUMBERP (x), Qnumberp, x);
2740} 2740}
2741 2741
2742#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \ 2742#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
@@ -2744,7 +2744,7 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
2744 if (MARKERP (x)) \ 2744 if (MARKERP (x)) \
2745 XSETFASTINT (x, marker_position (x)); \ 2745 XSETFASTINT (x, marker_position (x)); \
2746 else \ 2746 else \
2747 CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); \ 2747 CHECK_TYPE (NUMBERP (x), Qnumber_or_marker_p, x); \
2748 } while (false) 2748 } while (false)
2749 2749
2750/* Since we can't assign directly to the CAR or CDR fields of a cons 2750/* Since we can't assign directly to the CAR or CDR fields of a cons
@@ -3840,6 +3840,7 @@ extern void fclose_unwind (void *);
3840extern void restore_point_unwind (Lisp_Object); 3840extern void restore_point_unwind (Lisp_Object);
3841extern _Noreturn void report_file_errno (const char *, Lisp_Object, int); 3841extern _Noreturn void report_file_errno (const char *, Lisp_Object, int);
3842extern _Noreturn void report_file_error (const char *, Lisp_Object); 3842extern _Noreturn void report_file_error (const char *, Lisp_Object);
3843extern _Noreturn void report_file_notify_error (const char *, Lisp_Object);
3843extern bool internal_delete_file (Lisp_Object); 3844extern bool internal_delete_file (Lisp_Object);
3844extern Lisp_Object emacs_readlinkat (int, const char *); 3845extern Lisp_Object emacs_readlinkat (int, const char *);
3845extern bool file_directory_p (const char *); 3846extern bool file_directory_p (const char *);
@@ -4352,12 +4353,13 @@ INLINE ptrdiff_t
4352lisp_word_count (ptrdiff_t nbytes) 4353lisp_word_count (ptrdiff_t nbytes)
4353{ 4354{
4354 if (-1 >> 1 == -1) 4355 if (-1 >> 1 == -1)
4355 switch (word_size) 4356 switch (word_size + 0)
4356 { 4357 {
4357 case 2: return nbytes >> 1; 4358 case 2: return nbytes >> 1;
4358 case 4: return nbytes >> 2; 4359 case 4: return nbytes >> 2;
4359 case 8: return nbytes >> 3; 4360 case 8: return nbytes >> 3;
4360 case 16: return nbytes >> 4; 4361 case 16: return nbytes >> 4;
4362 default: break;
4361 } 4363 }
4362 return nbytes / word_size - (nbytes % word_size < 0); 4364 return nbytes / word_size - (nbytes % word_size < 0);
4363} 4365}
diff --git a/src/lread.c b/src/lread.c
index 6099545a808..bceec4bb644 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4512,7 +4512,7 @@ customize `jka-compr-load-suffixes' rather than the present variable. */);
4512Each element looks like (REGEXP-OR-FEATURE FUNCS...). 4512Each element looks like (REGEXP-OR-FEATURE FUNCS...).
4513 4513
4514REGEXP-OR-FEATURE is either a regular expression to match file names, or 4514REGEXP-OR-FEATURE is either a regular expression to match file names, or
4515a symbol \(a feature name). 4515a symbol (a feature name).
4516 4516
4517When `load' is run and the file-name argument matches an element's 4517When `load' is run and the file-name argument matches an element's
4518REGEXP-OR-FEATURE, or when `provide' is run and provides the symbol 4518REGEXP-OR-FEATURE, or when `provide' is run and provides the symbol
diff --git a/src/macfont.m b/src/macfont.m
index 23d272c9129..97a255bf018 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -945,13 +945,7 @@ macfont_set_family_cache (Lisp_Object symbol, CFStringRef string)
945 Lisp_Object value; 945 Lisp_Object value;
946 946
947 if (!HASH_TABLE_P (macfont_family_cache)) 947 if (!HASH_TABLE_P (macfont_family_cache))
948 { 948 macfont_family_cache = CALLN (Fmake_hash_table, QCtest, Qeq);
949 Lisp_Object args[2];
950
951 args[0] = QCtest;
952 args[1] = Qeq;
953 macfont_family_cache = Fmake_hash_table (2, args);
954 }
955 949
956 h = XHASH_TABLE (macfont_family_cache); 950 h = XHASH_TABLE (macfont_family_cache);
957 i = hash_lookup (h, symbol, &hash); 951 i = hash_lookup (h, symbol, &hash);
diff --git a/src/menu.c b/src/menu.c
index e36fe260f24..dc82809629a 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1129,7 +1129,7 @@ If POSITION is t, it means to use the current mouse position.
1129MENU is a specifier for a menu. For the simplest case, MENU is a keymap. 1129MENU is a specifier for a menu. For the simplest case, MENU is a keymap.
1130The menu items come from key bindings that have a menu string as well as 1130The menu items come from key bindings that have a menu string as well as
1131a definition; actually, the "definition" in such a key binding looks like 1131a definition; actually, the "definition" in such a key binding looks like
1132\(STRING . REAL-DEFINITION). To give the menu a title, put a string into 1132(STRING . REAL-DEFINITION). To give the menu a title, put a string into
1133the keymap as a top-level element. 1133the keymap as a top-level element.
1134 1134
1135If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. 1135If REAL-DEFINITION is nil, that puts a nonselectable string in the menu.
@@ -1491,7 +1491,7 @@ The return value is VALUE from the chosen item.
1491An ITEM may also be just a string--that makes a nonselectable item. 1491An ITEM may also be just a string--that makes a nonselectable item.
1492An ITEM may also be nil--that means to put all preceding items 1492An ITEM may also be nil--that means to put all preceding items
1493on the left of the dialog box and all following items on the right. 1493on the left of the dialog box and all following items on the right.
1494\(By default, approximately half appear on each side.) 1494(By default, approximately half appear on each side.)
1495 1495
1496If HEADER is non-nil, the frame title for the box is "Information", 1496If HEADER is non-nil, the frame title for the box is "Information",
1497otherwise it is "Question". 1497otherwise it is "Question".
diff --git a/src/minibuf.c b/src/minibuf.c
index cf0cbca77c1..4e5c17d074c 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -916,7 +916,7 @@ INITIAL-CONTENTS argument in more detail. It is only relevant when
916studying existing code, or when HIST is a cons. If non-nil, 916studying existing code, or when HIST is a cons. If non-nil,
917INITIAL-CONTENTS is a string to be inserted into the minibuffer before 917INITIAL-CONTENTS is a string to be inserted into the minibuffer before
918reading input. Normally, point is put at the end of that string. 918reading input. Normally, point is put at the end of that string.
919However, if INITIAL-CONTENTS is \(STRING . POSITION), the initial 919However, if INITIAL-CONTENTS is (STRING . POSITION), the initial
920input is STRING, but point is placed at _one-indexed_ position 920input is STRING, but point is placed at _one-indexed_ position
921POSITION in the minibuffer. Any integer value less than or equal to 921POSITION in the minibuffer. Any integer value less than or equal to
922one puts point at the beginning of the string. *Note* that this 922one puts point at the beginning of the string. *Note* that this
@@ -996,7 +996,7 @@ DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1,
996Prompt with PROMPT. Whitespace terminates the input. If INITIAL is 996Prompt with PROMPT. Whitespace terminates the input. If INITIAL is
997non-nil, it should be a string, which is used as initial input, with 997non-nil, it should be a string, which is used as initial input, with
998point positioned at the end, so that SPACE will accept the input. 998point positioned at the end, so that SPACE will accept the input.
999\(Actually, INITIAL can also be a cons of a string and an integer. 999(Actually, INITIAL can also be a cons of a string and an integer.
1000Such values are treated as in `read-from-minibuffer', but are normally 1000Such values are treated as in `read-from-minibuffer', but are normally
1001not useful in this function.) 1001not useful in this function.)
1002Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits 1002Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
diff --git a/src/nsfns.m b/src/nsfns.m
index 89b9f7c4b62..ad71a508248 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1009,7 +1009,7 @@ unwind_create_frame (Lisp_Object frame)
1009 x_free_frame_resources (f); 1009 x_free_frame_resources (f);
1010 free_glyphs (f); 1010 free_glyphs (f);
1011 1011
1012#ifdef GLYPH_DEBUG 1012#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
1013 /* Check that reference counts are indeed correct. */ 1013 /* Check that reference counts are indeed correct. */
1014 eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); 1014 eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
1015#endif 1015#endif
@@ -1639,7 +1639,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
1639 1639
1640DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 1640DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
1641 doc: /* Return the "vendor ID" string of Nextstep display server TERMINAL. 1641 doc: /* Return the "vendor ID" string of Nextstep display server TERMINAL.
1642\(Labeling every distributor as a "vendor" embodies the false assumption 1642(Labeling every distributor as a "vendor" embodies the false assumption
1643that operating systems cannot be developed and distributed noncommercially.) 1643that operating systems cannot be developed and distributed noncommercially.)
1644The optional argument TERMINAL specifies which display to ask about. 1644The optional argument TERMINAL specifies which display to ask about.
1645TERMINAL should be a terminal object, a frame or a display name (a string). 1645TERMINAL should be a terminal object, a frame or a display name (a string).
@@ -1816,7 +1816,7 @@ DISPLAY is the name of the display to connect to.
1816Optional second arg XRM-STRING is a string of resources in xrdb format. 1816Optional second arg XRM-STRING is a string of resources in xrdb format.
1817If the optional third arg MUST-SUCCEED is non-nil, 1817If the optional third arg MUST-SUCCEED is non-nil,
1818terminate Emacs if we can't open the connection. 1818terminate Emacs if we can't open the connection.
1819\(In the Nextstep version, the last two arguments are currently ignored.) */) 1819(In the Nextstep version, the last two arguments are currently ignored.) */)
1820 (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) 1820 (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed)
1821{ 1821{
1822 struct ns_display_info *dpyinfo; 1822 struct ns_display_info *dpyinfo;
@@ -2289,7 +2289,7 @@ x_get_focus_frame (struct frame *frame)
2289 2289
2290DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 2290DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
2291 doc: /* Internal function called by `color-defined-p', which see. 2291 doc: /* Internal function called by `color-defined-p', which see.
2292\(Note that the Nextstep version of this function ignores FRAME.) */) 2292(Note that the Nextstep version of this function ignores FRAME.) */)
2293 (Lisp_Object color, Lisp_Object frame) 2293 (Lisp_Object color, Lisp_Object frame)
2294{ 2294{
2295 NSColor * col; 2295 NSColor * col;
diff --git a/src/nsselect.m b/src/nsselect.m
index 918fb55fb22..5579cc5a767 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -316,7 +316,7 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
316 Sns_own_selection_internal, 2, 2, 0, 316 Sns_own_selection_internal, 2, 2, 0,
317 doc: /* Assert an X selection of type SELECTION and value VALUE. 317 doc: /* Assert an X selection of type SELECTION and value VALUE.
318SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 318SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
319\(Those are literal upper-case symbol names, since that's what X expects.) 319(Those are literal upper-case symbol names, since that's what X expects.)
320VALUE is typically a string, or a cons of two markers, but may be 320VALUE is typically a string, or a cons of two markers, but may be
321anything that the functions on `selection-converter-alist' know about. */) 321anything that the functions on `selection-converter-alist' know about. */)
322 (Lisp_Object selection, Lisp_Object value) 322 (Lisp_Object selection, Lisp_Object value)
@@ -414,7 +414,7 @@ DEFUN ("ns-selection-owner-p", Fns_selection_owner_p, Sns_selection_owner_p,
414 doc: /* Whether the current Emacs process owns the given X Selection. 414 doc: /* Whether the current Emacs process owns the given X Selection.
415The arg should be the name of the selection in question, typically one of 415The arg should be the name of the selection in question, typically one of
416the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 416the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
417\(Those are literal upper-case symbol names, since that's what X expects.) 417(Those are literal upper-case symbol names, since that's what X expects.)
418For convenience, the symbol nil is the same as `PRIMARY', 418For convenience, the symbol nil is the same as `PRIMARY',
419and t is the same as `SECONDARY'. */) 419and t is the same as `SECONDARY'. */)
420 (Lisp_Object selection) 420 (Lisp_Object selection)
@@ -433,7 +433,7 @@ DEFUN ("ns-get-selection", Fns_get_selection,
433 Sns_get_selection, 2, 2, 0, 433 Sns_get_selection, 2, 2, 0,
434 doc: /* Return text selected from some X window. 434 doc: /* Return text selected from some X window.
435SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 435SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
436\(Those are literal upper-case symbol names, since that's what X expects.) 436(Those are literal upper-case symbol names, since that's what X expects.)
437TARGET-TYPE is the type of data desired, typically `STRING'. */) 437TARGET-TYPE is the type of data desired, typically `STRING'. */)
438 (Lisp_Object selection_name, Lisp_Object target_type) 438 (Lisp_Object selection_name, Lisp_Object target_type)
439{ 439{
diff --git a/src/nsterm.m b/src/nsterm.m
index 2806f31155d..a5bf06a70af 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1,4 +1,4 @@
1/* NeXT/Open/GNUstep / MacOSX communication module. 1/* NeXT/Open/GNUstep / MacOSX communication module. -*- coding: utf-8 -*-
2 2
3Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2015 Free Software 3Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2015 Free Software
4Foundation, Inc. 4Foundation, Inc.
@@ -440,10 +440,7 @@ append2 (Lisp_Object list, Lisp_Object item)
440 Utility to append to a list 440 Utility to append to a list
441 -------------------------------------------------------------------------- */ 441 -------------------------------------------------------------------------- */
442{ 442{
443 Lisp_Object array[2]; 443 return CALLN (Fnconc, list, list1 (item));
444 array[0] = list;
445 array[1] = list1 (item);
446 return Fnconc (2, &array[0]);
447} 444}
448 445
449 446
@@ -1333,6 +1330,7 @@ x_set_window_size (struct frame *f,
1333 int tb = FRAME_EXTERNAL_TOOL_BAR (f); 1330 int tb = FRAME_EXTERNAL_TOOL_BAR (f);
1334 int pixelwidth, pixelheight; 1331 int pixelwidth, pixelheight;
1335 int rows, cols; 1332 int rows, cols;
1333 int orig_height = wr.size.height;
1336 1334
1337 NSTRACE (x_set_window_size); 1335 NSTRACE (x_set_window_size);
1338 1336
@@ -1386,7 +1384,7 @@ x_set_window_size (struct frame *f,
1386 if (f->output_data.ns->zooming) 1384 if (f->output_data.ns->zooming)
1387 f->output_data.ns->zooming = 0; 1385 f->output_data.ns->zooming = 0;
1388 else 1386 else
1389 wr.origin.y += FRAME_PIXEL_HEIGHT (f) - pixelheight; 1387 wr.origin.y += orig_height - wr.size.height;
1390 1388
1391 [view setRows: rows andColumns: cols]; 1389 [view setRows: rows andColumns: cols];
1392 [window setFrame: wr display: YES]; 1390 [window setFrame: wr display: YES];
diff --git a/src/print.c b/src/print.c
index 94f3fcd7db1..3c3dca77000 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2198,7 +2198,7 @@ Also print formfeeds as `\\f'. */);
2198 2198
2199 DEFVAR_BOOL ("print-escape-nonascii", print_escape_nonascii, 2199 DEFVAR_BOOL ("print-escape-nonascii", print_escape_nonascii,
2200 doc: /* Non-nil means print unibyte non-ASCII chars in strings as \\OOO. 2200 doc: /* Non-nil means print unibyte non-ASCII chars in strings as \\OOO.
2201\(OOO is the octal representation of the character code.) 2201(OOO is the octal representation of the character code.)
2202Only single-byte characters are affected, and only in `prin1'. 2202Only single-byte characters are affected, and only in `prin1'.
2203When the output goes in a multibyte buffer, this feature is 2203When the output goes in a multibyte buffer, this feature is
2204enabled regardless of the value of the variable. */); 2204enabled regardless of the value of the variable. */);
@@ -2206,7 +2206,7 @@ enabled regardless of the value of the variable. */);
2206 2206
2207 DEFVAR_BOOL ("print-escape-multibyte", print_escape_multibyte, 2207 DEFVAR_BOOL ("print-escape-multibyte", print_escape_multibyte,
2208 doc: /* Non-nil means print multibyte characters in strings as \\xXXXX. 2208 doc: /* Non-nil means print multibyte characters in strings as \\xXXXX.
2209\(XXXX is the hex representation of the character code.) 2209(XXXX is the hex representation of the character code.)
2210This affects only `prin1'. */); 2210This affects only `prin1'. */);
2211 print_escape_multibyte = 0; 2211 print_escape_multibyte = 0;
2212 2212
diff --git a/src/process.c b/src/process.c
index f4613be28ed..42dd17c57e0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -957,7 +957,7 @@ DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
957This is a list of strings, the first string being the program executed 957This is a list of strings, the first string being the program executed
958and the rest of the strings being the arguments given to it. 958and the rest of the strings being the arguments given to it.
959For a network or serial process, this is nil (process is running) or t 959For a network or serial process, this is nil (process is running) or t
960\(process is stopped). */) 960(process is stopped). */)
961 (register Lisp_Object process) 961 (register Lisp_Object process)
962{ 962{
963 CHECK_PROCESS (process); 963 CHECK_PROCESS (process);
@@ -2674,7 +2674,7 @@ is not given or nil, 1 stopbit is used.
2674:flowcontrol FLOWCONTROL -- FLOWCONTROL determines the type of 2674:flowcontrol FLOWCONTROL -- FLOWCONTROL determines the type of
2675flowcontrol to be used, which is either nil (don't use flowcontrol), 2675flowcontrol to be used, which is either nil (don't use flowcontrol),
2676the symbol `hw' (use RTS/CTS hardware flowcontrol), or the symbol `sw' 2676the symbol `hw' (use RTS/CTS hardware flowcontrol), or the symbol `sw'
2677\(use XON/XOFF software flowcontrol). If FLOWCONTROL is not given, no 2677(use XON/XOFF software flowcontrol). If FLOWCONTROL is not given, no
2678flowcontrol is used. 2678flowcontrol is used.
2679 2679
2680`serial-process-configure' is called by `make-serial-process' for the 2680`serial-process-configure' is called by `make-serial-process' for the
@@ -2682,12 +2682,12 @@ initial configuration of the serial port.
2682 2682
2683Examples: 2683Examples:
2684 2684
2685\(serial-process-configure :process "/dev/ttyS0" :speed 1200) 2685(serial-process-configure :process "/dev/ttyS0" :speed 1200)
2686 2686
2687\(serial-process-configure 2687(serial-process-configure
2688 :buffer "COM1" :stopbits 1 :parity \\='odd :flowcontrol \\='hw) 2688 :buffer "COM1" :stopbits 1 :parity \\='odd :flowcontrol \\='hw)
2689 2689
2690\(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) 2690(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
2691 2691
2692usage: (serial-process-configure &rest ARGS) */) 2692usage: (serial-process-configure &rest ARGS) */)
2693 (ptrdiff_t nargs, Lisp_Object *args) 2693 (ptrdiff_t nargs, Lisp_Object *args)
@@ -2781,13 +2781,13 @@ is available via the function `process-contact'.
2781 2781
2782Examples: 2782Examples:
2783 2783
2784\(make-serial-process :port "/dev/ttyS0" :speed 9600) 2784(make-serial-process :port "/dev/ttyS0" :speed 9600)
2785 2785
2786\(make-serial-process :port "COM1" :speed 115200 :stopbits 2) 2786(make-serial-process :port "COM1" :speed 115200 :stopbits 2)
2787 2787
2788\(make-serial-process :port "\\\\.\\COM13" :speed 1200 :bytesize 7 :parity \\='odd) 2788(make-serial-process :port "\\\\.\\COM13" :speed 1200 :bytesize 7 :parity \\='odd)
2789 2789
2790\(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) 2790(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
2791 2791
2792usage: (make-serial-process &rest ARGS) */) 2792usage: (make-serial-process &rest ARGS) */)
2793 (ptrdiff_t nargs, Lisp_Object *args) 2793 (ptrdiff_t nargs, Lisp_Object *args)
@@ -5031,12 +5031,18 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5031 for (channel = 0; channel <= max_input_desc; ++channel) 5031 for (channel = 0; channel <= max_input_desc; ++channel)
5032 { 5032 {
5033 struct fd_callback_data *d = &fd_callback_info[channel]; 5033 struct fd_callback_data *d = &fd_callback_info[channel];
5034 if (d->func 5034 if (d->func)
5035 && ((d->condition & FOR_READ 5035 {
5036 && FD_ISSET (channel, &Available)) 5036 if (d->condition & FOR_READ
5037 || (d->condition & FOR_WRITE 5037 && FD_ISSET (channel, &Available))
5038 && FD_ISSET (channel, &write_mask)))) 5038 {
5039 d->func (channel, d->data); 5039 d->func (channel, d->data);
5040 FD_CLR (channel, &Available);
5041 }
5042 else if (d->condition & FOR_WRITE
5043 && FD_ISSET (channel, &write_mask))
5044 d->func (channel, d->data);
5045 }
5040 } 5046 }
5041 5047
5042 for (channel = 0; channel <= max_process_desc; channel++) 5048 for (channel = 0; channel <= max_process_desc; channel++)
@@ -6269,7 +6275,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6269 { 6275 {
6270 Lisp_Object process_number 6276 Lisp_Object process_number
6271 = string_to_number (SSDATA (process), 10, 1); 6277 = string_to_number (SSDATA (process), 10, 1);
6272 if (INTEGERP (process_number) || FLOATP (process_number)) 6278 if (NUMBERP (process_number))
6273 tem = process_number; 6279 tem = process_number;
6274 } 6280 }
6275 process = tem; 6281 process = tem;
@@ -6694,10 +6700,12 @@ status_notify (struct Lisp_Process *deleting_process,
6694 p->update_tick = p->tick; 6700 p->update_tick = p->tick;
6695 /* Now output the message suitably. */ 6701 /* Now output the message suitably. */
6696 exec_sentinel (proc, msg); 6702 exec_sentinel (proc, msg);
6703 if (BUFFERP (p->buffer))
6704 /* In case it uses %s in mode-line-format. */
6705 bset_update_mode_line (XBUFFER (p->buffer));
6697 } 6706 }
6698 } /* end for */ 6707 } /* end for */
6699 6708
6700 update_mode_lines = 24; /* In case buffers use %s in mode-line-format. */
6701 return got_some_output; 6709 return got_some_output;
6702} 6710}
6703 6711
@@ -7294,7 +7302,7 @@ DEFUN ("process-attributes", Fprocess_attributes,
7294 7302
7295Value is an alist where each element is a cons cell of the form 7303Value is an alist where each element is a cons cell of the form
7296 7304
7297 \(KEY . VALUE) 7305 (KEY . VALUE)
7298 7306
7299If this functionality is unsupported, the value is nil. 7307If this functionality is unsupported, the value is nil.
7300 7308
diff --git a/src/process.h b/src/process.h
index e889055dc23..24bad45a24b 100644
--- a/src/process.h
+++ b/src/process.h
@@ -43,25 +43,25 @@ struct Lisp_Process
43 /* Name of subprocess terminal. */ 43 /* Name of subprocess terminal. */
44 Lisp_Object tty_name; 44 Lisp_Object tty_name;
45 45
46 /* Name of this process */ 46 /* Name of this process. */
47 Lisp_Object name; 47 Lisp_Object name;
48 48
49 /* List of command arguments that this process was run with. 49 /* List of command arguments that this process was run with.
50 Is set to t for a stopped network process; nil otherwise. */ 50 Is set to t for a stopped network process; nil otherwise. */
51 Lisp_Object command; 51 Lisp_Object command;
52 52
53 /* (funcall FILTER PROC STRING) (if FILTER is non-nil) 53 /* (funcall FILTER PROC STRING) (if FILTER is non-nil)
54 to dispose of a bunch of chars from the process all at once */ 54 to dispose of a bunch of chars from the process all at once. */
55 Lisp_Object filter; 55 Lisp_Object filter;
56 56
57 /* (funcall SENTINEL PROCESS) when process state changes */ 57 /* (funcall SENTINEL PROCESS) when process state changes. */
58 Lisp_Object sentinel; 58 Lisp_Object sentinel;
59 59
60 /* (funcall LOG SERVER CLIENT MESSAGE) when a server process 60 /* (funcall LOG SERVER CLIENT MESSAGE) when a server process
61 accepts a connection from a client. */ 61 accepts a connection from a client. */
62 Lisp_Object log; 62 Lisp_Object log;
63 63
64 /* Buffer that output is going to */ 64 /* Buffer that output is going to. */
65 Lisp_Object buffer; 65 Lisp_Object buffer;
66 66
67 /* t if this is a real child process. For a network or serial 67 /* t if this is a real child process. For a network or serial
@@ -73,10 +73,10 @@ struct Lisp_Process
73 /* Plist for programs to keep per-process state information, parameters, etc. */ 73 /* Plist for programs to keep per-process state information, parameters, etc. */
74 Lisp_Object plist; 74 Lisp_Object plist;
75 75
76 /* Symbol indicating the type of process: real, network, serial */ 76 /* Symbol indicating the type of process: real, network, serial. */
77 Lisp_Object type; 77 Lisp_Object type;
78 78
79 /* Marker set to end of last buffer-inserted output from this process */ 79 /* Marker set to end of last buffer-inserted output from this process. */
80 Lisp_Object mark; 80 Lisp_Object mark;
81 81
82 /* Symbol indicating status of process. 82 /* Symbol indicating status of process.
@@ -98,7 +98,7 @@ struct Lisp_Process
98 /* Working buffer for encoding. */ 98 /* Working buffer for encoding. */
99 Lisp_Object encoding_buf; 99 Lisp_Object encoding_buf;
100 100
101 /* Queue for storing waiting writes */ 101 /* Queue for storing waiting writes. */
102 Lisp_Object write_queue; 102 Lisp_Object write_queue;
103 103
104#ifdef HAVE_GNUTLS 104#ifdef HAVE_GNUTLS
@@ -116,9 +116,9 @@ struct Lisp_Process
116 A value 0 is used for pseudo-processes such as network or serial 116 A value 0 is used for pseudo-processes such as network or serial
117 connections. */ 117 connections. */
118 pid_t pid; 118 pid_t pid;
119 /* Descriptor by which we read from this process */ 119 /* Descriptor by which we read from this process. */
120 int infd; 120 int infd;
121 /* Descriptor by which we write to this process */ 121 /* Descriptor by which we write to this process. */
122 int outfd; 122 int outfd;
123 /* Descriptors that were created for this process and that need 123 /* Descriptors that were created for this process and that need
124 closing. Unused entries are negative. */ 124 closing. Unused entries are negative. */
diff --git a/src/search.c b/src/search.c
index 106a462f804..8c9714eb6fa 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2784,7 +2784,7 @@ if the last match was on a buffer; integers or nil if a string was matched.
2784Use `set-match-data' to reinstate the data in this list. 2784Use `set-match-data' to reinstate the data in this list.
2785 2785
2786If INTEGERS (the optional first argument) is non-nil, always use 2786If INTEGERS (the optional first argument) is non-nil, always use
2787integers \(rather than markers) to represent buffer positions. In 2787integers (rather than markers) to represent buffer positions. In
2788this case, and if the last match was in a buffer, the buffer will get 2788this case, and if the last match was in a buffer, the buffer will get
2789stored as one additional element at the end of the list. 2789stored as one additional element at the end of the list.
2790 2790
diff --git a/src/syntax.c b/src/syntax.c
index dc82210e79d..cacdf18c2a2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -181,6 +181,7 @@ static void scan_sexps_forward (struct lisp_parse_state *,
181 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, 181 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
182 bool, Lisp_Object, int); 182 bool, Lisp_Object, int);
183static bool in_classes (int, Lisp_Object); 183static bool in_classes (int, Lisp_Object);
184static void parse_sexp_propertize (ptrdiff_t charpos);
184 185
185/* This setter is used only in this file, so it can be private. */ 186/* This setter is used only in this file, so it can be private. */
186static void 187static void
@@ -246,8 +247,15 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count)
246 gl_state.object = Qnil; 247 gl_state.object = Qnil;
247 gl_state.offset = 0; 248 gl_state.offset = 0;
248 if (parse_sexp_lookup_properties) 249 if (parse_sexp_lookup_properties)
249 if (count > 0 || from > BEGV) 250 {
250 update_syntax_table (count > 0 ? from : from - 1, count, 1, Qnil); 251 if (count > 0)
252 update_syntax_table_forward (from, true, Qnil);
253 else if (from > BEGV)
254 {
255 update_syntax_table (from - 1, count, true, Qnil);
256 parse_sexp_propertize (from - 1);
257 }
258 }
251} 259}
252 260
253/* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. 261/* Same as above, but in OBJECT. If OBJECT is nil, use current buffer.
@@ -313,7 +321,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
313{ 321{
314 Lisp_Object tmp_table; 322 Lisp_Object tmp_table;
315 int cnt = 0; 323 int cnt = 0;
316 bool invalidate = 1; 324 bool invalidate = true;
317 INTERVAL i; 325 INTERVAL i;
318 326
319 if (init) 327 if (init)
@@ -323,7 +331,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
323 gl_state.stop = gl_state.e_property; 331 gl_state.stop = gl_state.e_property;
324 i = interval_of (charpos, object); 332 i = interval_of (charpos, object);
325 gl_state.backward_i = gl_state.forward_i = i; 333 gl_state.backward_i = gl_state.forward_i = i;
326 invalidate = 0; 334 invalidate = false;
327 if (!i) 335 if (!i)
328 return; 336 return;
329 /* interval_of updates only ->position of the return value, so 337 /* interval_of updates only ->position of the return value, so
@@ -359,7 +367,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
359 i = update_interval (i, charpos); 367 i = update_interval (i, charpos);
360 if (INTERVAL_LAST_POS (i) != gl_state.b_property) 368 if (INTERVAL_LAST_POS (i) != gl_state.b_property)
361 { 369 {
362 invalidate = 0; 370 invalidate = false;
363 gl_state.forward_i = i; 371 gl_state.forward_i = i;
364 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; 372 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
365 } 373 }
@@ -372,7 +380,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
372 i = update_interval (i, charpos); 380 i = update_interval (i, charpos);
373 if (i->position != gl_state.e_property) 381 if (i->position != gl_state.e_property)
374 { 382 {
375 invalidate = 0; 383 invalidate = false;
376 gl_state.backward_i = i; 384 gl_state.backward_i = i;
377 gl_state.b_property = i->position - gl_state.offset; 385 gl_state.b_property = i->position - gl_state.offset;
378 } 386 }
@@ -460,14 +468,69 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
460 } 468 }
461 eassert (i == NULL); /* This property goes to the end. */ 469 eassert (i == NULL); /* This property goes to the end. */
462 if (count > 0) 470 if (count > 0)
463 gl_state.e_property = gl_state.stop; 471 {
472 gl_state.e_property = gl_state.stop;
473 gl_state.forward_i = i;
474 }
464 else 475 else
465 gl_state.b_property = gl_state.start; 476 gl_state.b_property = gl_state.start;
466} 477}
478
479static void
480parse_sexp_propertize (ptrdiff_t charpos)
481{
482 EMACS_INT zv = ZV;
483 if (syntax_propertize__done <= charpos
484 && syntax_propertize__done < zv)
485 {
486 EMACS_INT modiffs = CHARS_MODIFF;
487 safe_call1 (Qinternal__syntax_propertize,
488 make_number (min (zv, 1 + charpos)));
489 if (modiffs != CHARS_MODIFF)
490 error ("parse-sexp-propertize-function modified the buffer!");
491 if (syntax_propertize__done <= charpos
492 && syntax_propertize__done < zv)
493 error ("parse-sexp-propertize-function did not move"
494 " syntax-propertize--done");
495 SETUP_SYNTAX_TABLE (charpos, 1);
496 }
497 else if (gl_state.e_property > syntax_propertize__done)
498 {
499 gl_state.e_property = syntax_propertize__done;
500 gl_state.e_property_truncated = true;
501 }
502 else if (gl_state.e_property_truncated
503 && gl_state.e_property < syntax_propertize__done)
504 { /* When moving backward, e_property might be set without resetting
505 e_property_truncated, so the e_property_truncated flag may
506 occasionally be left raised spuriously. This should be rare. */
507 gl_state.e_property_truncated = false;
508 update_syntax_table_forward (charpos, false, Qnil);
509 }
510}
511
512void
513update_syntax_table_forward (ptrdiff_t charpos, bool init,
514 Lisp_Object object)
515{
516 if (gl_state.e_property_truncated)
517 {
518 eassert (NILP (object));
519 eassert (charpos >= gl_state.e_property);
520 parse_sexp_propertize (charpos);
521 }
522 else
523 {
524 update_syntax_table (charpos, 1, init, object);
525 if (gl_state.e_property > syntax_propertize__done
526 && NILP (object))
527 parse_sexp_propertize (charpos);
528 }
529}
467 530
468/* Returns true if char at CHARPOS is quoted. 531/* Returns true if char at CHARPOS is quoted.
469 Global syntax-table data should be set up already to be good at CHARPOS 532 Global syntax-table data should be set up already to be good at CHARPOS
470 or after. On return global syntax data is good for lookup at CHARPOS. */ 533 or after. On return global syntax data is good for lookup at CHARPOS. */
471 534
472static bool 535static bool
473char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) 536char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos)
@@ -628,7 +691,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
628 OFROM[I] is position of the earliest comment-starter seen 691 OFROM[I] is position of the earliest comment-starter seen
629 which is I+2X quotes from the comment-end. 692 which is I+2X quotes from the comment-end.
630 PARITY is current parity of quotes from the comment end. */ 693 PARITY is current parity of quotes from the comment end. */
631 int string_style = -1; /* Presumed outside of any string. */ 694 int string_style = -1; /* Presumed outside of any string. */
632 bool string_lossage = 0; 695 bool string_lossage = 0;
633 /* Not a real lossage: indicates that we have passed a matching comment 696 /* Not a real lossage: indicates that we have passed a matching comment
634 starter plus a non-matching comment-ender, meaning that any matching 697 starter plus a non-matching comment-ender, meaning that any matching
@@ -645,7 +708,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
645 ptrdiff_t defun_start = 0; 708 ptrdiff_t defun_start = 0;
646 ptrdiff_t defun_start_byte = 0; 709 ptrdiff_t defun_start_byte = 0;
647 enum syntaxcode code; 710 enum syntaxcode code;
648 ptrdiff_t nesting = 1; /* current comment nesting */ 711 ptrdiff_t nesting = 1; /* Current comment nesting. */
649 int c; 712 int c;
650 int syntax = 0; 713 int syntax = 0;
651 714
@@ -876,7 +939,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
876 is nested, so we need to try again from within the 939 is nested, so we need to try again from within the
877 surrounding comment. Example: { a (* " *) */ 940 surrounding comment. Example: { a (* " *) */
878 { 941 {
879 /* FIXME: We should advance by one or two chars. */ 942 /* FIXME: We should advance by one or two chars. */
880 defun_start = state.comstr_start + 2; 943 defun_start = state.comstr_start + 2;
881 defun_start_byte = CHAR_TO_BYTE (defun_start); 944 defun_start_byte = CHAR_TO_BYTE (defun_start);
882 } 945 }
@@ -1042,7 +1105,7 @@ DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0,
1042 doc: /* Convert a syntax descriptor STRING into a raw syntax descriptor. 1105 doc: /* Convert a syntax descriptor STRING into a raw syntax descriptor.
1043STRING should be a string of the form allowed as argument of 1106STRING should be a string of the form allowed as argument of
1044`modify-syntax-entry'. The return value is a raw syntax descriptor: a 1107`modify-syntax-entry'. The return value is a raw syntax descriptor: a
1045cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as 1108cons cell (CODE . MATCHING-CHAR) which can be used, for example, as
1046the value of a `syntax-table' text property. */) 1109the value of a `syntax-table' text property. */)
1047 (Lisp_Object string) 1110 (Lisp_Object string)
1048{ 1111{
@@ -2288,13 +2351,13 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2288 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style 2351 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style
2289 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? 2352 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ?
2290 (nesting > 0 && --nesting == 0) : nesting < 0)) 2353 (nesting > 0 && --nesting == 0) : nesting < 0))
2291 /* we have encountered a comment end of the same style 2354 /* We have encountered a comment end of the same style
2292 as the comment sequence which began this comment 2355 as the comment sequence which began this comment
2293 section */ 2356 section. */
2294 break; 2357 break;
2295 if (code == Scomment_fence 2358 if (code == Scomment_fence
2296 && style == ST_COMMENT_STYLE) 2359 && style == ST_COMMENT_STYLE)
2297 /* we have encountered a comment end of the same style 2360 /* We have encountered a comment end of the same style
2298 as the comment sequence which began this comment 2361 as the comment sequence which began this comment
2299 section. */ 2362 section. */
2300 break; 2363 break;
@@ -2302,8 +2365,8 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2302 && code == Scomment 2365 && code == Scomment
2303 && SYNTAX_FLAGS_COMMENT_NESTED (syntax) 2366 && SYNTAX_FLAGS_COMMENT_NESTED (syntax)
2304 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style) 2367 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style)
2305 /* we have encountered a nested comment of the same style 2368 /* We have encountered a nested comment of the same style
2306 as the comment sequence which began this comment section */ 2369 as the comment sequence which began this comment section. */
2307 nesting++; 2370 nesting++;
2308 INC_BOTH (from, from_byte); 2371 INC_BOTH (from, from_byte);
2309 UPDATE_SYNTAX_TABLE_FORWARD (from); 2372 UPDATE_SYNTAX_TABLE_FORWARD (from);
@@ -2319,9 +2382,8 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2319 ? nesting > 0 : nesting < 0)) 2382 ? nesting > 0 : nesting < 0))
2320 { 2383 {
2321 if (--nesting <= 0) 2384 if (--nesting <= 0)
2322 /* we have encountered a comment end of the same style 2385 /* We have encountered a comment end of the same style
2323 as the comment sequence which began this comment 2386 as the comment sequence which began this comment section. */
2324 section */
2325 break; 2387 break;
2326 else 2388 else
2327 { 2389 {
@@ -2338,9 +2400,8 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2338 && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) 2400 && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
2339 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) || 2401 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ||
2340 SYNTAX_FLAGS_COMMENT_NESTED (other_syntax))) 2402 SYNTAX_FLAGS_COMMENT_NESTED (other_syntax)))
2341 /* we have encountered a nested comment of the same style 2403 /* We have encountered a nested comment of the same style
2342 as the comment sequence which began this comment 2404 as the comment sequence which began this comment section. */
2343 section */
2344 { 2405 {
2345 INC_BOTH (from, from_byte); 2406 INC_BOTH (from, from_byte);
2346 UPDATE_SYNTAX_TABLE_FORWARD (from); 2407 UPDATE_SYNTAX_TABLE_FORWARD (from);
@@ -2584,9 +2645,9 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
2584 bool quoted; 2645 bool quoted;
2585 bool mathexit = 0; 2646 bool mathexit = 0;
2586 enum syntaxcode code; 2647 enum syntaxcode code;
2587 EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ 2648 EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */
2588 int comstyle = 0; /* style of comment encountered */ 2649 int comstyle = 0; /* Style of comment encountered. */
2589 bool comnested = 0; /* whether the comment is nestable or not */ 2650 bool comnested = 0; /* Whether the comment is nestable or not. */
2590 ptrdiff_t temp_pos; 2651 ptrdiff_t temp_pos;
2591 EMACS_INT last_good = from; 2652 EMACS_INT last_good = from;
2592 bool found; 2653 bool found;
@@ -2630,11 +2691,11 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
2630 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) 2691 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
2631 && parse_sexp_ignore_comments) 2692 && parse_sexp_ignore_comments)
2632 { 2693 {
2633 /* we have encountered a comment start sequence and we 2694 /* We have encountered a comment start sequence and we
2634 are ignoring all text inside comments. We must record 2695 are ignoring all text inside comments. We must record
2635 the comment style this sequence begins so that later, 2696 the comment style this sequence begins so that later,
2636 only a comment end of the same style actually ends 2697 only a comment end of the same style actually ends
2637 the comment section */ 2698 the comment section. */
2638 code = Scomment; 2699 code = Scomment;
2639 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2700 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2640 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); 2701 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
@@ -2652,7 +2713,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
2652 if (from == stop) 2713 if (from == stop)
2653 goto lose; 2714 goto lose;
2654 INC_BOTH (from, from_byte); 2715 INC_BOTH (from, from_byte);
2655 /* treat following character as a word constituent */ 2716 /* Treat following character as a word constituent. */
2656 case Sword: 2717 case Sword:
2657 case Ssymbol: 2718 case Ssymbol:
2658 if (depth || !sexpflag) break; 2719 if (depth || !sexpflag) break;
@@ -2745,12 +2806,8 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
2745 : c_code == Sstring_fence) 2806 : c_code == Sstring_fence)
2746 break; 2807 break;
2747 2808
2748 switch (c_code) 2809 if (c_code == Scharquote || c_code == Sescape)
2749 { 2810 INC_BOTH (from, from_byte);
2750 case Scharquote:
2751 case Sescape:
2752 INC_BOTH (from, from_byte);
2753 }
2754 INC_BOTH (from, from_byte); 2811 INC_BOTH (from, from_byte);
2755 } 2812 }
2756 INC_BOTH (from, from_byte); 2813 INC_BOTH (from, from_byte);
@@ -3365,11 +3422,16 @@ do { prev_from = from; \
3365 case Sstring_fence: 3422 case Sstring_fence:
3366 if (!nofence) goto string_end; 3423 if (!nofence) goto string_end;
3367 break; 3424 break;
3425
3368 case Scharquote: 3426 case Scharquote:
3369 case Sescape: 3427 case Sescape:
3370 INC_FROM; 3428 INC_FROM;
3371 startquotedinstring: 3429 startquotedinstring:
3372 if (from >= end) goto endquoted; 3430 if (from >= end) goto endquoted;
3431 break;
3432
3433 default:
3434 break;
3373 } 3435 }
3374 INC_FROM; 3436 INC_FROM;
3375 } 3437 }
@@ -3457,7 +3519,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
3457 target = XINT (targetdepth); 3519 target = XINT (targetdepth);
3458 } 3520 }
3459 else 3521 else
3460 target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth */ 3522 target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth. */
3461 3523
3462 validate_region (&from, &to); 3524 validate_region (&from, &to);
3463 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), 3525 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
@@ -3588,7 +3650,7 @@ syms_of_syntax (void)
3588 staticpro (&gl_state.current_syntax_table); 3650 staticpro (&gl_state.current_syntax_table);
3589 staticpro (&gl_state.old_prop); 3651 staticpro (&gl_state.old_prop);
3590 3652
3591 /* Defined in regex.c */ 3653 /* Defined in regex.c. */
3592 staticpro (&re_match_object); 3654 staticpro (&re_match_object);
3593 3655
3594 DEFSYM (Qscan_error, "scan-error"); 3656 DEFSYM (Qscan_error, "scan-error");
@@ -3606,6 +3668,11 @@ Otherwise, that text property is simply ignored.
3606See the info node `(elisp)Syntax Properties' for a description of the 3668See the info node `(elisp)Syntax Properties' for a description of the
3607`syntax-table' property. */); 3669`syntax-table' property. */);
3608 3670
3671 DEFVAR_INT ("syntax-propertize--done", syntax_propertize__done,
3672 doc: /* Position up to which syntax-table properties have been set. */);
3673 syntax_propertize__done = -1;
3674 DEFSYM (Qinternal__syntax_propertize, "internal--syntax-propertize");
3675
3609 words_include_escapes = 0; 3676 words_include_escapes = 0;
3610 DEFVAR_BOOL ("words-include-escapes", words_include_escapes, 3677 DEFVAR_BOOL ("words-include-escapes", words_include_escapes,
3611 doc: /* Non-nil means `forward-word', etc., should treat escape chars part of words. */); 3678 doc: /* Non-nil means `forward-word', etc., should treat escape chars part of words. */);
diff --git a/src/syntax.h b/src/syntax.h
index bfcb87168ba..34b652ba9c8 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21INLINE_HEADER_BEGIN 21INLINE_HEADER_BEGIN
22 22
23extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); 23extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
24extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object);
24 25
25/* The standard syntax table is stored where it will automatically 26/* The standard syntax table is stored where it will automatically
26 be used in all new buffers. */ 27 be used in all new buffers. */
@@ -52,30 +53,32 @@ enum syntaxcode
52 other side by any char with the same syntaxcode. */ 53 other side by any char with the same syntaxcode. */
53 Sstring_fence, /* Starts/ends string which is delimited on the 54 Sstring_fence, /* Starts/ends string which is delimited on the
54 other side by any char with the same syntaxcode. */ 55 other side by any char with the same syntaxcode. */
55 Smax /* Upper bound on codes that are meaningful */ 56 Smax /* Upper bound on codes that are meaningful. */
56 }; 57 };
57 58
58 59
59struct gl_state_s 60struct gl_state_s
60{ 61{
61 Lisp_Object object; /* The object we are scanning. */ 62 Lisp_Object object; /* The object we are scanning. */
62 ptrdiff_t start; /* Where to stop. */ 63 ptrdiff_t start; /* Where to stop. */
63 ptrdiff_t stop; /* Where to stop. */ 64 ptrdiff_t stop; /* Where to stop. */
64 bool use_global; /* Whether to use global_code 65 bool use_global; /* Whether to use global_code
65 or c_s_t. */ 66 or c_s_t. */
66 Lisp_Object global_code; /* Syntax code of current char. */ 67 Lisp_Object global_code; /* Syntax code of current char. */
67 Lisp_Object current_syntax_table; /* Syntax table for current pos. */ 68 Lisp_Object current_syntax_table; /* Syntax table for current pos. */
68 Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ 69 Lisp_Object old_prop; /* Syntax-table prop at prev pos. */
69 ptrdiff_t b_property; /* First index where c_s_t is valid. */ 70 ptrdiff_t b_property; /* First index where c_s_t is valid. */
70 ptrdiff_t e_property; /* First index where c_s_t is 71 ptrdiff_t e_property; /* First index where c_s_t is
71 not valid. */ 72 not valid. */
72 INTERVAL forward_i; /* Where to start lookup on forward */ 73 bool e_property_truncated; /* true if e_property if was truncated
74 by parse_sexp_propertize_done. */
75 INTERVAL forward_i; /* Where to start lookup on forward. */
73 INTERVAL backward_i; /* or backward movement. The 76 INTERVAL backward_i; /* or backward movement. The
74 data in c_s_t is valid 77 data in c_s_t is valid
75 between these intervals, 78 between these intervals,
76 and possibly at the 79 and possibly at the
77 intervals too, depending 80 intervals too, depending
78 on: */ 81 on: */
79 /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ 82 /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */
80 ptrdiff_t offset; 83 ptrdiff_t offset;
81}; 84};
@@ -171,9 +174,10 @@ SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos)
171 174
172INLINE void 175INLINE void
173UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) 176UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos)
174{ 177{ /* Performs just-in-time syntax-propertization. */
175 if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) 178 if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
176 update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object); 179 update_syntax_table_forward (charpos + gl_state.offset,
180 false, gl_state.object);
177} 181}
178 182
179/* Make syntax table state (gl_state) good for CHARPOS, assuming it is 183/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
@@ -201,6 +205,7 @@ INLINE void
201SETUP_BUFFER_SYNTAX_TABLE (void) 205SETUP_BUFFER_SYNTAX_TABLE (void)
202{ 206{
203 gl_state.use_global = false; 207 gl_state.use_global = false;
208 gl_state.e_property_truncated = false;
204 gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); 209 gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
205} 210}
206 211
diff --git a/src/term.c b/src/term.c
index 8ebb620dd9b..5acc47395db 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3117,6 +3117,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3117 Lisp_Object selectface; 3117 Lisp_Object selectface;
3118 int first_item = 0; 3118 int first_item = 0;
3119 int col, row; 3119 int col, row;
3120 Lisp_Object prev_inhibit_redisplay = Vinhibit_redisplay;
3120 USE_SAFE_ALLOCA; 3121 USE_SAFE_ALLOCA;
3121 3122
3122 /* Don't allow non-positive x0 and y0, lest the menu will wrap 3123 /* Don't allow non-positive x0 and y0, lest the menu will wrap
@@ -3159,6 +3160,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3159 buffers_num_deleted = 1; 3160 buffers_num_deleted = 1;
3160 } 3161 }
3161 3162
3163 /* Inhibit redisplay for as long as the menu is active, to avoid
3164 messing the screen if some timer calls sit-for or a similar
3165 function. */
3166 Vinhibit_redisplay = Qt;
3167
3162 /* Force update of the current frame, so that the desired and the 3168 /* Force update of the current frame, so that the desired and the
3163 current matrices are identical. */ 3169 current matrices are identical. */
3164 update_frame_with_menu (sf, -1, -1); 3170 update_frame_with_menu (sf, -1, -1);
@@ -3349,6 +3355,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3349 if (!kbd_buffer_events_waiting ()) 3355 if (!kbd_buffer_events_waiting ())
3350 clear_input_pending (); 3356 clear_input_pending ();
3351 SAFE_FREE (); 3357 SAFE_FREE ();
3358 Vinhibit_redisplay = prev_inhibit_redisplay;
3352 return result; 3359 return result;
3353} 3360}
3354 3361
diff --git a/src/termhooks.h b/src/termhooks.h
index 168bc3510fa..88c62df7205 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -383,6 +383,11 @@ struct terminal
383 the selection-values. */ 383 the selection-values. */
384 Lisp_Object Vselection_alist; 384 Lisp_Object Vselection_alist;
385 385
386 /* If a char-table, this maps characters to terminal glyph codes.
387 If t, the mapping is not available. If nil, it is not known
388 whether the mapping is available. */
389 Lisp_Object glyph_code_table;
390
386 /* All fields before `next_terminal' should be Lisp_Object and are traced 391 /* All fields before `next_terminal' should be Lisp_Object and are traced
387 by the GC. All fields afterwards are ignored by the GC. */ 392 by the GC. All fields afterwards are ignored by the GC. */
388 393
@@ -690,6 +695,7 @@ extern struct terminal *get_named_terminal (const char *);
690extern struct terminal *create_terminal (enum output_method, 695extern struct terminal *create_terminal (enum output_method,
691 struct redisplay_interface *); 696 struct redisplay_interface *);
692extern void delete_terminal (struct terminal *); 697extern void delete_terminal (struct terminal *);
698extern Lisp_Object terminal_glyph_code (struct terminal *, int);
693 699
694/* The initial terminal device, created by initial_term_init. */ 700/* The initial terminal device, created by initial_term_init. */
695extern struct terminal *initial_terminal; 701extern struct terminal *initial_terminal;
diff --git a/src/terminal.c b/src/terminal.c
index b48d0623e12..80c6aa20bee 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -28,6 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include "coding.h" 28#include "coding.h"
29#include "keyboard.h" 29#include "keyboard.h"
30 30
31#if HAVE_STRUCT_UNIPAIR_UNICODE
32# include <errno.h>
33# include <linux/kd.h>
34# include <sys/ioctl.h>
35#endif
36
31/* Chain of all terminals currently in use. */ 37/* Chain of all terminals currently in use. */
32struct terminal *terminal_list; 38struct terminal *terminal_list;
33 39
@@ -526,6 +532,65 @@ selected frame's terminal). */)
526 return store_terminal_param (decode_live_terminal (terminal), parameter, value); 532 return store_terminal_param (decode_live_terminal (terminal), parameter, value);
527} 533}
528 534
535#if HAVE_STRUCT_UNIPAIR_UNICODE
536
537/* Compute the glyph code table for T. */
538
539static void
540calculate_glyph_code_table (struct terminal *t)
541{
542 Lisp_Object glyphtab = Qt;
543 enum { initial_unipairs = 1000 };
544 int entry_ct = initial_unipairs;
545 struct unipair unipair_buffer[initial_unipairs];
546 struct unipair *entries = unipair_buffer;
547 struct unipair *alloced = 0;
548
549 while (true)
550 {
551 int fd = fileno (t->display_info.tty->output);
552 struct unimapdesc unimapdesc = { entry_ct, entries };
553 if (ioctl (fd, GIO_UNIMAP, &unimapdesc) == 0)
554 {
555 glyphtab = Fmake_char_table (Qnil, make_number (-1));
556 for (int i = 0; i < unimapdesc.entry_ct; i++)
557 char_table_set (glyphtab, entries[i].unicode,
558 make_number (entries[i].fontpos));
559 break;
560 }
561 if (errno != ENOMEM)
562 break;
563 entry_ct = unimapdesc.entry_ct;
564 entries = alloced = xrealloc (alloced, entry_ct * sizeof *alloced);
565 }
566
567 xfree (alloced);
568 t->glyph_code_table = glyphtab;
569}
570#endif
571
572/* Return the glyph code in T of character CH, or -1 if CH does not
573 have a font position in T, or nil if T does not report glyph codes. */
574
575Lisp_Object
576terminal_glyph_code (struct terminal *t, int ch)
577{
578#if HAVE_STRUCT_UNIPAIR_UNICODE
579 if (t->type == output_termcap)
580 {
581 /* As a hack, recompute the table when CH is the maximum
582 character. */
583 if (NILP (t->glyph_code_table) || ch == MAX_CHAR)
584 calculate_glyph_code_table (t);
585
586 if (! EQ (t->glyph_code_table, Qt))
587 return char_table_ref (t->glyph_code_table, ch);
588 }
589#endif
590
591 return Qnil;
592}
593
529/* Initial frame has no device-dependent output data, but has 594/* Initial frame has no device-dependent output data, but has
530 face cache which should be freed when the frame is deleted. */ 595 face cache which should be freed when the frame is deleted. */
531 596
diff --git a/src/textprop.c b/src/textprop.c
index 3f7c8d10639..6758d4dfee2 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1494,7 +1494,7 @@ DEFUN ("remove-text-properties", Fremove_text_properties,
1494 doc: /* Remove some properties from text from START to END. 1494 doc: /* Remove some properties from text from START to END.
1495The third argument PROPERTIES is a property list 1495The third argument PROPERTIES is a property list
1496whose property names specify the properties to remove. 1496whose property names specify the properties to remove.
1497\(The values stored in PROPERTIES are ignored.) 1497(The values stored in PROPERTIES are ignored.)
1498If the optional fourth argument OBJECT is a buffer (or nil, which means 1498If the optional fourth argument OBJECT is a buffer (or nil, which means
1499the current buffer), START and END are buffer positions (integers or 1499the current buffer), START and END are buffer positions (integers or
1500markers). If OBJECT is a string, START and END are 0-based indices into it. 1500markers). If OBJECT is a string, START and END are 0-based indices into it.
diff --git a/src/vm-limit.c b/src/vm-limit.c
index ab102e32623..503aaaebf8a 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -170,19 +170,13 @@ check_memory_limits (void)
170 if (new_warnlevel > warnlevel || new_warnlevel == warned_95) 170 if (new_warnlevel > warnlevel || new_warnlevel == warned_95)
171 { 171 {
172 warnlevel = new_warnlevel; 172 warnlevel = new_warnlevel;
173 switch (warnlevel) 173 static char const *const warn_diagnostic[] =
174 { 174 {
175 case warned_75: 175 "Warning: past 75% of memory limit",
176 (*warn_function) ("Warning: past 75% of memory limit"); 176 "Warning: past 85% of memory limit",
177 break; 177 "Warning: past 95% of memory limit"
178 178 };
179 case warned_85: 179 warn_function (warn_diagnostic[warnlevel - 1]);
180 (*warn_function) ("Warning: past 85% of memory limit");
181 break;
182
183 case warned_95:
184 (*warn_function) ("Warning: past 95% of memory limit");
185 }
186 } 180 }
187 /* Handle going down in usage levels, with some hysteresis. */ 181 /* Handle going down in usage levels, with some hysteresis. */
188 else 182 else
diff --git a/src/w16select.c b/src/w16select.c
index 96f8437b4b1..70b9dd01f09 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -686,7 +686,7 @@ For MS-Windows and MS-DOS:
686When sending or receiving text via selection and clipboard, the text 686When sending or receiving text via selection and clipboard, the text
687is encoded or decoded by this coding system. The default value is 687is encoded or decoded by this coding system. The default value is
688the current system default encoding on 9x/Me, `utf-16le-dos' 688the current system default encoding on 9x/Me, `utf-16le-dos'
689\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. 689(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
690 690
691For X Windows: 691For X Windows:
692When sending text via selection and clipboard, if the target 692When sending text via selection and clipboard, if the target
diff --git a/src/w32fns.c b/src/w32fns.c
index d8e22e2aa9c..99fd3ba33fd 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1763,10 +1763,8 @@ x_change_tool_bar_height (struct frame *f, int height)
1763 f->n_tool_bar_rows = 0; 1763 f->n_tool_bar_rows = 0;
1764 1764
1765 adjust_frame_size (f, -1, -1, 1765 adjust_frame_size (f, -1, -1,
1766 ((!f->tool_bar_redisplayed_once 1766 ((NILP (fullscreen = get_frame_param (f, Qfullscreen))
1767 && (NILP (fullscreen = 1767 || EQ (fullscreen, Qfullwidth)) ? 1
1768 get_frame_param (f, Qfullscreen))
1769 || EQ (fullscreen, Qfullwidth))) ? 1
1770 : (old_height == 0 || height == 0) ? 2 1768 : (old_height == 0 || height == 0) ? 2
1771 : 4), 1769 : 4),
1772 false, Qtool_bar_lines); 1770 false, Qtool_bar_lines);
@@ -5307,7 +5305,7 @@ x_get_focus_frame (struct frame *frame)
5307 5305
5308DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 5306DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
5309 doc: /* Internal function called by `color-defined-p', which see. 5307 doc: /* Internal function called by `color-defined-p', which see.
5310\(Note that the Nextstep version of this function ignores FRAME.) */) 5308(Note that the Nextstep version of this function ignores FRAME.) */)
5311 (Lisp_Object color, Lisp_Object frame) 5309 (Lisp_Object color, Lisp_Object frame)
5312{ 5310{
5313 XColor foo; 5311 XColor foo;
@@ -5449,7 +5447,7 @@ If omitted or nil, that stands for the selected frame's display. */)
5449DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 5447DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
5450 doc: /* Return the "vendor ID" string of the GUI software on TERMINAL. 5448 doc: /* Return the "vendor ID" string of the GUI software on TERMINAL.
5451 5449
5452\(Labeling every distributor as a "vendor" embodies the false assumption 5450(Labeling every distributor as a "vendor" embodies the false assumption
5453that operating systems cannot be developed and distributed noncommercially.) 5451that operating systems cannot be developed and distributed noncommercially.)
5454 5452
5455For GNU and Unix systems, this queries the X server software; for 5453For GNU and Unix systems, this queries the X server software; for
@@ -5852,7 +5850,7 @@ DISPLAY is the name of the display to connect to.
5852Optional second arg XRM-STRING is a string of resources in xrdb format. 5850Optional second arg XRM-STRING is a string of resources in xrdb format.
5853If the optional third arg MUST-SUCCEED is non-nil, 5851If the optional third arg MUST-SUCCEED is non-nil,
5854terminate Emacs if we can't open the connection. 5852terminate Emacs if we can't open the connection.
5855\(In the Nextstep version, the last two arguments are currently ignored.) */) 5853(In the Nextstep version, the last two arguments are currently ignored.) */)
5856 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) 5854 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
5857{ 5855{
5858 unsigned char *xrm_option; 5856 unsigned char *xrm_option;
diff --git a/src/w32notify.c b/src/w32notify.c
index ab6cd12ab93..e822d950263 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -528,8 +528,8 @@ generate notifications correctly, though. */)
528 || (w32_major_version == 5 && w32_major_version < 1)) 528 || (w32_major_version == 5 && w32_major_version < 1))
529 { 529 {
530 errno = ENOSYS; 530 errno = ENOSYS;
531 report_file_error ("Watching filesystem events is not supported", 531 report_file_notify_error ("Watching filesystem events is not supported",
532 Qnil); 532 Qnil);
533 } 533 }
534 534
535 /* filenotify.el always passes us a directory, either the parent 535 /* filenotify.el always passes us a directory, either the parent
@@ -573,11 +573,11 @@ generate notifications correctly, though. */)
573 Vlocale_coding_system, 0); 573 Vlocale_coding_system, 0);
574 else 574 else
575 lisp_errstr = build_string (errstr); 575 lisp_errstr = build_string (errstr);
576 report_file_error ("Cannot watch file", 576 report_file_notify_error ("Cannot watch file",
577 Fcons (lisp_errstr, Fcons (file, Qnil))); 577 Fcons (lisp_errstr, Fcons (file, Qnil)));
578 } 578 }
579 else 579 else
580 report_file_error ("Cannot watch file", Fcons (file, Qnil)); 580 report_file_notify_error ("Cannot watch file", Fcons (file, Qnil));
581 } 581 }
582 /* Store watch object in watch list. */ 582 /* Store watch object in watch list. */
583 watch_descriptor = make_pointer_integer (dirwatch); 583 watch_descriptor = make_pointer_integer (dirwatch);
@@ -611,8 +611,8 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */)
611 } 611 }
612 612
613 if (status == -1) 613 if (status == -1)
614 report_file_error ("Invalid watch descriptor", Fcons (watch_descriptor, 614 report_file_notify_error ("Invalid watch descriptor",
615 Qnil)); 615 Fcons (watch_descriptor, Qnil));
616 616
617 return Qnil; 617 return Qnil;
618} 618}
@@ -628,6 +628,30 @@ w32_get_watch_object (void *desc)
628 return NILP (watch_list) ? Qnil : assoc_no_quit (descriptor, watch_list); 628 return NILP (watch_list) ? Qnil : assoc_no_quit (descriptor, watch_list);
629} 629}
630 630
631DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0,
632 doc: /* "Check a watch specified by its WATCH-DESCRIPTOR for validity.
633
634WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'.
635
636A watch can become invalid if the directory it watches is deleted, or if
637the watcher thread exits abnormally for any other reason. Removing the
638watch by calling `w32notify-rm-watch' also makes it invalid. */)
639 (Lisp_Object watch_descriptor)
640{
641 Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list);
642
643 if (!NILP (watch_object))
644 {
645 struct notification *dirwatch =
646 (struct notification *)XINTPTR (watch_descriptor);
647 if (w32_valid_pointer_p (dirwatch, sizeof(struct notification))
648 && dirwatch->dir != NULL)
649 return Qt;
650 }
651
652 return Qnil;
653}
654
631void 655void
632globals_of_w32notify (void) 656globals_of_w32notify (void)
633{ 657{
@@ -648,6 +672,7 @@ syms_of_w32notify (void)
648 672
649 defsubr (&Sw32notify_add_watch); 673 defsubr (&Sw32notify_add_watch);
650 defsubr (&Sw32notify_rm_watch); 674 defsubr (&Sw32notify_rm_watch);
675 defsubr (&Sw32notify_valid_p);
651 676
652 staticpro (&watch_list); 677 staticpro (&watch_list);
653 678
diff --git a/src/window.c b/src/window.c
index f6fe0cdb059..42a2ca68f14 100644
--- a/src/window.c
+++ b/src/window.c
@@ -641,7 +641,7 @@ DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combinatio
641WINDOW must be a valid window used in horizontal or vertical combination. 641WINDOW must be a valid window used in horizontal or vertical combination.
642If the return value is nil, child windows of WINDOW can be recombined with 642If the return value is nil, child windows of WINDOW can be recombined with
643WINDOW's siblings. A return value of t means that child windows of 643WINDOW's siblings. A return value of t means that child windows of
644WINDOW are never \(re-)combined with WINDOW's siblings. */) 644WINDOW are never (re-)combined with WINDOW's siblings. */)
645 (Lisp_Object window) 645 (Lisp_Object window)
646{ 646{
647 struct window *w; 647 struct window *w;
@@ -658,7 +658,7 @@ DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_windo
658WINDOW must be a valid window used in horizontal or vertical combination. 658WINDOW must be a valid window used in horizontal or vertical combination.
659If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's 659If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's
660siblings. LIMIT t means that child windows of WINDOW are never 660siblings. LIMIT t means that child windows of WINDOW are never
661\(re-)combined with WINDOW's siblings. Other values are reserved for 661(re-)combined with WINDOW's siblings. Other values are reserved for
662future use. */) 662future use. */)
663 (Lisp_Object window, Lisp_Object limit) 663 (Lisp_Object window, Lisp_Object limit)
664{ 664{
@@ -1291,10 +1291,18 @@ window_relative_x_coord (struct window *w, enum window_part part, int x)
1291 + window_box_width (w, RIGHT_MARGIN_AREA) 1291 + window_box_width (w, RIGHT_MARGIN_AREA)
1292 + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) 1292 + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
1293 ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0)); 1293 ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0));
1294 }
1295 1294
1296 /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */ 1295 case ON_NOTHING:
1297 return 0; 1296 case ON_VERTICAL_BORDER:
1297 case ON_VERTICAL_SCROLL_BAR:
1298 case ON_HORIZONTAL_SCROLL_BAR:
1299 case ON_RIGHT_DIVIDER:
1300 case ON_BOTTOM_DIVIDER:
1301 return 0;
1302
1303 default:
1304 emacs_abort ();
1305 }
1298} 1306}
1299 1307
1300 1308
@@ -1304,7 +1312,7 @@ DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
1304WINDOW must be a live window and defaults to the selected one. 1312WINDOW must be a live window and defaults to the selected one.
1305COORDINATES is a cons of the form (X . Y), X and Y being distances 1313COORDINATES is a cons of the form (X . Y), X and Y being distances
1306measured in characters from the upper-left corner of the frame. 1314measured in characters from the upper-left corner of the frame.
1307\(0 . 0) denotes the character in the upper left corner of the 1315(0 . 0) denotes the character in the upper left corner of the
1308frame. 1316frame.
1309If COORDINATES are in the text portion of WINDOW, 1317If COORDINATES are in the text portion of WINDOW,
1310 the coordinates relative to the window are returned. 1318 the coordinates relative to the window are returned.
@@ -1688,7 +1696,7 @@ of the window. The remaining elements are omitted if the character after
1688POS is fully visible; otherwise, RTOP and RBOT are the number of pixels 1696POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
1689off-window at the top and bottom of the screen line ("row") containing 1697off-window at the top and bottom of the screen line ("row") containing
1690POS, ROWH is the visible height of that row, and VPOS is the row number 1698POS, ROWH is the visible height of that row, and VPOS is the row number
1691\(zero-based). */) 1699(zero-based). */)
1692 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) 1700 (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
1693{ 1701{
1694 struct window *w; 1702 struct window *w;
diff --git a/src/xdisp.c b/src/xdisp.c
index 82931b88e1c..2c38aa9ccff 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -768,7 +768,7 @@ static void push_it (struct it *, struct text_pos *);
768static void iterate_out_of_display_property (struct it *); 768static void iterate_out_of_display_property (struct it *);
769static void pop_it (struct it *); 769static void pop_it (struct it *);
770static void redisplay_internal (void); 770static void redisplay_internal (void);
771static bool echo_area_display (bool); 771static void echo_area_display (bool);
772static void redisplay_windows (Lisp_Object); 772static void redisplay_windows (Lisp_Object);
773static void redisplay_window (Lisp_Object, bool); 773static void redisplay_window (Lisp_Object, bool);
774static Lisp_Object redisplay_window_error (Lisp_Object); 774static Lisp_Object redisplay_window_error (Lisp_Object);
@@ -2661,10 +2661,18 @@ init_iterator (struct it *it, struct window *w,
2661 free realized faces now because they depend on face definitions 2661 free realized faces now because they depend on face definitions
2662 that might have changed. Don't free faces while there might be 2662 that might have changed. Don't free faces while there might be
2663 desired matrices pending which reference these faces. */ 2663 desired matrices pending which reference these faces. */
2664 if (face_change && !inhibit_free_realized_faces) 2664 if (!inhibit_free_realized_faces)
2665 { 2665 {
2666 face_change = false; 2666 if (face_change)
2667 free_all_realized_faces (Qnil); 2667 {
2668 face_change = false;
2669 free_all_realized_faces (Qnil);
2670 }
2671 else if (XFRAME (w->frame)->face_change)
2672 {
2673 XFRAME (w->frame)->face_change = 0;
2674 free_all_realized_faces (w->frame);
2675 }
2668 } 2676 }
2669 2677
2670 /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */ 2678 /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */
@@ -4014,21 +4022,26 @@ face_before_or_after_it_pos (struct it *it, bool before_p)
4014 /* With bidi iteration, the character before the current 4022 /* With bidi iteration, the character before the current
4015 in the visual order cannot be found by simple 4023 in the visual order cannot be found by simple
4016 iteration, because "reverse" reordering is not 4024 iteration, because "reverse" reordering is not
4017 supported. Instead, we need to use the move_it_* 4025 supported. Instead, we need to start from the string
4018 family of functions. */ 4026 beginning and go all the way to the current string
4027 position, remembering the previous position. */
4019 /* Ignore face changes before the first visible 4028 /* Ignore face changes before the first visible
4020 character on this display line. */ 4029 character on this display line. */
4021 if (it->current_x <= it->first_visible_x) 4030 if (it->current_x <= it->first_visible_x)
4022 return it->face_id; 4031 return it->face_id;
4023 SAVE_IT (it_copy, *it, it_copy_data); 4032 SAVE_IT (it_copy, *it, it_copy_data);
4024 /* Implementation note: Since move_it_in_display_line 4033 IT_STRING_CHARPOS (it_copy) = 0;
4025 works in the iterator geometry, and thinks the first 4034 bidi_init_it (0, 0, FRAME_WINDOW_P (it_copy.f), &it_copy.bidi_it);
4026 character is always the leftmost, even in R2L lines, 4035
4027 we don't need to distinguish between the R2L and L2R 4036 do
4028 cases here. */ 4037 {
4029 move_it_in_display_line (&it_copy, SCHARS (it_copy.string), 4038 charpos = IT_STRING_CHARPOS (it_copy);
4030 it_copy.current_x - 1, MOVE_TO_X); 4039 if (charpos >= SCHARS (it->string))
4031 charpos = IT_STRING_CHARPOS (it_copy); 4040 break;
4041 bidi_move_to_visually_next (&it_copy.bidi_it);
4042 }
4043 while (IT_STRING_CHARPOS (it_copy) != IT_STRING_CHARPOS (*it));
4044
4032 RESTORE_IT (it, it, it_copy_data); 4045 RESTORE_IT (it, it, it_copy_data);
4033 } 4046 }
4034 else 4047 else
@@ -4108,11 +4121,15 @@ face_before_or_after_it_pos (struct it *it, bool before_p)
4108 { 4121 {
4109 if (before_p) 4122 if (before_p)
4110 { 4123 {
4124 int current_x;
4125
4111 /* With bidi iteration, the character before the current 4126 /* With bidi iteration, the character before the current
4112 in the visual order cannot be found by simple 4127 in the visual order cannot be found by simple
4113 iteration, because "reverse" reordering is not 4128 iteration, because "reverse" reordering is not
4114 supported. Instead, we need to use the move_it_* 4129 supported. Instead, we need to use the move_it_*
4115 family of functions. */ 4130 family of functions, and move to the previous
4131 character starting from the beginning of the visual
4132 line. */
4116 /* Ignore face changes before the first visible 4133 /* Ignore face changes before the first visible
4117 character on this display line. */ 4134 character on this display line. */
4118 if (it->current_x <= it->first_visible_x) 4135 if (it->current_x <= it->first_visible_x)
@@ -4123,8 +4140,9 @@ face_before_or_after_it_pos (struct it *it, bool before_p)
4123 character is always the leftmost, even in R2L lines, 4140 character is always the leftmost, even in R2L lines,
4124 we don't need to distinguish between the R2L and L2R 4141 we don't need to distinguish between the R2L and L2R
4125 cases here. */ 4142 cases here. */
4126 move_it_in_display_line (&it_copy, ZV, 4143 current_x = it_copy.current_x;
4127 it_copy.current_x - 1, MOVE_TO_X); 4144 move_it_vertically_backward (&it_copy, 0);
4145 move_it_in_display_line (&it_copy, ZV, current_x - 1, MOVE_TO_X);
4128 pos = it_copy.current.pos; 4146 pos = it_copy.current.pos;
4129 RESTORE_IT (it, it, it_copy_data); 4147 RESTORE_IT (it, it, it_copy_data);
4130 } 4148 }
@@ -5895,6 +5913,13 @@ push_it (struct it *it, struct text_pos *position)
5895 case GET_FROM_STRETCH: 5913 case GET_FROM_STRETCH:
5896 p->u.stretch.object = it->object; 5914 p->u.stretch.object = it->object;
5897 break; 5915 break;
5916 case GET_FROM_BUFFER:
5917 case GET_FROM_DISPLAY_VECTOR:
5918 case GET_FROM_STRING:
5919 case GET_FROM_C_STRING:
5920 break;
5921 default:
5922 emacs_abort ();
5898 } 5923 }
5899 p->position = position ? *position : it->position; 5924 p->position = position ? *position : it->position;
5900 p->current = it->current; 5925 p->current = it->current;
@@ -6017,6 +6042,11 @@ pop_it (struct it *it)
6017 it->method = GET_FROM_BUFFER; 6042 it->method = GET_FROM_BUFFER;
6018 it->object = it->w->contents; 6043 it->object = it->w->contents;
6019 } 6044 }
6045 break;
6046 case GET_FROM_C_STRING:
6047 break;
6048 default:
6049 emacs_abort ();
6020 } 6050 }
6021 it->end_charpos = p->end_charpos; 6051 it->end_charpos = p->end_charpos;
6022 it->string_nchars = p->string_nchars; 6052 it->string_nchars = p->string_nchars;
@@ -11119,11 +11149,10 @@ clear_garbaged_frames (void)
11119} 11149}
11120 11150
11121 11151
11122/* Redisplay the echo area of the selected frame. If UPDATE_FRAME_P, 11152/* Redisplay the echo area of the selected frame. If UPDATE_FRAME_P, update
11123 update selected_frame. Value is true if the mini-windows height 11153 selected_frame. */
11124 has been changed. */
11125 11154
11126static bool 11155static void
11127echo_area_display (bool update_frame_p) 11156echo_area_display (bool update_frame_p)
11128{ 11157{
11129 Lisp_Object mini_window; 11158 Lisp_Object mini_window;
@@ -11138,14 +11167,14 @@ echo_area_display (bool update_frame_p)
11138 11167
11139 /* Don't display if frame is invisible or not yet initialized. */ 11168 /* Don't display if frame is invisible or not yet initialized. */
11140 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p) 11169 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p)
11141 return false; 11170 return;
11142 11171
11143#ifdef HAVE_WINDOW_SYSTEM 11172#ifdef HAVE_WINDOW_SYSTEM
11144 /* When Emacs starts, selected_frame may be the initial terminal 11173 /* When Emacs starts, selected_frame may be the initial terminal
11145 frame. If we let this through, a message would be displayed on 11174 frame. If we let this through, a message would be displayed on
11146 the terminal. */ 11175 the terminal. */
11147 if (FRAME_INITIAL_P (XFRAME (selected_frame))) 11176 if (FRAME_INITIAL_P (XFRAME (selected_frame)))
11148 return false; 11177 return;
11149#endif /* HAVE_WINDOW_SYSTEM */ 11178#endif /* HAVE_WINDOW_SYSTEM */
11150 11179
11151 /* Redraw garbaged frames. */ 11180 /* Redraw garbaged frames. */
@@ -11183,7 +11212,7 @@ echo_area_display (bool update_frame_p)
11183 pending input. */ 11212 pending input. */
11184 ptrdiff_t count = SPECPDL_INDEX (); 11213 ptrdiff_t count = SPECPDL_INDEX ();
11185 specbind (Qredisplay_dont_pause, Qt); 11214 specbind (Qredisplay_dont_pause, Qt);
11186 windows_or_buffers_changed = 44; 11215 fset_redisplay (f);
11187 redisplay_internal (); 11216 redisplay_internal ();
11188 unbind_to (count, Qnil); 11217 unbind_to (count, Qnil);
11189 } 11218 }
@@ -11219,7 +11248,16 @@ echo_area_display (bool update_frame_p)
11219 if (EQ (mini_window, selected_window)) 11248 if (EQ (mini_window, selected_window))
11220 CHARPOS (this_line_start_pos) = 0; 11249 CHARPOS (this_line_start_pos) = 0;
11221 11250
11222 return window_height_changed_p; 11251 if (window_height_changed_p)
11252 {
11253 fset_redisplay (f);
11254
11255 /* If window configuration was changed, frames may have been
11256 marked garbaged. Clear them or we will experience
11257 surprises wrt scrolling.
11258 FIXME: How/why/when? */
11259 clear_garbaged_frames ();
11260 }
11223} 11261}
11224 11262
11225/* True if W's buffer was changed but not saved. */ 11263/* True if W's buffer was changed but not saved. */
@@ -13445,7 +13483,7 @@ redisplay_internal (void)
13445 echo-area doesn't show through. */ 13483 echo-area doesn't show through. */
13446 && !MINI_WINDOW_P (XWINDOW (selected_window)))) 13484 && !MINI_WINDOW_P (XWINDOW (selected_window))))
13447 { 13485 {
13448 bool window_height_changed_p = echo_area_display (false); 13486 echo_area_display (false);
13449 13487
13450 if (message_cleared_p) 13488 if (message_cleared_p)
13451 update_miniwindow_p = true; 13489 update_miniwindow_p = true;
@@ -13458,16 +13496,6 @@ redisplay_internal (void)
13458 the echo area. */ 13496 the echo area. */
13459 if (!display_last_displayed_message_p) 13497 if (!display_last_displayed_message_p)
13460 message_cleared_p = false; 13498 message_cleared_p = false;
13461
13462 if (window_height_changed_p)
13463 {
13464 windows_or_buffers_changed = 50;
13465
13466 /* If window configuration was changed, frames may have been
13467 marked garbaged. Clear them or we will experience
13468 surprises wrt scrolling. */
13469 clear_garbaged_frames ();
13470 }
13471 } 13499 }
13472 else if (EQ (selected_window, minibuf_window) 13500 else if (EQ (selected_window, minibuf_window)
13473 && (current_buffer->clip_changed || window_outdated (w)) 13501 && (current_buffer->clip_changed || window_outdated (w))
@@ -13521,6 +13549,7 @@ redisplay_internal (void)
13521 && FRAME_VISIBLE_P (XFRAME (w->frame)) 13549 && FRAME_VISIBLE_P (XFRAME (w->frame))
13522 && !FRAME_OBSCURED_P (XFRAME (w->frame)) 13550 && !FRAME_OBSCURED_P (XFRAME (w->frame))
13523 && !XFRAME (w->frame)->cursor_type_changed 13551 && !XFRAME (w->frame)->cursor_type_changed
13552 && !XFRAME (w->frame)->face_change
13524 /* Make sure recorded data applies to current buffer, etc. */ 13553 /* Make sure recorded data applies to current buffer, etc. */
13525 && this_line_buffer == current_buffer 13554 && this_line_buffer == current_buffer
13526 && match_p 13555 && match_p
@@ -13737,18 +13766,6 @@ redisplay_internal (void)
13737 continue; 13766 continue;
13738 13767
13739 retry_frame: 13768 retry_frame:
13740
13741#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_GTK) && !defined (HAVE_NS)
13742 /* Redisplay internal tool bar if this is the first time so we
13743 can adjust the frame height right now, if necessary. */
13744 if (!f->tool_bar_redisplayed_once)
13745 {
13746 if (redisplay_tool_bar (f))
13747 adjust_frame_glyphs (f);
13748 f->tool_bar_redisplayed_once = true;
13749 }
13750#endif
13751
13752 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) 13769 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
13753 { 13770 {
13754 bool gcscrollbars 13771 bool gcscrollbars
@@ -15879,6 +15896,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
15879 && REDISPLAY_SOME_P () 15896 && REDISPLAY_SOME_P ()
15880 && !w->redisplay 15897 && !w->redisplay
15881 && !w->update_mode_line 15898 && !w->update_mode_line
15899 && !f->face_change
15882 && !f->redisplay 15900 && !f->redisplay
15883 && !buffer->text->redisplay 15901 && !buffer->text->redisplay
15884 && BUF_PT (buffer) == w->last_point) 15902 && BUF_PT (buffer) == w->last_point)
@@ -21040,7 +21058,7 @@ window-specific overlays, which can affect the results.
21040 21058
21041Strong directional characters `L', `R', and `AL' can have their 21059Strong directional characters `L', `R', and `AL' can have their
21042intrinsic directionality overridden by directional override 21060intrinsic directionality overridden by directional override
21043control characters RLO \(u+202e) and LRO \(u+202d). See the 21061control characters RLO (u+202e) and LRO (u+202d). See the
21044function `get-char-code-property' for a way to inquire about 21062function `get-char-code-property' for a way to inquire about
21045the `bidi-class' property of a character. */) 21063the `bidi-class' property of a character. */)
21046 (Lisp_Object from, Lisp_Object to, Lisp_Object object) 21064 (Lisp_Object from, Lisp_Object to, Lisp_Object object)
@@ -24065,7 +24083,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24065 prop = Qnil; 24083 prop = Qnil;
24066 } 24084 }
24067 24085
24068 if (INTEGERP (prop) || FLOATP (prop)) 24086 if (NUMBERP (prop))
24069 { 24087 {
24070 int base_unit = (width_p 24088 int base_unit = (width_p
24071 ? FRAME_COLUMN_WIDTH (it->f) 24089 ? FRAME_COLUMN_WIDTH (it->f)
@@ -24117,7 +24135,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24117 car = Qnil; 24135 car = Qnil;
24118 } 24136 }
24119 24137
24120 if (INTEGERP (car) || FLOATP (car)) 24138 if (NUMBERP (car))
24121 { 24139 {
24122 double fact; 24140 double fact;
24123 pixels = XFLOATINT (car); 24141 pixels = XFLOATINT (car);
@@ -25948,9 +25966,7 @@ produce_stretch_glyph (struct it *it)
25948 zero_width_ok_p = true; 25966 zero_width_ok_p = true;
25949 width = (int)tem; 25967 width = (int)tem;
25950 } 25968 }
25951#ifdef HAVE_WINDOW_SYSTEM 25969 else if (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0)
25952 else if (FRAME_WINDOW_P (it->f)
25953 && (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0))
25954 { 25970 {
25955 /* Relative width `:relative-width FACTOR' specified and valid. 25971 /* Relative width `:relative-width FACTOR' specified and valid.
25956 Compute the width of the characters having the `glyph' 25972 Compute the width of the characters having the `glyph'
@@ -25970,10 +25986,9 @@ produce_stretch_glyph (struct it *it)
25970 25986
25971 it2.glyph_row = NULL; 25987 it2.glyph_row = NULL;
25972 it2.what = IT_CHARACTER; 25988 it2.what = IT_CHARACTER;
25973 x_produce_glyphs (&it2); 25989 PRODUCE_GLYPHS (&it2);
25974 width = NUMVAL (prop) * it2.pixel_width; 25990 width = NUMVAL (prop) * it2.pixel_width;
25975 } 25991 }
25976#endif /* HAVE_WINDOW_SYSTEM */
25977 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) 25992 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
25978 && calc_pixel_width_or_height (&tem, it, prop, font, true, 25993 && calc_pixel_width_or_height (&tem, it, prop, font, true,
25979 &align_to)) 25994 &align_to))
@@ -29064,7 +29079,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
29064 Lisp_Object lr, lx0, ly0; 29079 Lisp_Object lr, lx0, ly0;
29065 if (CONSP (circ) 29080 if (CONSP (circ)
29066 && CONSP (XCAR (circ)) 29081 && CONSP (XCAR (circ))
29067 && (lr = XCDR (circ), INTEGERP (lr) || FLOATP (lr)) 29082 && (lr = XCDR (circ), NUMBERP (lr))
29068 && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0)) 29083 && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
29069 && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0))) 29084 && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
29070 { 29085 {
@@ -30996,18 +31011,18 @@ This variable is not guaranteed to be accurate except while processing
30996 31011
30997 DEFVAR_LISP ("frame-title-format", Vframe_title_format, 31012 DEFVAR_LISP ("frame-title-format", Vframe_title_format,
30998 doc: /* Template for displaying the title bar of visible frames. 31013 doc: /* Template for displaying the title bar of visible frames.
30999\(Assuming the window manager supports this feature.) 31014(Assuming the window manager supports this feature.)
31000 31015
31001This variable has the same structure as `mode-line-format', except that 31016This variable has the same structure as `mode-line-format', except that
31002the %c and %l constructs are ignored. It is used only on frames for 31017the %c and %l constructs are ignored. It is used only on frames for
31003which no explicit name has been set \(see `modify-frame-parameters'). */); 31018which no explicit name has been set (see `modify-frame-parameters'). */);
31004 31019
31005 DEFVAR_LISP ("icon-title-format", Vicon_title_format, 31020 DEFVAR_LISP ("icon-title-format", Vicon_title_format,
31006 doc: /* Template for displaying the title bar of an iconified frame. 31021 doc: /* Template for displaying the title bar of an iconified frame.
31007\(Assuming the window manager supports this feature.) 31022(Assuming the window manager supports this feature.)
31008This variable has the same structure as `mode-line-format' (which see), 31023This variable has the same structure as `mode-line-format' (which see),
31009and is used only on frames for which no explicit name has been set 31024and is used only on frames for which no explicit name has been set
31010\(see `modify-frame-parameters'). */); 31025(see `modify-frame-parameters'). */);
31011 Vicon_title_format 31026 Vicon_title_format
31012 = Vframe_title_format 31027 = Vframe_title_format
31013 = listn (CONSTYPE_PURE, 3, 31028 = listn (CONSTYPE_PURE, 3,
@@ -31066,9 +31081,9 @@ A positive number means delay autoselection by that many seconds: a
31066window is autoselected only after the mouse has remained in that 31081window is autoselected only after the mouse has remained in that
31067window for the duration of the delay. 31082window for the duration of the delay.
31068A negative number has a similar effect, but causes windows to be 31083A negative number has a similar effect, but causes windows to be
31069autoselected only after the mouse has stopped moving. \(Because of 31084autoselected only after the mouse has stopped moving. (Because of
31070the way Emacs compares mouse events, you will occasionally wait twice 31085the way Emacs compares mouse events, you will occasionally wait twice
31071that time before the window gets selected.\) 31086that time before the window gets selected.)
31072Any other value means to autoselect window instantaneously when the 31087Any other value means to autoselect window instantaneously when the
31073mouse pointer enters it. 31088mouse pointer enters it.
31074 31089
diff --git a/src/xfaces.c b/src/xfaces.c
index 03032496381..40713f167ff 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -687,7 +687,6 @@ clear_face_cache (bool clear_fonts_p)
687#endif /* HAVE_WINDOW_SYSTEM */ 687#endif /* HAVE_WINDOW_SYSTEM */
688} 688}
689 689
690
691DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0, 690DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0,
692 doc: /* Clear face caches on all frames. 691 doc: /* Clear face caches on all frames.
693Optional THOROUGHLY non-nil means try to free unused fonts, too. */) 692Optional THOROUGHLY non-nil means try to free unused fonts, too. */)
@@ -709,10 +708,10 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too. */)
709DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, 708DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0,
710 doc: /* Value is non-nil if OBJECT is a valid bitmap specification. 709 doc: /* Value is non-nil if OBJECT is a valid bitmap specification.
711A bitmap specification is either a string, a file name, or a list 710A bitmap specification is either a string, a file name, or a list
712\(WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap, 711(WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap,
713HEIGHT is its height, and DATA is a string containing the bits of 712HEIGHT is its height, and DATA is a string containing the bits of
714the pixmap. Bits are stored row by row, each row occupies 713the pixmap. Bits are stored row by row, each row occupies
715\(WIDTH + 7)/8 bytes. */) 714(WIDTH + 7)/8 bytes. */)
716 (Lisp_Object object) 715 (Lisp_Object object)
717{ 716{
718 bool pixmap_p = false; 717 bool pixmap_p = false;
@@ -1669,8 +1668,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
1669 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); 1668 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
1670 eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) 1669 eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
1671 || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX]) 1670 || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
1672 || INTEGERP (attrs[LFACE_HEIGHT_INDEX]) 1671 || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
1673 || FLOATP (attrs[LFACE_HEIGHT_INDEX])
1674 || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX])); 1672 || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
1675 eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) 1673 eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
1676 || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX]) 1674 || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
@@ -2529,7 +2527,10 @@ Value is a vector of face attributes. */)
2529 free realized faces. */ 2527 free realized faces. */
2530 if (NILP (Fget (face, Qface_no_inherit))) 2528 if (NILP (Fget (face, Qface_no_inherit)))
2531 { 2529 {
2532 face_change = true; 2530 if (f)
2531 f->face_change = 1;
2532 else
2533 face_change = true;
2533 windows_or_buffers_changed = 54; 2534 windows_or_buffers_changed = 54;
2534 } 2535 }
2535 2536
@@ -2577,6 +2578,7 @@ The value is TO. */)
2577 (Lisp_Object from, Lisp_Object to, Lisp_Object frame, Lisp_Object new_frame) 2578 (Lisp_Object from, Lisp_Object to, Lisp_Object frame, Lisp_Object new_frame)
2578{ 2579{
2579 Lisp_Object lface, copy; 2580 Lisp_Object lface, copy;
2581 struct frame *f;
2580 2582
2581 CHECK_SYMBOL (from); 2583 CHECK_SYMBOL (from);
2582 CHECK_SYMBOL (to); 2584 CHECK_SYMBOL (to);
@@ -2587,6 +2589,7 @@ The value is TO. */)
2587 strings etc. because 20.2 didn't do it either. */ 2589 strings etc. because 20.2 didn't do it either. */
2588 lface = lface_from_face_name (NULL, from, true); 2590 lface = lface_from_face_name (NULL, from, true);
2589 copy = Finternal_make_lisp_face (to, Qnil); 2591 copy = Finternal_make_lisp_face (to, Qnil);
2592 f = NULL;
2590 } 2593 }
2591 else 2594 else
2592 { 2595 {
@@ -2597,6 +2600,7 @@ The value is TO. */)
2597 CHECK_LIVE_FRAME (new_frame); 2600 CHECK_LIVE_FRAME (new_frame);
2598 lface = lface_from_face_name (XFRAME (frame), from, true); 2601 lface = lface_from_face_name (XFRAME (frame), from, true);
2599 copy = Finternal_make_lisp_face (to, new_frame); 2602 copy = Finternal_make_lisp_face (to, new_frame);
2603 f = XFRAME (new_frame);
2600 } 2604 }
2601 2605
2602 vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE); 2606 vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
@@ -2608,7 +2612,10 @@ The value is TO. */)
2608 free realized faces. */ 2612 free realized faces. */
2609 if (NILP (Fget (to, Qface_no_inherit))) 2613 if (NILP (Fget (to, Qface_no_inherit)))
2610 { 2614 {
2611 face_change = true; 2615 if (f)
2616 f->face_change = 1;
2617 else
2618 face_change = true;
2612 windows_or_buffers_changed = 55; 2619 windows_or_buffers_changed = 55;
2613 } 2620 }
2614 2621
@@ -2631,6 +2638,7 @@ FRAME 0 means change the face on all frames, and change the default
2631 /* Set one of enum font_property_index (> 0) if ATTR is one of 2638 /* Set one of enum font_property_index (> 0) if ATTR is one of
2632 font-related attributes other than QCfont and QCfontset. */ 2639 font-related attributes other than QCfont and QCfontset. */
2633 enum font_property_index prop_index = 0; 2640 enum font_property_index prop_index = 0;
2641 struct frame *f;
2634 2642
2635 CHECK_SYMBOL (face); 2643 CHECK_SYMBOL (face);
2636 CHECK_SYMBOL (attr); 2644 CHECK_SYMBOL (attr);
@@ -2651,6 +2659,7 @@ FRAME 0 means change the face on all frames, and change the default
2651 /* Set lface to the Lisp attribute vector of FACE. */ 2659 /* Set lface to the Lisp attribute vector of FACE. */
2652 if (EQ (frame, Qt)) 2660 if (EQ (frame, Qt))
2653 { 2661 {
2662 f = NULL;
2654 lface = lface_from_face_name (NULL, face, true); 2663 lface = lface_from_face_name (NULL, face, true);
2655 2664
2656 /* When updating face-new-frame-defaults, we put :ignore-defface 2665 /* When updating face-new-frame-defaults, we put :ignore-defface
@@ -2666,9 +2675,10 @@ FRAME 0 means change the face on all frames, and change the default
2666 { 2675 {
2667 if (NILP (frame)) 2676 if (NILP (frame))
2668 frame = selected_frame; 2677 frame = selected_frame;
2678 f = XFRAME (frame);
2669 2679
2670 CHECK_LIVE_FRAME (frame); 2680 CHECK_LIVE_FRAME (frame);
2671 lface = lface_from_face_name (XFRAME (frame), face, false); 2681 lface = lface_from_face_name (f, face, false);
2672 2682
2673 /* If a frame-local face doesn't exist yet, create one. */ 2683 /* If a frame-local face doesn't exist yet, create one. */
2674 if (NILP (lface)) 2684 if (NILP (lface))
@@ -2990,11 +3000,11 @@ FRAME 0 means change the face on all frames, and change the default
2990 else if (EQ (attr, QCfont)) 3000 else if (EQ (attr, QCfont))
2991 { 3001 {
2992#ifdef HAVE_WINDOW_SYSTEM 3002#ifdef HAVE_WINDOW_SYSTEM
2993 if (EQ (frame, Qt) || FRAME_WINDOW_P (XFRAME (frame))) 3003 if (EQ (frame, Qt) || FRAME_WINDOW_P (f))
2994 { 3004 {
2995 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)) 3005 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
2996 { 3006 {
2997 struct frame *f; 3007 struct frame *f1;
2998 3008
2999 old_value = LFACE_FONT (lface); 3009 old_value = LFACE_FONT (lface);
3000 if (! FONTP (value)) 3010 if (! FONTP (value))
@@ -3014,28 +3024,29 @@ FRAME 0 means change the face on all frames, and change the default
3014 signal_error ("Invalid font or font-spec", value); 3024 signal_error ("Invalid font or font-spec", value);
3015 } 3025 }
3016 if (EQ (frame, Qt)) 3026 if (EQ (frame, Qt))
3017 f = XFRAME (selected_frame); 3027 f1 = XFRAME (selected_frame);
3018 else 3028 else
3019 f = XFRAME (frame); 3029 f1 = XFRAME (frame);
3020 3030
3021 /* FIXME: 3031 /* FIXME:
3022 If frame is t, and selected frame is a tty frame, the font 3032 If frame is t, and selected frame is a tty frame, the font
3023 can't be realized. An improvement would be to loop over frames 3033 can't be realized. An improvement would be to loop over frames
3024 for a non-tty frame and use that. See discussion in Bug#18573. 3034 for a non-tty frame and use that. See discussion in Bug#18573.
3025 For a daemon, frame may be an initial frame (Bug#18869). */ 3035 For a daemon, frame may be an initial frame (Bug#18869). */
3026 if (FRAME_WINDOW_P (f)) 3036 if (FRAME_WINDOW_P (f1))
3027 { 3037 {
3028 if (! FONT_OBJECT_P (value)) 3038 if (! FONT_OBJECT_P (value))
3029 { 3039 {
3030 Lisp_Object *attrs = XVECTOR (lface)->contents; 3040 Lisp_Object *attrs = XVECTOR (lface)->contents;
3031 Lisp_Object font_object; 3041 Lisp_Object font_object;
3032 3042
3033 font_object = font_load_for_lface (f, attrs, value); 3043 font_object = font_load_for_lface (f1, attrs, value);
3034 if (NILP (font_object)) 3044 if (NILP (font_object))
3035 signal_error ("Font not available", value); 3045 signal_error ("Font not available", value);
3036 value = font_object; 3046 value = font_object;
3037 } 3047 }
3038 set_lface_from_font (f, lface, value, true); 3048 set_lface_from_font (f1, lface, value, true);
3049 f1->face_change = 1;
3039 } 3050 }
3040 } 3051 }
3041 else 3052 else
@@ -3046,7 +3057,7 @@ FRAME 0 means change the face on all frames, and change the default
3046 else if (EQ (attr, QCfontset)) 3057 else if (EQ (attr, QCfontset))
3047 { 3058 {
3048#ifdef HAVE_WINDOW_SYSTEM 3059#ifdef HAVE_WINDOW_SYSTEM
3049 if (EQ (frame, Qt) || FRAME_WINDOW_P (XFRAME (frame))) 3060 if (EQ (frame, Qt) || FRAME_WINDOW_P (f))
3050 { 3061 {
3051 Lisp_Object tmp; 3062 Lisp_Object tmp;
3052 3063
@@ -3108,7 +3119,7 @@ FRAME 0 means change the face on all frames, and change the default
3108 && NILP (Fget (face, Qface_no_inherit)) 3119 && NILP (Fget (face, Qface_no_inherit))
3109 && NILP (Fequal (old_value, value))) 3120 && NILP (Fequal (old_value, value)))
3110 { 3121 {
3111 face_change = true; 3122 f->face_change = true;
3112 windows_or_buffers_changed = 56; 3123 windows_or_buffers_changed = 56;
3113 } 3124 }
3114 3125
@@ -3281,7 +3292,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
3281 if (!NILP (face) 3292 if (!NILP (face)
3282 && NILP (Fget (face, Qface_no_inherit))) 3293 && NILP (Fget (face, Qface_no_inherit)))
3283 { 3294 {
3284 face_change = true; 3295 f->face_change = true;
3285 windows_or_buffers_changed = 57; 3296 windows_or_buffers_changed = 57;
3286 } 3297 }
3287} 3298}
@@ -4186,7 +4197,7 @@ free_realized_faces (struct face_cache *c)
4186 if (WINDOWP (f->root_window)) 4197 if (WINDOWP (f->root_window))
4187 { 4198 {
4188 clear_current_matrices (f); 4199 clear_current_matrices (f);
4189 windows_or_buffers_changed = 58; 4200 fset_redisplay (f);
4190 } 4201 }
4191 4202
4192 unblock_input (); 4203 unblock_input ();
@@ -4206,6 +4217,7 @@ free_all_realized_faces (Lisp_Object frame)
4206 Lisp_Object rest; 4217 Lisp_Object rest;
4207 FOR_EACH_FRAME (rest, frame) 4218 FOR_EACH_FRAME (rest, frame)
4208 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); 4219 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame)));
4220 windows_or_buffers_changed = 58;
4209 } 4221 }
4210 else 4222 else
4211 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); 4223 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame)));
@@ -4631,8 +4643,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
4631 that a face containing all the attributes in ATTRS, when merged with the 4643 that a face containing all the attributes in ATTRS, when merged with the
4632 default face for display, can be represented in a way that's 4644 default face for display, can be represented in a way that's
4633 4645
4634 \(1) different in appearance than the default face, and 4646 (1) different in appearance than the default face, and
4635 \(2) `close in spirit' to what the attributes specify, if not exact. */ 4647 (2) `close in spirit' to what the attributes specify, if not exact. */
4636 4648
4637static bool 4649static bool
4638x_supports_face_attributes_p (struct frame *f, 4650x_supports_face_attributes_p (struct frame *f,
@@ -4731,8 +4743,8 @@ x_supports_face_attributes_p (struct frame *f,
4731 that a face containing all the attributes in ATTRS, when merged 4743 that a face containing all the attributes in ATTRS, when merged
4732 with the default face for display, can be represented in a way that's 4744 with the default face for display, can be represented in a way that's
4733 4745
4734 \(1) different in appearance than the default face, and 4746 (1) different in appearance than the default face, and
4735 \(2) `close in spirit' to what the attributes specify, if not exact. 4747 (2) `close in spirit' to what the attributes specify, if not exact.
4736 4748
4737 Point (2) implies that a `:weight black' attribute will be satisfied 4749 Point (2) implies that a `:weight black' attribute will be satisfied
4738 by any terminal that can display bold, and a `:foreground "yellow"' as 4750 by any terminal that can display bold, and a `:foreground "yellow"' as
@@ -4914,8 +4926,8 @@ The definition of `supported' is somewhat heuristic, but basically means
4914that a face containing all the attributes in ATTRIBUTES, when merged 4926that a face containing all the attributes in ATTRIBUTES, when merged
4915with the default face for display, can be represented in a way that's 4927with the default face for display, can be represented in a way that's
4916 4928
4917 \(1) different in appearance than the default face, and 4929 (1) different in appearance than the default face, and
4918 \(2) `close in spirit' to what the attributes specify, if not exact. 4930 (2) `close in spirit' to what the attributes specify, if not exact.
4919 4931
4920Point (2) implies that a `:weight black' attribute will be satisfied by 4932Point (2) implies that a `:weight black' attribute will be satisfied by
4921any display that can display bold, and a `:foreground \"yellow\"' as long 4933any display that can display bold, and a `:foreground \"yellow\"' as long
@@ -6521,7 +6533,7 @@ changing this variable for it to take effect. */);
6521Each element is a cons (FONT-PATTERN . RESCALE-RATIO), where 6533Each element is a cons (FONT-PATTERN . RESCALE-RATIO), where
6522FONT-PATTERN is a font-spec or a regular expression matching a font name, and 6534FONT-PATTERN is a font-spec or a regular expression matching a font name, and
6523RESCALE-RATIO is a floating point number to specify how much larger 6535RESCALE-RATIO is a floating point number to specify how much larger
6524\(or smaller) font we should use. For instance, if a face requests 6536(or smaller) font we should use. For instance, if a face requests
6525a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); 6537a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */);
6526 Vface_font_rescale_alist = Qnil; 6538 Vface_font_rescale_alist = Qnil;
6527 6539
diff --git a/src/xfns.c b/src/xfns.c
index 0079e7b4357..d6a3d76e948 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1189,10 +1189,8 @@ x_change_tool_bar_height (struct frame *f, int height)
1189 f->n_tool_bar_rows = 0; 1189 f->n_tool_bar_rows = 0;
1190 1190
1191 adjust_frame_size (f, -1, -1, 1191 adjust_frame_size (f, -1, -1,
1192 ((!f->tool_bar_redisplayed_once 1192 ((NILP (fullscreen = get_frame_param (f, Qfullscreen))
1193 && (NILP (fullscreen = 1193 || EQ (fullscreen, Qfullwidth)) ? 1
1194 get_frame_param (f, Qfullscreen))
1195 || EQ (fullscreen, Qfullwidth))) ? 1
1196 : (old_height == 0 || height == 0) ? 2 1194 : (old_height == 0 || height == 0) ? 2
1197 : 4), 1195 : 4),
1198 false, Qtool_bar_lines); 1196 false, Qtool_bar_lines);
@@ -3446,8 +3444,8 @@ x_focus_frame (struct frame *f)
3446 3444
3447 3445
3448DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 3446DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
3449 doc: /* Internal function called by `color-defined-p', which see 3447 doc: /* Internal function called by `color-defined-p', which see.
3450.\(Note that the Nextstep version of this function ignores FRAME.) */) 3448(Note that the Nextstep version of this function ignores FRAME.) */)
3451 (Lisp_Object color, Lisp_Object frame) 3449 (Lisp_Object color, Lisp_Object frame)
3452{ 3450{
3453 XColor foo; 3451 XColor foo;
@@ -3614,7 +3612,7 @@ If omitted or nil, that stands for the selected frame's display. */)
3614DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 3612DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
3615 doc: /* Return the "vendor ID" string of the GUI software on TERMINAL. 3613 doc: /* Return the "vendor ID" string of the GUI software on TERMINAL.
3616 3614
3617\(Labeling every distributor as a "vendor" embodies the false assumption 3615(Labeling every distributor as a "vendor" embodies the false assumption
3618that operating systems cannot be developed and distributed noncommercially.) 3616that operating systems cannot be developed and distributed noncommercially.)
3619The optional argument TERMINAL specifies which display to ask about. 3617The optional argument TERMINAL specifies which display to ask about.
3620 3618
@@ -4712,7 +4710,7 @@ DISPLAY is the name of the display to connect to.
4712Optional second arg XRM-STRING is a string of resources in xrdb format. 4710Optional second arg XRM-STRING is a string of resources in xrdb format.
4713If the optional third arg MUST-SUCCEED is non-nil, 4711If the optional third arg MUST-SUCCEED is non-nil,
4714terminate Emacs if we can't open the connection. 4712terminate Emacs if we can't open the connection.
4715\(In the Nextstep version, the last two arguments are currently ignored.) */) 4713(In the Nextstep version, the last two arguments are currently ignored.) */)
4716 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) 4714 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
4717{ 4715{
4718 char *xrm_option; 4716 char *xrm_option;
diff --git a/src/xselect.c b/src/xselect.c
index 94a5584214f..9aaa10c6efa 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1915,7 +1915,7 @@ DEFUN ("x-own-selection-internal", Fx_own_selection_internal,
1915 Sx_own_selection_internal, 2, 3, 0, 1915 Sx_own_selection_internal, 2, 3, 0,
1916 doc: /* Assert an X selection of type SELECTION and value VALUE. 1916 doc: /* Assert an X selection of type SELECTION and value VALUE.
1917SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 1917SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
1918\(Those are literal upper-case symbol names, since that's what X expects.) 1918(Those are literal upper-case symbol names, since that's what X expects.)
1919VALUE is typically a string, or a cons of two markers, but may be 1919VALUE is typically a string, or a cons of two markers, but may be
1920anything that the functions on `selection-converter-alist' know about. 1920anything that the functions on `selection-converter-alist' know about.
1921 1921
@@ -1944,7 +1944,7 @@ DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
1944 Sx_get_selection_internal, 2, 4, 0, 1944 Sx_get_selection_internal, 2, 4, 0,
1945 doc: /* Return text selected from some X window. 1945 doc: /* Return text selected from some X window.
1946SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 1946SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
1947\(Those are literal upper-case symbol names, since that's what X expects.) 1947(Those are literal upper-case symbol names, since that's what X expects.)
1948TARGET-TYPE is the type of data desired, typically `STRING'. 1948TARGET-TYPE is the type of data desired, typically `STRING'.
1949 1949
1950TIME-STAMP is the time to use in the XConvertSelection call for foreign 1950TIME-STAMP is the time to use in the XConvertSelection call for foreign
@@ -2048,7 +2048,7 @@ DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
2048 doc: /* Whether the current Emacs process owns the given X Selection. 2048 doc: /* Whether the current Emacs process owns the given X Selection.
2049The arg should be the name of the selection in question, typically one of 2049The arg should be the name of the selection in question, typically one of
2050the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 2050the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
2051\(Those are literal upper-case symbol names, since that's what X expects.) 2051(Those are literal upper-case symbol names, since that's what X expects.)
2052For convenience, the symbol nil is the same as `PRIMARY', 2052For convenience, the symbol nil is the same as `PRIMARY',
2053and t is the same as `SECONDARY'. 2053and t is the same as `SECONDARY'.
2054 2054
@@ -2271,7 +2271,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
2271 { 2271 {
2272 Lisp_Object o = XCAR (iter); 2272 Lisp_Object o = XCAR (iter);
2273 2273
2274 if (INTEGERP (o) || FLOATP (o) || CONSP (o)) 2274 if (NUMBERP (o) || CONSP (o))
2275 { 2275 {
2276 if (CONSP (o) 2276 if (CONSP (o)
2277 && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16) 2277 && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
@@ -2547,7 +2547,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2547 else 2547 else
2548 error ("DEST as a string must be one of PointerWindow or InputFocus"); 2548 error ("DEST as a string must be one of PointerWindow or InputFocus");
2549 } 2549 }
2550 else if (INTEGERP (dest) || FLOATP (dest) || CONSP (dest)) 2550 else if (NUMBERP (dest) || CONSP (dest))
2551 CONS_TO_INTEGER (dest, Window, wdest); 2551 CONS_TO_INTEGER (dest, Window, wdest);
2552 else 2552 else
2553 error ("DEST must be a frame, nil, string, number or cons"); 2553 error ("DEST must be a frame, nil, string, number or cons");
@@ -2623,7 +2623,7 @@ and the local selection value (whatever was given to
2623`x-own-selection-internal'). 2623`x-own-selection-internal').
2624 2624
2625The function should return the value to send to the X server 2625The function should return the value to send to the X server
2626\(typically a string). A return value of nil 2626(typically a string). A return value of nil
2627means that the conversion could not be done. 2627means that the conversion could not be done.
2628A return value which is the symbol `NULL' 2628A return value which is the symbol `NULL'
2629means that a side-effect was executed, 2629means that a side-effect was executed,
@@ -2632,10 +2632,10 @@ and there is no meaningful selection value. */);
2632 2632
2633 DEFVAR_LISP ("x-lost-selection-functions", Vx_lost_selection_functions, 2633 DEFVAR_LISP ("x-lost-selection-functions", Vx_lost_selection_functions,
2634 doc: /* A list of functions to be called when Emacs loses an X selection. 2634 doc: /* A list of functions to be called when Emacs loses an X selection.
2635\(This happens when some other X client makes its own selection 2635(This happens when some other X client makes its own selection
2636or when a Lisp program explicitly clears the selection.) 2636or when a Lisp program explicitly clears the selection.)
2637The functions are called with one argument, the selection type 2637The functions are called with one argument, the selection type
2638\(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'). */); 2638(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'). */);
2639 Vx_lost_selection_functions = Qnil; 2639 Vx_lost_selection_functions = Qnil;
2640 2640
2641 DEFVAR_LISP ("x-sent-selection-functions", Vx_sent_selection_functions, 2641 DEFVAR_LISP ("x-sent-selection-functions", Vx_sent_selection_functions,
diff --git a/src/xterm.c b/src/xterm.c
index 9ee76e967e1..dd54552510c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -575,7 +575,7 @@ x_cr_export_frames (Lisp_Object frames, cairo_surface_type_t surface_type)
575 cairo_t *cr; 575 cairo_t *cr;
576 int width, height; 576 int width, height;
577 void (*surface_set_size_func) (cairo_surface_t *, double, double) = NULL; 577 void (*surface_set_size_func) (cairo_surface_t *, double, double) = NULL;
578 Lisp_Object acc = Qnil, args[2]; 578 Lisp_Object acc = Qnil;
579 int count = SPECPDL_INDEX (); 579 int count = SPECPDL_INDEX ();
580 580
581 Fredisplay (Qt); 581 Fredisplay (Qt);
@@ -659,9 +659,7 @@ x_cr_export_frames (Lisp_Object frames, cairo_surface_type_t surface_type)
659#endif 659#endif
660 unbind_to (count, Qnil); 660 unbind_to (count, Qnil);
661 661
662 args[0] = intern ("concat"); 662 return CALLN (Fapply, intern ("concat"), Fnreverse (acc));
663 args[1] = Fnreverse (acc);
664 return Fapply (2, args);
665} 663}
666 664
667#endif /* USE_CAIRO */ 665#endif /* USE_CAIRO */
@@ -5407,6 +5405,8 @@ xg_scroll_callback (GtkRange *range,
5407 ? scroll_bar_after_handle : scroll_bar_below_handle); 5405 ? scroll_bar_after_handle : scroll_bar_below_handle);
5408 bar->dragging = -1; 5406 bar->dragging = -1;
5409 break; 5407 break;
5408 default:
5409 break;
5410 } 5410 }
5411 5411
5412 if (part != scroll_bar_nowhere) 5412 if (part != scroll_bar_nowhere)
@@ -10193,6 +10193,9 @@ x_check_fullscreen (struct frame *f)
10193 case FULLSCREEN_HEIGHT: 10193 case FULLSCREEN_HEIGHT:
10194 lval = Qfullheight; 10194 lval = Qfullheight;
10195 height = x_display_pixel_height (dpyinfo); 10195 height = x_display_pixel_height (dpyinfo);
10196 break;
10197 default:
10198 emacs_abort ();
10196 } 10199 }
10197 10200
10198 frame_size_history_add 10201 frame_size_history_add