aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-02-24 22:41:40 -0800
committerPaul Eggert2012-02-24 22:41:40 -0800
commita89654f8f34114db543cb91363e8fded6d73e986 (patch)
tree5ac508597ef2aa460308b4b26c244779e48cdb40 /src
parent6e6c82a4e687708d5a7a3887f92db45bd74da276 (diff)
parent67b0de11479247cb8bd8491e10e0b464046f18be (diff)
downloademacs-a89654f8f34114db543cb91363e8fded6d73e986.tar.gz
emacs-a89654f8f34114db543cb91363e8fded6d73e986.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit8
-rw-r--r--src/ChangeLog127
-rw-r--r--src/ChangeLog.102
-rw-r--r--src/ChangeLog.116
-rw-r--r--src/ChangeLog.711
-rw-r--r--src/buffer.c6
-rw-r--r--src/eval.c49
-rw-r--r--src/fileio.c102
-rw-r--r--src/gnutls.c29
-rw-r--r--src/gtkutil.c5
-rw-r--r--src/image.c2
-rw-r--r--src/keyboard.c60
-rw-r--r--src/keymap.c10
-rw-r--r--src/lisp.h32
-rw-r--r--src/mem-limits.h2
-rw-r--r--src/nsselect.m114
-rw-r--r--src/syntax.c21
-rw-r--r--src/w16select.c19
-rw-r--r--src/w32select.c19
-rw-r--r--src/window.c15
-rw-r--r--src/window.h4
-rw-r--r--src/xdisp.c5
-rw-r--r--src/xfns.c42
-rw-r--r--src/xselect.c47
-rw-r--r--src/xterm.c26
25 files changed, 571 insertions, 192 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index fc8eab6d1df..7cd828733b1 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -254,8 +254,8 @@ define pitx
254 while ($i < $it->sp && $i < 4) 254 while ($i < $it->sp && $i < 4)
255 set $e = $it->stack[$i] 255 set $e = $it->stack[$i]
256 printf "stack[%d]: ", $i 256 printf "stack[%d]: ", $i
257 pitmethod $e->method 257 pitmethod $e.method
258 printf "[%d]", $e->position.charpos 258 printf "[%d]", $e.position.charpos
259 printf "\n" 259 printf "\n"
260 set $i = $i + 1 260 set $i = $i + 1
261 end 261 end
@@ -1259,7 +1259,9 @@ end
1259 1259
1260define xreload 1260define xreload
1261 set $tagmask = (((long)1 << gdb_gctypebits) - 1) 1261 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
1262 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1 1262 # The consing_since_gc business widens the 1 to EMACS_INT,
1263 # a symbol not directly visible to GDB.
1264 set $valmask = gdb_use_lsb ? ~($tagmask) : ((consing_since_gc - consing_since_gc + 1) << gdb_valbits) - 1
1263end 1265end
1264document xreload 1266document xreload
1265 When starting Emacs a second time in the same gdb session under 1267 When starting Emacs a second time in the same gdb session under
diff --git a/src/ChangeLog b/src/ChangeLog
index 79bcf192eb7..71ddf053dac 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12012-02-10 Paul Eggert <eggert@cs.ucla.edu> 12012-02-25 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Fix integer width and related bugs (Bug#9874). 3 Fix integer width and related bugs (Bug#9874).
4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): 4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
@@ -788,6 +788,126 @@
788 rather than rolling our own approximation. 788 rather than rolling our own approximation.
789 (SCROLL_BAR_VEC_SIZE): Remove; not used. 789 (SCROLL_BAR_VEC_SIZE): Remove; not used.
790 790
7912012-02-25 Chong Yidong <cyd@gnu.org>
792
793 * xselect.c (Fx_selection_exists_p): Doc fix.
794 (x_clipboard_manager_save_all): Print an informative message
795 before saving to clipboard manager.
796
7972012-02-24 Chong Yidong <cyd@gnu.org>
798
799 * keyboard.c (process_special_events): Handle all X selection
800 requests in kbd_buffer, not just the next one (Bug#8869).
801
8022012-02-23 Chong Yidong <cyd@gnu.org>
803
804 * xfns.c (Fx_create_frame): Avoid window-configuration-change-hook
805 call when setting menu-bar-lines and tool-bar-lines parameters.
806 (unwind_create_frame_1): New helper function.
807
808 * window.c (inhibit_window_configuration_change_hook): New var.
809 (run_window_configuration_change_hook): Obey it.
810 (syms_of_window): Initialize it.
811
8122012-02-22 Chong Yidong <cyd@gnu.org>
813
814 * xterm.c (x_draw_image_relief): Add missing type check for
815 Vtool_bar_button_margin (Bug#10743).
816
8172012-02-21 Chong Yidong <cyd@gnu.org>
818
819 * fileio.c (Vfile_name_handler_alist): Doc fix.
820
821 * buffer.c (Fget_file_buffer): Protect against invalid file
822 handler return value.
823
8242012-02-20 Paul Eggert <eggert@cs.ucla.edu>
825
826 * .gdbinit (xreload): Don't assume EMACS_INT fits in 'long'
827 when computing $valmask.
828
829 Fix crash due to non-contiguous EMACS_INT (Bug#10780).
830 * lisp.h (VALBITS): Move definition up, so that USE_LSB_TAG can use it.
831 (USE_LSB_TAG): Do not define if UINTPTR_MAX >> VALBITS == 0.
832 It's useless in that case, and it can cause problems on hosts
833 that allocate halves of EMACS_INT values separately.
834 Reported by Dan Horák. Diagnosed by Andreas Schwab in
835 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780#30>.
836 * mem-limits.h (EXCEEDS_LISP_PTR): Define to 0 on hosts where
837 UINTPTR_MAX >> VALBITS == 0. This is required by the above change;
838 it avoids undefined behavior on hosts where shifting right by more
839 than the word width has undefined behavior.
840
8412012-02-19 Chong Yidong <cyd@gnu.org>
842
843 * fileio.c (Ffile_name_directory, Ffile_name_nondirectory)
844 (Funhandled_file_name_directory, Ffile_name_as_directory)
845 (Fdirectory_file_name, Fexpand_file_name)
846 (Fsubstitute_in_file_name): Protect against invalid file handler
847 return values (Bug#10845).
848
8492012-02-18 Eli Zaretskii <eliz@gnu.org>
850
851 * .gdbinit (pitx): Fix incorrect references to fields of the
852 iterator stack.
853
8542012-02-17 Chong Yidong <cyd@gnu.org>
855
856 * syntax.c (Fscan_lists): Doc fix (Bug#10833).
857
8582012-02-15 Paul Eggert <eggert@cs.ucla.edu>
859
860 * image.c (MAX_IMAGE_SIZE): Increase from 6.0 to 10.0; see
861 <http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00540.html>.
862
8632012-02-15 Chong Yidong <cyd@gnu.org>
864
865 * eval.c (Fdefvar, Fdefconst): Doc fix; note that the variable is
866 marked as special. Also, starting docstrings with * is obsolete.
867
8682012-02-13 Andreas Schwab <schwab@linux-m68k.org>
869
870 * gnutls.c (emacs_gnutls_write): Fix last change.
871
8722012-02-13 Lars Ingebrigtsen <larsi@gnus.org>
873
874 * gnutls.c (emacs_gnutls_write): Set errno appropriately for
875 send_process.
876
8772012-02-13 Stefan Monnier <monnier@iro.umontreal.ca>
878
879 * keymap.c (Fsingle_key_description): Handle char ranges.
880
8812012-02-12 Chong Yidong <cyd@gnu.org>
882
883 * xdisp.c (handle_stop): Avoid assigning -1 to it->face_id here,
884 as that creates a dangerous corner case.
885
886 * window.c (Fdelete_window_internal): Invalidate the mouse
887 highlight (Bug#9904).
888
8892012-02-12 Glenn Morris <rgm@gnu.org>
890
891 * xselect.c (Fx_own_selection_internal)
892 (Fx_get_selection_internal, Fx_disown_selection_internal)
893 (Fx_selection_owner_p, Fx_selection_exists_p): Doc fixes.
894 * nsselect.m (Fx_own_selection_internal)
895 (Fx_disown_selection_internal, Fx_selection_exists_p)
896 (Fx_selection_owner_p, Fx_get_selection_internal):
897 Sync docs and argument specs with the xselect.c versions.
898
8992012-02-11 Lars Ingebrigtsen <larsi@gnus.org>
900
901 * gnutls.c (emacs_gnutls_write): Don't infloop if sendto fails.
902
9032012-02-11 Eli Zaretskii <eliz@gnu.org>
904
905 * w32select.c (Fx_selection_exists_p): Sync doc string and
906 argument list with xselect.c. (Bug#10783)
907
908 * w16select.c (Fx_selection_exists_p): Sync doc string and
909 argument list with xselect.c. (Bug#10783)
910
7912012-02-10 Glenn Morris <rgm@gnu.org> 9112012-02-10 Glenn Morris <rgm@gnu.org>
792 912
793 * fns.c (Fsecure_hash): Doc fix. 913 * fns.c (Fsecure_hash): Doc fix.
@@ -7440,7 +7560,7 @@
7440 conversion specifiers. For example, use "...%"pI"d..." rather 7560 conversion specifiers. For example, use "...%"pI"d..." rather
7441 than "...%"pEd"...". 7561 than "...%"pEd"...".
7442 (pEd): Remove. All uses replaced with similar uses of pI. 7562 (pEd): Remove. All uses replaced with similar uses of pI.
7443 * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise. 7563 * m/amdx86-64.h, m/ia64.h, m/ibms390x.h: Likewise.
7444 * alloc.c (check_pure_size): Don't overflow by converting size to int. 7564 * alloc.c (check_pure_size): Don't overflow by converting size to int.
7445 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast. 7565 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
7446 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort. 7566 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
@@ -8422,8 +8542,7 @@
8422 Without this change, on typical 64-bit hosts error ("...%d...", N) 8542 Without this change, on typical 64-bit hosts error ("...%d...", N)
8423 was used to print both 32- and 64-bit integers N, which relied on 8543 was used to print both 32- and 64-bit integers N, which relied on
8424 undefined behavior. 8544 undefined behavior.
8425 * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd): 8545 * lisp.h, m/amdx86-64.h, m/ia64.h, m/ibms390x.h (pEd): New macro.
8426 New macro.
8427 * lisp.h (error, verror): Mark as printf-like functions. 8546 * lisp.h (error, verror): Mark as printf-like functions.
8428 * eval.c (verror): Use vsnprintf, not doprnt, to do the real work. 8547 * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
8429 Report overflow in size calculations when allocating printf buffer. 8548 Report overflow in size calculations when allocating printf buffer.
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index 5baeb877939..10de7e53794 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -20972,7 +20972,7 @@
20972 20972
209732002-12-30 Richard Dawe <rich@phekda.freeserve.co.uk> 209732002-12-30 Richard Dawe <rich@phekda.freeserve.co.uk>
20974 20974
20975 * src/config.in (!HAVE_SIZE_T): Fix order of arguments in 20975 * config.in (!HAVE_SIZE_T): Fix order of arguments in
20976 type definition of size_t. 20976 type definition of size_t.
20977 20977
209782003-01-02 Steven Tamm <steventamm@mac.com> 209782003-01-02 Steven Tamm <steventamm@mac.com>
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index e8bfd964312..2e5404779b1 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -533,8 +533,8 @@
533 * deps.mk (getloadavg.o): Remove; gnulib now does this. 533 * deps.mk (getloadavg.o): Remove; gnulib now does this.
534 * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib 534 * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
535 now does this. 535 now does this.
536 * src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this. 536 * s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
537 * src/s/netbsd.h (HAVE_GETLOADAVG): Likewise. 537 * s/netbsd.h (HAVE_GETLOADAVG): Likewise.
538 * config.in: Regenerate. 538 * config.in: Regenerate.
539 539
5402011-02-15 Eli Zaretskii <eliz@gnu.org> 5402011-02-15 Eli Zaretskii <eliz@gnu.org>
@@ -12539,7 +12539,7 @@
12539 12539
125402009-06-23 Jim Meyering <meyering@redhat.com> 125402009-06-23 Jim Meyering <meyering@redhat.com>
12541 12541
12542 * src/ftfont.c (setup_otf_gstring, ftfont_shape_by_flt): 12542 * ftfont.c (setup_otf_gstring, ftfont_shape_by_flt):
12543 Use xmalloc and xrealloc (not malloc and realloc), so subsequent heap 12543 Use xmalloc and xrealloc (not malloc and realloc), so subsequent heap
12544 pointer dereferences are guaranteed to be valid. 12544 pointer dereferences are guaranteed to be valid.
12545 12545
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index 891c1ca081a..0952826e8c6 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -331,7 +331,7 @@
331 331
3321998-07-30 Paul Eggert <eggert@twinsun.com> 3321998-07-30 Paul Eggert <eggert@twinsun.com>
333 333
334 * src/Makefile.in (widget.o, xfns.o, xmenu.o): 334 * Makefile.in (widget.o, xfns.o, xmenu.o):
335 Prepend $(srcdir)/ to rule dependencies outside this dir. 335 Prepend $(srcdir)/ to rule dependencies outside this dir.
336 336
3371998-07-29 Kenichi Handa <handa@etl.go.jp> 3371998-07-29 Kenichi Handa <handa@etl.go.jp>
@@ -4884,14 +4884,13 @@
4884 The new GNU C library strftime needs the underlying host's 4884 The new GNU C library strftime needs the underlying host's
4885 strftime for locale dependent formats. 4885 strftime for locale dependent formats.
4886 4886
4887 * configure.in (AC_CHECK_FUNCS): Add strftime. 4887 * config.in (HAVE_STRFTIME): New undef.
4888 * src/config.in (HAVE_STRFTIME): New undef. 4888 * editfns.c (emacs_strftime): New decl.
4889 * src/editfns.c (emacs_strftime): New decl.
4890 (Fformat_time_string): Doc fix: %b, %h, %B, %a, %A, and %p depend on 4889 (Fformat_time_string): Doc fix: %b, %h, %B, %a, %A, and %p depend on
4891 locale; don't use actual chars to describe %n and %t. 4890 locale; don't use actual chars to describe %n and %t.
4892 4891
4893 * src/Makefile.in (strftime.o): 4892 * Makefile.in (strftime.o):
4894 * src/makefile.nt ($(BLD)\strftime.obj): 4893 * makefile.nt ($(BLD)\strftime.obj):
4895 No need to compile with -Dstrftime=emacs_strftime any more. 4894 No need to compile with -Dstrftime=emacs_strftime any more.
4896 4895
48971997-11-22 Richard Stallman <rms@gnu.org> 48961997-11-22 Richard Stallman <rms@gnu.org>
diff --git a/src/buffer.c b/src/buffer.c
index 22ae522523a..acee3c45158 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -272,7 +272,11 @@ See also `find-buffer-visiting'. */)
272 call the corresponding file handler. */ 272 call the corresponding file handler. */
273 handler = Ffind_file_name_handler (filename, Qget_file_buffer); 273 handler = Ffind_file_name_handler (filename, Qget_file_buffer);
274 if (!NILP (handler)) 274 if (!NILP (handler))
275 return call2 (handler, Qget_file_buffer, filename); 275 {
276 Lisp_Object handled_buf = call2 (handler, Qget_file_buffer,
277 filename);
278 return BUFFERP (handled_buf) ? handled_buf : Qnil;
279 }
276 280
277 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 281 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
278 { 282 {
diff --git a/src/eval.c b/src/eval.c
index ed3c811f28a..7f3bf6a866f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -752,17 +752,15 @@ The return value is BASE-VARIABLE. */)
752 752
753DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, 753DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
754 doc: /* Define SYMBOL as a variable, and return SYMBOL. 754 doc: /* Define SYMBOL as a variable, and return SYMBOL.
755You are not required to define a variable in order to use it, 755You are not required to define a variable in order to use it, but
756but the definition can supply documentation and an initial value 756defining it lets you supply an initial value and documentation, which
757in a way that tags can recognize. 757can be referred to by the Emacs help facilities and other programming
758 758tools. The `defvar' form also declares the variable as \"special\",
759INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void. 759so that it is always dynamically bound even if `lexical-binding' is t.
760If SYMBOL is buffer-local, its default value is what is set; 760
761 buffer-local values are not affected. 761The optional argument INITVALUE is evaluated, and used to set SYMBOL,
762INITVALUE and DOCSTRING are optional. 762only if SYMBOL's value is void. If SYMBOL is buffer-local, its
763If DOCSTRING starts with *, this variable is identified as a user option. 763default value is what is set; buffer-local values are not affected.
764 This means that M-x set-variable recognizes it.
765 See also `user-variable-p'.
766If INITVALUE is missing, SYMBOL's value is not set. 764If INITVALUE is missing, SYMBOL's value is not set.
767 765
768If SYMBOL has a local binding, then this form affects the local 766If SYMBOL has a local binding, then this form affects the local
@@ -771,6 +769,13 @@ load a file defining variables, with this form or with `defconst' or
771`defcustom', you should always load that file _outside_ any bindings 769`defcustom', you should always load that file _outside_ any bindings
772for these variables. \(`defconst' and `defcustom' behave similarly in 770for these variables. \(`defconst' and `defcustom' behave similarly in
773this respect.) 771this respect.)
772
773The optional argument DOCSTRING is a documentation string for the
774variable.
775
776To define a user option, use `defcustom' instead of `defvar'.
777The function `user-variable-p' also identifies a variable as a user
778option if its DOCSTRING starts with *, but this behavior is obsolete.
774usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 779usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
775 (Lisp_Object args) 780 (Lisp_Object args)
776{ 781{
@@ -845,15 +850,19 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
845 850
846DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, 851DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
847 doc: /* Define SYMBOL as a constant variable. 852 doc: /* Define SYMBOL as a constant variable.
848The intent is that neither programs nor users should ever change this value. 853This declares that neither programs nor users should ever change the
849Always sets the value of SYMBOL to the result of evalling INITVALUE. 854value. This constancy is not actually enforced by Emacs Lisp, but
850If SYMBOL is buffer-local, its default value is what is set; 855SYMBOL is marked as a special variable so that it is never lexically
851 buffer-local values are not affected. 856bound.
852DOCSTRING is optional. 857
853 858The `defconst' form always sets the value of SYMBOL to the result of
854If SYMBOL has a local binding, then this form sets the local binding's 859evalling INITVALUE. If SYMBOL is buffer-local, its default value is
855value. However, you should normally not make local bindings for 860what is set; buffer-local values are not affected. If SYMBOL has a
856variables defined with this form. 861local binding, then this form sets the local binding's value.
862However, you should normally not make local bindings for variables
863defined with this form.
864
865The optional DOCSTRING specifies the variable's documentation string.
857usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) 866usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
858 (Lisp_Object args) 867 (Lisp_Object args)
859{ 868{
diff --git a/src/fileio.c b/src/fileio.c
index 5216135f000..b5a4aac6217 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -328,7 +328,11 @@ Given a Unix syntax file name, returns a string ending in slash. */)
328 call the corresponding file handler. */ 328 call the corresponding file handler. */
329 handler = Ffind_file_name_handler (filename, Qfile_name_directory); 329 handler = Ffind_file_name_handler (filename, Qfile_name_directory);
330 if (!NILP (handler)) 330 if (!NILP (handler))
331 return call2 (handler, Qfile_name_directory, filename); 331 {
332 Lisp_Object handled_name = call2 (handler, Qfile_name_directory,
333 filename);
334 return STRINGP (handled_name) ? handled_name : Qnil;
335 }
332 336
333 filename = FILE_SYSTEM_CASE (filename); 337 filename = FILE_SYSTEM_CASE (filename);
334#ifdef DOS_NT 338#ifdef DOS_NT
@@ -397,7 +401,13 @@ or the entire name if it contains no slash. */)
397 call the corresponding file handler. */ 401 call the corresponding file handler. */
398 handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory); 402 handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory);
399 if (!NILP (handler)) 403 if (!NILP (handler))
400 return call2 (handler, Qfile_name_nondirectory, filename); 404 {
405 Lisp_Object handled_name = call2 (handler, Qfile_name_nondirectory,
406 filename);
407 if (STRINGP (handled_name))
408 return handled_name;
409 error ("Invalid handler in `file-name-handler-alist'");
410 }
401 411
402 beg = SSDATA (filename); 412 beg = SSDATA (filename);
403 end = p = beg + SBYTES (filename); 413 end = p = beg + SBYTES (filename);
@@ -434,7 +444,11 @@ get a current directory to run processes in. */)
434 call the corresponding file handler. */ 444 call the corresponding file handler. */
435 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory); 445 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory);
436 if (!NILP (handler)) 446 if (!NILP (handler))
437 return call2 (handler, Qunhandled_file_name_directory, filename); 447 {
448 Lisp_Object handled_name = call2 (handler, Qunhandled_file_name_directory,
449 filename);
450 return STRINGP (handled_name) ? handled_name : Qnil;
451 }
438 452
439 return Ffile_name_directory (filename); 453 return Ffile_name_directory (filename);
440} 454}
@@ -488,7 +502,13 @@ For a Unix-syntax file name, just appends a slash. */)
488 call the corresponding file handler. */ 502 call the corresponding file handler. */
489 handler = Ffind_file_name_handler (file, Qfile_name_as_directory); 503 handler = Ffind_file_name_handler (file, Qfile_name_as_directory);
490 if (!NILP (handler)) 504 if (!NILP (handler))
491 return call2 (handler, Qfile_name_as_directory, file); 505 {
506 Lisp_Object handled_name = call2 (handler, Qfile_name_as_directory,
507 file);
508 if (STRINGP (handled_name))
509 return handled_name;
510 error ("Invalid handler in `file-name-handler-alist'");
511 }
492 512
493 buf = (char *) alloca (SBYTES (file) + 10); 513 buf = (char *) alloca (SBYTES (file) + 10);
494 file_name_as_directory (buf, SSDATA (file)); 514 file_name_as_directory (buf, SSDATA (file));
@@ -547,7 +567,13 @@ In Unix-syntax, this function just removes the final slash. */)
547 call the corresponding file handler. */ 567 call the corresponding file handler. */
548 handler = Ffind_file_name_handler (directory, Qdirectory_file_name); 568 handler = Ffind_file_name_handler (directory, Qdirectory_file_name);
549 if (!NILP (handler)) 569 if (!NILP (handler))
550 return call2 (handler, Qdirectory_file_name, directory); 570 {
571 Lisp_Object handled_name = call2 (handler, Qdirectory_file_name,
572 directory);
573 if (STRINGP (handled_name))
574 return handled_name;
575 error ("Invalid handler in `file-name-handler-alist'");
576 }
551 577
552 buf = (char *) alloca (SBYTES (directory) + 20); 578 buf = (char *) alloca (SBYTES (directory) + 20);
553 directory_file_name (SSDATA (directory), buf); 579 directory_file_name (SSDATA (directory), buf);
@@ -747,7 +773,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
747 int is_escaped = 0; 773 int is_escaped = 0;
748#endif /* DOS_NT */ 774#endif /* DOS_NT */
749 ptrdiff_t length; 775 ptrdiff_t length;
750 Lisp_Object handler, result; 776 Lisp_Object handler, result, handled_name;
751 int multibyte; 777 int multibyte;
752 Lisp_Object hdir; 778 Lisp_Object hdir;
753 779
@@ -757,7 +783,14 @@ filesystem tree, not (expand-file-name ".." dirname). */)
757 call the corresponding file handler. */ 783 call the corresponding file handler. */
758 handler = Ffind_file_name_handler (name, Qexpand_file_name); 784 handler = Ffind_file_name_handler (name, Qexpand_file_name);
759 if (!NILP (handler)) 785 if (!NILP (handler))
760 return call3 (handler, Qexpand_file_name, name, default_directory); 786 {
787 handled_name = call3 (handler, Qexpand_file_name,
788 name, default_directory);
789 if (STRINGP (handled_name))
790 return handled_name;
791 error ("Invalid handler in `file-name-handler-alist'");
792 }
793
761 794
762 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ 795 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
763 if (NILP (default_directory)) 796 if (NILP (default_directory))
@@ -783,7 +816,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
783 { 816 {
784 handler = Ffind_file_name_handler (default_directory, Qexpand_file_name); 817 handler = Ffind_file_name_handler (default_directory, Qexpand_file_name);
785 if (!NILP (handler)) 818 if (!NILP (handler))
786 return call3 (handler, Qexpand_file_name, name, default_directory); 819 {
820 handled_name = call3 (handler, Qexpand_file_name,
821 name, default_directory);
822 if (STRINGP (handled_name))
823 return handled_name;
824 error ("Invalid handler in `file-name-handler-alist'");
825 }
787 } 826 }
788 827
789 { 828 {
@@ -1284,7 +1323,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1284 to be expanded again. */ 1323 to be expanded again. */
1285 handler = Ffind_file_name_handler (result, Qexpand_file_name); 1324 handler = Ffind_file_name_handler (result, Qexpand_file_name);
1286 if (!NILP (handler)) 1325 if (!NILP (handler))
1287 return call3 (handler, Qexpand_file_name, result, default_directory); 1326 {
1327 handled_name = call3 (handler, Qexpand_file_name,
1328 result, default_directory);
1329 if (STRINGP (handled_name))
1330 return handled_name;
1331 error ("Invalid handler in `file-name-handler-alist'");
1332 }
1288 1333
1289 return result; 1334 return result;
1290} 1335}
@@ -1537,7 +1582,13 @@ those `/' is discarded. */)
1537 call the corresponding file handler. */ 1582 call the corresponding file handler. */
1538 handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name); 1583 handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name);
1539 if (!NILP (handler)) 1584 if (!NILP (handler))
1540 return call2 (handler, Qsubstitute_in_file_name, filename); 1585 {
1586 Lisp_Object handled_name = call2 (handler, Qsubstitute_in_file_name,
1587 filename);
1588 if (STRINGP (handled_name))
1589 return handled_name;
1590 error ("Invalid handler in `file-name-handler-alist'");
1591 }
1541 1592
1542 /* Always work on a copy of the string, in case GC happens during 1593 /* Always work on a copy of the string, in case GC happens during
1543 decode of environment variables, causing the original Lisp_String 1594 decode of environment variables, causing the original Lisp_String
@@ -5596,18 +5647,25 @@ of file names regardless of the current language environment. */);
5596 make_pure_c_string ("Cannot set file date")); 5647 make_pure_c_string ("Cannot set file date"));
5597 5648
5598 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, 5649 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist,
5599 doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially. 5650 doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially.
5600If a file name matches REGEXP, then all I/O on that file is done by calling 5651If a file name matches REGEXP, all I/O on that file is done by calling
5601HANDLER. 5652HANDLER. If a file name matches more than one handler, the handler
5602 5653whose match starts last in the file name gets precedence. The
5603The first argument given to HANDLER is the name of the I/O primitive 5654function `find-file-name-handler' checks this list for a handler for
5604to be handled; the remaining arguments are the arguments that were 5655its argument.
5605passed to that primitive. For example, if you do 5656
5606 (file-exists-p FILENAME) 5657HANDLER should be a function. The first argument given to it is the
5607and FILENAME is handled by HANDLER, then HANDLER is called like this: 5658name of the I/O primitive to be handled; the remaining arguments are
5608 (funcall HANDLER 'file-exists-p FILENAME) 5659the arguments that were passed to that primitive. For example, if you
5609The function `find-file-name-handler' checks this list for a handler 5660do (file-exists-p FILENAME) and FILENAME is handled by HANDLER, then
5610for its argument. */); 5661HANDLER is called like this:
5662
5663 (funcall HANDLER 'file-exists-p FILENAME)
5664
5665Note that HANDLER must be able to handle all I/O primitives; if it has
5666nothing special to do for a primitive, it should reinvoke the
5667primitive to handle the operation \"the usual way\".
5668See Info node `(elisp)Magic File Names' for more details. */);
5611 Vfile_name_handler_alist = Qnil; 5669 Vfile_name_handler_alist = Qnil;
5612 5670
5613 DEFVAR_LISP ("set-auto-coding-function", 5671 DEFVAR_LISP ("set-auto-coding-function",
diff --git a/src/gnutls.c b/src/gnutls.c
index a4eeb50bd74..99fc5c10e2b 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -345,15 +345,16 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
345 ptrdiff_t bytes_written; 345 ptrdiff_t bytes_written;
346 gnutls_session_t state = proc->gnutls_state; 346 gnutls_session_t state = proc->gnutls_state;
347 347
348 if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { 348 if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
349 {
349#ifdef EWOULDBLOCK 350#ifdef EWOULDBLOCK
350 errno = EWOULDBLOCK; 351 errno = EWOULDBLOCK;
351#endif 352#endif
352#ifdef EAGAIN 353#ifdef EAGAIN
353 errno = EAGAIN; 354 errno = EAGAIN;
354#endif 355#endif
355 return 0; 356 return 0;
356 } 357 }
357 358
358 bytes_written = 0; 359 bytes_written = 0;
359 360
@@ -363,10 +364,24 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
363 364
364 if (rtnval < 0) 365 if (rtnval < 0)
365 { 366 {
366 if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED) 367 if (rtnval == GNUTLS_E_INTERRUPTED)
367 continue; 368 continue;
368 else 369 else
369 break; 370 {
371 /* If we get GNUTLS_E_AGAIN, then set errno
372 appropriately so that send_process retries the
373 correct way instead of erroring out. */
374 if (rtnval == GNUTLS_E_AGAIN)
375 {
376#ifdef EWOULDBLOCK
377 errno = EWOULDBLOCK;
378#endif
379#ifdef EAGAIN
380 errno = EAGAIN;
381#endif
382 }
383 break;
384 }
370 } 385 }
371 386
372 buf += rtnval; 387 buf += rtnval;
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d5e890d7207..433cd8aa412 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1741,8 +1741,9 @@ xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
1741 PROMPT is a prompt to show to the user. May not be NULL. 1741 PROMPT is a prompt to show to the user. May not be NULL.
1742 DEFAULT_FILENAME is a default selection to be displayed. May be NULL. 1742 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1743 If MUSTMATCH_P is non-zero, the returned file name must be an existing 1743 If MUSTMATCH_P is non-zero, the returned file name must be an existing
1744 file. *FUNC is set to a function that can be used to retrieve the 1744 file. (Actually, this only has cosmetic effects, the user can
1745 selected file name from the returned widget. 1745 still enter a non-existing file.) *FUNC is set to a function that
1746 can be used to retrieve the selected file name from the returned widget.
1746 1747
1747 Returns the created widget. */ 1748 Returns the created widget. */
1748 1749
diff --git a/src/image.c b/src/image.c
index c8d6be3a354..a3b64b74997 100644
--- a/src/image.c
+++ b/src/image.c
@@ -975,7 +975,7 @@ or omitted means use the selected frame. */)
975 975
976static void free_image (struct frame *f, struct image *img); 976static void free_image (struct frame *f, struct image *img);
977 977
978#define MAX_IMAGE_SIZE 6.0 978#define MAX_IMAGE_SIZE 10.0
979/* Allocate and return a new image structure for image specification 979/* Allocate and return a new image structure for image specification
980 SPEC. SPEC has a hash value of HASH. */ 980 SPEC. SPEC has a hash value of HASH. */
981 981
diff --git a/src/keyboard.c b/src/keyboard.c
index 09743be6c3c..eb9152f2c6c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4154,29 +4154,55 @@ kbd_buffer_get_event (KBOARD **kbp,
4154static void 4154static void
4155process_special_events (void) 4155process_special_events (void)
4156{ 4156{
4157 while (kbd_fetch_ptr != kbd_store_ptr) 4157 struct input_event *event;
4158 {
4159 struct input_event *event;
4160 4158
4161 event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE) 4159 for (event = kbd_fetch_ptr; event != kbd_store_ptr; ++event)
4162 ? kbd_fetch_ptr 4160 {
4163 : kbd_buffer); 4161 if (event == kbd_buffer + KBD_BUFFER_SIZE)
4164 4162 {
4165 last_event_timestamp = event->timestamp; 4163 event = kbd_buffer;
4164 if (event == kbd_store_ptr)
4165 break;
4166 }
4166 4167
4167 /* These two kinds of events get special handling 4168 /* If we find a stored X selection request, handle it now. */
4168 and don't actually appear to the command loop. */
4169 if (event->kind == SELECTION_REQUEST_EVENT 4169 if (event->kind == SELECTION_REQUEST_EVENT
4170 || event->kind == SELECTION_CLEAR_EVENT) 4170 || event->kind == SELECTION_CLEAR_EVENT)
4171 { 4171 {
4172#ifdef HAVE_X11 4172#ifdef HAVE_X11
4173 struct input_event copy;
4174 4173
4175 /* Remove it from the buffer before processing it, 4174 /* Remove the event from the fifo buffer before processing;
4176 since otherwise swallow_events called recursively could see it 4175 otherwise swallow_events called recursively could see it
4177 and process it again. */ 4176 and process it again. To do this, we move the events
4178 copy = *event; 4177 between kbd_fetch_ptr and EVENT one slot to the right,
4179 kbd_fetch_ptr = event + 1; 4178 cyclically. */
4179
4180 struct input_event copy = *event;
4181 struct input_event *beg
4182 = (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
4183 ? kbd_buffer : kbd_fetch_ptr;
4184
4185 if (event > beg)
4186 memmove (beg + 1, beg, (event - beg) * sizeof (struct input_event));
4187 else if (event < beg)
4188 {
4189 if (event > kbd_buffer)
4190 memmove (kbd_buffer + 1, kbd_buffer,
4191 (event - kbd_buffer) * sizeof (struct input_event));
4192 *kbd_buffer = *(kbd_buffer + KBD_BUFFER_SIZE - 1);
4193 if (beg < kbd_buffer + KBD_BUFFER_SIZE - 1)
4194 memmove (beg + 1, beg,
4195 (kbd_buffer + KBD_BUFFER_SIZE - 1 - beg)
4196 * sizeof (struct input_event));
4197 }
4198
4199 if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
4200 kbd_fetch_ptr = kbd_buffer + 1;
4201 else
4202 kbd_fetch_ptr++;
4203
4204 /* X wants last_event_timestamp for selection ownership. */
4205 last_event_timestamp = copy.timestamp;
4180 input_pending = readable_events (0); 4206 input_pending = readable_events (0);
4181 x_handle_selection_event (&copy); 4207 x_handle_selection_event (&copy);
4182#else 4208#else
@@ -4185,8 +4211,6 @@ process_special_events (void)
4185 abort (); 4211 abort ();
4186#endif 4212#endif
4187 } 4213 }
4188 else
4189 break;
4190 } 4214 }
4191} 4215}
4192 4216
diff --git a/src/keymap.c b/src/keymap.c
index cc4419a4d2f..328e6d8ed23 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2288,9 +2288,15 @@ around function keys and event symbols. */)
2288 if (CONSP (key) && lucid_event_type_list_p (key)) 2288 if (CONSP (key) && lucid_event_type_list_p (key))
2289 key = Fevent_convert_list (key); 2289 key = Fevent_convert_list (key);
2290 2290
2291 if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key)))
2292 /* An interval from a map-char-table. */
2293 return concat3 (Fsingle_key_description (XCAR (key), no_angles),
2294 build_string (".."),
2295 Fsingle_key_description (XCDR (key), no_angles));
2296
2291 key = EVENT_HEAD (key); 2297 key = EVENT_HEAD (key);
2292 2298
2293 if (INTEGERP (key)) /* Normal character */ 2299 if (INTEGERP (key)) /* Normal character. */
2294 { 2300 {
2295 char tem[KEY_DESCRIPTION_SIZE], *p; 2301 char tem[KEY_DESCRIPTION_SIZE], *p;
2296 2302
@@ -2298,7 +2304,7 @@ around function keys and event symbols. */)
2298 *p = 0; 2304 *p = 0;
2299 return make_specified_string (tem, -1, p - tem, 1); 2305 return make_specified_string (tem, -1, p - tem, 1);
2300 } 2306 }
2301 else if (SYMBOLP (key)) /* Function key or event-symbol */ 2307 else if (SYMBOLP (key)) /* Function key or event-symbol. */
2302 { 2308 {
2303 if (NILP (no_angles)) 2309 if (NILP (no_angles))
2304 { 2310 {
diff --git a/src/lisp.h b/src/lisp.h
index cc82edb2f5f..8c274cddb56 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -168,6 +168,10 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
168#define GCTYPEBITS 3 168#define GCTYPEBITS 3
169#endif 169#endif
170 170
171#ifndef VALBITS
172#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
173#endif
174
171#ifndef NO_DECL_ALIGN 175#ifndef NO_DECL_ALIGN
172# ifndef DECL_ALIGN 176# ifndef DECL_ALIGN
173# if HAVE_ATTRIBUTE_ALIGNED 177# if HAVE_ATTRIBUTE_ALIGNED
@@ -191,7 +195,28 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
191 || defined DARWIN_OS || defined __sun) 195 || defined DARWIN_OS || defined __sun)
192/* We also need to be able to specify mult-of-8 alignment on static vars. */ 196/* We also need to be able to specify mult-of-8 alignment on static vars. */
193# if defined DECL_ALIGN 197# if defined DECL_ALIGN
194# define USE_LSB_TAG 198/* On hosts where VALBITS is greater than the pointer width in bits,
199 USE_LSB_TAG is:
200
201 a. unnecessary, because the top bits of an EMACS_INT are unused,
202
203 b. slower, because it typically requires extra masking, and
204
205 c. harmful, because it can create Lisp_Object values that are so scrambled
206 that mark_maybe_object cannot decipher them. mark_maybe_object assumes
207 that EMACS_INT values are contiguous, but a host where EMACS_INT is
208 wider than a pointer might allocate the top half of an EMACS_INT in
209 (say) a 32-bit word on the stack, putting the bottom half in a 32-bit
210 register that is saved elsewhere in a jmp_buf. When this happens,
211 since USE_LSB_TAG is not defined the bottom half alone is a valid
212 pointer that mark_maybe_pointer can follow; but if USE_LSB_TAG were
213 defined, the bottom half would not be a valid pointer and neither
214 mark_maybe_object nor mark_maybe_pointer would follow it.
215
216 So, define USE_LSB_TAG only on hosts where it might be useful. */
217# if UINTPTR_MAX >> VALBITS != 0
218# define USE_LSB_TAG
219# endif
195# endif 220# endif
196#endif 221#endif
197 222
@@ -309,11 +334,6 @@ enum Lisp_Fwd_Type
309 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ 334 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
310 }; 335 };
311 336
312/* These values are overridden by the m- file on some machines. */
313#ifndef VALBITS
314#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
315#endif
316
317#ifdef USE_LISP_UNION_TYPE 337#ifdef USE_LISP_UNION_TYPE
318 338
319#ifndef WORDS_BIGENDIAN 339#ifndef WORDS_BIGENDIAN
diff --git a/src/mem-limits.h b/src/mem-limits.h
index 472e591b38d..244592a9768 100644
--- a/src/mem-limits.h
+++ b/src/mem-limits.h
@@ -34,7 +34,7 @@ extern int etext;
34#endif 34#endif
35 35
36extern char *start_of_data (void); 36extern char *start_of_data (void);
37#if defined USE_LSB_TAG 37#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0
38#define EXCEEDS_LISP_PTR(ptr) 0 38#define EXCEEDS_LISP_PTR(ptr) 0
39#elif defined DATA_SEG_BITS 39#elif defined DATA_SEG_BITS
40#define EXCEEDS_LISP_PTR(ptr) \ 40#define EXCEEDS_LISP_PTR(ptr) \
diff --git a/src/nsselect.m b/src/nsselect.m
index 5741236c987..6352d882b7a 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -336,12 +336,18 @@ ns_string_to_pasteboard (id pb, Lisp_Object str)
336 336
337 337
338DEFUN ("x-own-selection-internal", Fx_own_selection_internal, 338DEFUN ("x-own-selection-internal", Fx_own_selection_internal,
339 Sx_own_selection_internal, 2, 2, 0, 339 Sx_own_selection_internal, 2, 3, 0,
340 doc: /* Assert a selection. 340 doc: /* Assert an X selection of type SELECTION and value VALUE.
341SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 341SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
342\(Those are literal upper-case symbol names, since that's what X expects.)
342VALUE is typically a string, or a cons of two markers, but may be 343VALUE is typically a string, or a cons of two markers, but may be
343anything that the functions on `selection-converter-alist' know about. */) 344anything that the functions on `selection-converter-alist' know about.
344 (Lisp_Object selection_name, Lisp_Object selection_value) 345
346FRAME should be a frame that should own the selection. If omitted or
347nil, it defaults to the selected frame.
348
349On Nextstep, FRAME is unused. */)
350 (Lisp_Object selection, Lisp_Object value, Lisp_Object frame)
345{ 351{
346 id pb; 352 id pb;
347 Lisp_Object old_value, new_value; 353 Lisp_Object old_value, new_value;
@@ -351,15 +357,15 @@ anything that the functions on `selection-converter-alist' know about. */)
351 357
352 358
353 check_ns (); 359 check_ns ();
354 CHECK_SYMBOL (selection_name); 360 CHECK_SYMBOL (selection);
355 if (NILP (selection_value)) 361 if (NILP (value))
356 error ("selection-value may not be nil."); 362 error ("selection value may not be nil.");
357 pb = ns_symbol_to_pb (selection_name); 363 pb = ns_symbol_to_pb (selection);
358 if (pb == nil) return Qnil; 364 if (pb == nil) return Qnil;
359 365
360 ns_declare_pasteboard (pb); 366 ns_declare_pasteboard (pb);
361 old_value = assq_no_quit (selection_name, Vselection_alist); 367 old_value = assq_no_quit (selection, Vselection_alist);
362 new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); 368 new_value = Fcons (selection, Fcons (value, Qnil));
363 369
364 if (NILP (old_value)) 370 if (NILP (old_value))
365 Vselection_alist = Fcons (new_value, Vselection_alist); 371 Vselection_alist = Fcons (new_value, Vselection_alist);
@@ -369,7 +375,7 @@ anything that the functions on `selection-converter-alist' know about. */)
369 /* We only support copy of text. */ 375 /* We only support copy of text. */
370 type = NSStringPboardType; 376 type = NSStringPboardType;
371 target_symbol = ns_string_to_symbol (type); 377 target_symbol = ns_string_to_symbol (type);
372 data = ns_get_local_selection (selection_name, target_symbol); 378 data = ns_get_local_selection (selection, target_symbol);
373 if (!NILP (data)) 379 if (!NILP (data))
374 { 380 {
375 if (STRINGP (data)) 381 if (STRINGP (data))
@@ -380,37 +386,53 @@ anything that the functions on `selection-converter-alist' know about. */)
380 if (!EQ (Vns_sent_selection_hooks, Qunbound)) 386 if (!EQ (Vns_sent_selection_hooks, Qunbound))
381 { 387 {
382 for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) 388 for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
383 call3 (Fcar (rest), selection_name, target_symbol, successful_p); 389 call3 (Fcar (rest), selection, target_symbol, successful_p);
384 } 390 }
385 391
386 return selection_value; 392 return value;
387} 393}
388 394
389 395
390DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, 396DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
391 Sx_disown_selection_internal, 1, 2, 0, 397 Sx_disown_selection_internal, 1, 3, 0,
392 doc: /* If we own the selection SELECTION, disown it. */) 398 doc: /* If we own the selection SELECTION, disown it.
393 (Lisp_Object selection_name, Lisp_Object time) 399Disowning it means there is no such selection.
400
401Sets the last-change time for the selection to TIME-OBJECT (by default
402the time of the last event).
403
404TERMINAL should be a terminal object or a frame specifying the X
405server to query. If omitted or nil, that stands for the selected
406frame's display, or the first available X display.
407
408On Nextstep, the TIME-OBJECT and TERMINAL arguments are unused.
409On MS-DOS, all this does is return non-nil if we own the selection. */)
410 (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal)
394{ 411{
395 id pb; 412 id pb;
396 check_ns (); 413 check_ns ();
397 CHECK_SYMBOL (selection_name); 414 CHECK_SYMBOL (selection);
398 if (NILP (assq_no_quit (selection_name, Vselection_alist))) return Qnil; 415 if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil;
399 416
400 pb = ns_symbol_to_pb (selection_name); 417 pb = ns_symbol_to_pb (selection);
401 if (pb != nil) ns_undeclare_pasteboard (pb); 418 if (pb != nil) ns_undeclare_pasteboard (pb);
402 return Qt; 419 return Qt;
403} 420}
404 421
405 422
406DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, 423DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
407 0, 1, 0, doc: /* Whether there is an owner for the given selection. 424 0, 2, 0, doc: /* Whether there is an owner for the given X selection.
408The arg should be the name of the selection in question, typically one of 425SELECTION should be the name of the selection in question, typically
409the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 426one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
410\(Those are literal upper-case symbol names.) 427these literal upper-case names.) The symbol nil is the same as
411For convenience, the symbol nil is the same as `PRIMARY', 428`PRIMARY', and t is the same as `SECONDARY'.
412and t is the same as `SECONDARY'.) */) 429
413 (Lisp_Object selection) 430TERMINAL should be a terminal object or a frame specifying the X
431server to query. If omitted or nil, that stands for the selected
432frame's display, or the first available X display.
433
434On Nextstep, TERMINAL is unused. */)
435 (Lisp_Object selection, Lisp_Object terminal)
414{ 436{
415 id pb; 437 id pb;
416 NSArray *types; 438 NSArray *types;
@@ -428,14 +450,20 @@ and t is the same as `SECONDARY'.) */)
428 450
429 451
430DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 452DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
431 0, 1, 0, 453 0, 2, 0,
432 doc: /* Whether the current Emacs process owns the given selection. 454 doc: /* Whether the current Emacs process owns the given X Selection.
433The arg should be the name of the selection in question, typically one of 455The arg should be the name of the selection in question, typically one of
434the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 456the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
435\(Those are literal upper-case symbol names.) 457\(Those are literal upper-case symbol names, since that's what X expects.)
436For convenience, the symbol nil is the same as `PRIMARY', 458For convenience, the symbol nil is the same as `PRIMARY',
437and t is the same as `SECONDARY'.) */) 459and t is the same as `SECONDARY'.
438 (Lisp_Object selection) 460
461TERMINAL should be a terminal object or a frame specifying the X
462server to query. If omitted or nil, that stands for the selected
463frame's display, or the first available X display.
464
465On Nextstep, TERMINAL is unused. */)
466 (Lisp_Object selection, Lisp_Object terminal)
439{ 467{
440 check_ns (); 468 check_ns ();
441 CHECK_SYMBOL (selection); 469 CHECK_SYMBOL (selection);
@@ -446,12 +474,22 @@ and t is the same as `SECONDARY'.) */)
446 474
447 475
448DEFUN ("x-get-selection-internal", Fx_get_selection_internal, 476DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
449 Sx_get_selection_internal, 2, 2, 0, 477 Sx_get_selection_internal, 2, 4, 0,
450 doc: /* Return text selected from some pasteboard. 478 doc: /* Return text selected from some X window.
451SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 479SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
452\(Those are literal upper-case symbol names.) 480\(Those are literal upper-case symbol names, since that's what X expects.)
453TYPE is the type of data desired, typically `STRING'. */) 481TARGET-TYPE is the type of data desired, typically `STRING'.
454 (Lisp_Object selection_name, Lisp_Object target_type) 482
483TIME-STAMP is the time to use in the XConvertSelection call for foreign
484selections. If omitted, defaults to the time for the last event.
485
486TERMINAL should be a terminal object or a frame specifying the X
487server to query. If omitted or nil, that stands for the selected
488frame's display, or the first available X display.
489
490On Nextstep, TIME-STAMP and TERMINAL are unused. */)
491 (Lisp_Object selection_name, Lisp_Object target_type,
492 Lisp_Object time_stamp, Lisp_Object terminal)
455{ 493{
456 Lisp_Object val; 494 Lisp_Object val;
457 495
diff --git a/src/syntax.c b/src/syntax.c
index a802360582b..70e66ba1871 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2846,18 +2846,23 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2846 2846
2847DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2847DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
2848 doc: /* Scan from character number FROM by COUNT lists. 2848 doc: /* Scan from character number FROM by COUNT lists.
2849Returns the character number of the position thus found. 2849Scan forward if COUNT is positive, backward if COUNT is negative.
2850Return the character number of the position thus found.
2851
2852A \"list", in this context, refers to a balanced parenthetical
2853grouping, as determined by the syntax table.
2850 2854
2851If DEPTH is nonzero, paren depth begins counting from that value, 2855If DEPTH is nonzero, treat that as the nesting depth of the starting
2852only places where the depth in parentheses becomes zero 2856point (i.e. the starting point is DEPTH parentheses deep). This
2853are candidates for stopping; COUNT such places are counted. 2857function scans over parentheses until the depth goes to zero COUNT
2854Thus, a positive value for DEPTH means go out levels. 2858times. Hence, positive DEPTH moves out that number of levels of
2859parentheses, while negative DEPTH moves to a deeper level.
2855 2860
2856Comments are ignored if `parse-sexp-ignore-comments' is non-nil. 2861Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
2857 2862
2858If the beginning or end of (the accessible part of) the buffer is reached 2863If we reach the beginning or end of the accessible part of the buffer
2859and the depth is wrong, an error is signaled. 2864before we have scanned over COUNT lists, return nil if the depth at
2860If the depth is right but the count is not used up, nil is returned. */) 2865that point is zero, and signal a error if the depth is nonzero. */)
2861 (Lisp_Object from, Lisp_Object count, Lisp_Object depth) 2866 (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
2862{ 2867{
2863 CHECK_NUMBER (from); 2868 CHECK_NUMBER (from);
diff --git a/src/w16select.c b/src/w16select.c
index 185bf252895..03f63bedf0d 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -637,14 +637,17 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
637/* Support checking for a clipboard selection. */ 637/* Support checking for a clipboard selection. */
638 638
639DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, 639DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
640 0, 1, 0, 640 0, 2, 0,
641 doc: /* Whether there is an owner for the given X Selection. 641 doc: /* Whether there is an owner for the given X selection.
642The arg should be the name of the selection in question, typically one of 642SELECTION should be the name of the selection in question, typically
643the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 643one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
644\(Those are literal upper-case symbol names, since that's what X expects.) 644these literal upper-case names.) The symbol nil is the same as
645For convenience, the symbol nil is the same as `PRIMARY', 645`PRIMARY', and t is the same as `SECONDARY'.
646and t is the same as `SECONDARY'. */) 646
647 (Lisp_Object selection) 647TERMINAL should be a terminal object or a frame specifying the X
648server to query. If omitted or nil, that stands for the selected
649frame's display, or the first available X display. */)
650 (Lisp_Object selection, Lisp_Object terminal)
648{ 651{
649 CHECK_SYMBOL (selection); 652 CHECK_SYMBOL (selection);
650 653
diff --git a/src/w32select.c b/src/w32select.c
index c60376b3a91..699c72b71a8 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1009,14 +1009,17 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
1009/* Support checking for a clipboard selection. */ 1009/* Support checking for a clipboard selection. */
1010 1010
1011DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, 1011DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
1012 0, 1, 0, 1012 0, 2, 0,
1013 doc: /* Whether there is an owner for the given X Selection. 1013 doc: /* Whether there is an owner for the given X selection.
1014The arg should be the name of the selection in question, typically one of 1014SELECTION should be the name of the selection in question, typically
1015the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 1015one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
1016\(Those are literal upper-case symbol names, since that's what X expects.) 1016these literal upper-case names.) The symbol nil is the same as
1017For convenience, the symbol nil is the same as `PRIMARY', 1017`PRIMARY', and t is the same as `SECONDARY'.
1018and t is the same as `SECONDARY'. */) 1018
1019 (Lisp_Object selection) 1019TERMINAL should be a terminal object or a frame specifying the X
1020server to query. If omitted or nil, that stands for the selected
1021frame's display, or the first available X display. */)
1022 (Lisp_Object selection, Lisp_Object terminal)
1020{ 1023{
1021 CHECK_SYMBOL (selection); 1024 CHECK_SYMBOL (selection);
1022 1025
diff --git a/src/window.c b/src/window.c
index a0b11e0e320..af70890d4e4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -122,6 +122,9 @@ static int window_initialized;
122/* Hook to run when window config changes. */ 122/* Hook to run when window config changes. */
123static Lisp_Object Qwindow_configuration_change_hook; 123static Lisp_Object Qwindow_configuration_change_hook;
124 124
125/* If non-nil, run_window_configuration_change_hook does nothing. */
126Lisp_Object inhibit_window_configuration_change_hook;
127
125/* Used by the function window_scroll_pixel_based */ 128/* Used by the function window_scroll_pixel_based */
126static int window_scroll_pixel_based_preserve_x; 129static int window_scroll_pixel_based_preserve_x;
127static int window_scroll_pixel_based_preserve_y; 130static int window_scroll_pixel_based_preserve_y;
@@ -2895,7 +2898,7 @@ run_window_configuration_change_hook (struct frame *f)
2895 = Fdefault_value (Qwindow_configuration_change_hook); 2898 = Fdefault_value (Qwindow_configuration_change_hook);
2896 XSETFRAME (frame, f); 2899 XSETFRAME (frame, f);
2897 2900
2898 if (NILP (Vrun_hooks)) 2901 if (NILP (Vrun_hooks) || !NILP (inhibit_window_configuration_change_hook))
2899 return; 2902 return;
2900 2903
2901 /* Use the right buffer. Matters when running the local hooks. */ 2904 /* Use the right buffer. Matters when running the local hooks. */
@@ -3887,10 +3890,18 @@ Signal an error when WINDOW is the only window on its frame. */)
3887 && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) 3890 && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
3888 /* We can delete WINDOW now. */ 3891 /* We can delete WINDOW now. */
3889 { 3892 {
3893 Mouse_HLInfo *hlinfo;
3894
3890 /* Block input. */ 3895 /* Block input. */
3891 BLOCK_INPUT; 3896 BLOCK_INPUT;
3892 window_resize_apply (p, horflag); 3897 window_resize_apply (p, horflag);
3893 3898
3899 /* If this window is referred to by the dpyinfo's mouse
3900 highlight, invalidate that slot to be safe (Bug#9904). */
3901 hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
3902 if (EQ (hlinfo->mouse_face_window, window))
3903 hlinfo->mouse_face_window = Qnil;
3904
3894 windows_or_buffers_changed++; 3905 windows_or_buffers_changed++;
3895 Vwindow_list = Qnil; 3906 Vwindow_list = Qnil;
3896 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3907 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -6518,6 +6529,8 @@ syms_of_window (void)
6518 window_scroll_preserve_hpos = -1; 6529 window_scroll_preserve_hpos = -1;
6519 window_scroll_preserve_vpos = -1; 6530 window_scroll_preserve_vpos = -1;
6520 6531
6532 inhibit_window_configuration_change_hook = Qnil;
6533
6521 DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, 6534 DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
6522 doc: /* Non-nil means call as function to display a help buffer. 6535 doc: /* Non-nil means call as function to display a help buffer.
6523The function is called with one argument, the buffer to be displayed. 6536The function is called with one argument, the buffer to be displayed.
diff --git a/src/window.h b/src/window.h
index ea127ca95a8..f4a5f52b9a5 100644
--- a/src/window.h
+++ b/src/window.h
@@ -810,6 +810,10 @@ extern Lisp_Object Vmouse_window;
810 810
811extern Lisp_Object Vmouse_event; 811extern Lisp_Object Vmouse_event;
812 812
813/* If non-nil, run_window_configuration_change_hook does nothing. */
814
815extern Lisp_Object inhibit_window_configuration_change_hook;
816
813EXFUN (Fnext_window, 3); 817EXFUN (Fnext_window, 3);
814EXFUN (Fselect_window, 2); 818EXFUN (Fselect_window, 2);
815EXFUN (Fset_window_buffer, 3); 819EXFUN (Fset_window_buffer, 3);
diff --git a/src/xdisp.c b/src/xdisp.c
index 3dac7ae011e..caf977633d8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2753,9 +2753,12 @@ init_iterator (struct it *it, struct window *w,
2753 if (charpos >= BUF_BEG (current_buffer)) 2753 if (charpos >= BUF_BEG (current_buffer))
2754 { 2754 {
2755 it->end_charpos = ZV; 2755 it->end_charpos = ZV;
2756 it->face_id = -1;
2757 IT_CHARPOS (*it) = charpos; 2756 IT_CHARPOS (*it) = charpos;
2758 2757
2758 /* We will rely on `reseat' to set this up properly, via
2759 handle_face_prop. */
2760 it->face_id = it->base_face_id;
2761
2759 /* Compute byte position if not specified. */ 2762 /* Compute byte position if not specified. */
2760 if (bytepos < charpos) 2763 if (bytepos < charpos)
2761 IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos); 2764 IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos);
diff --git a/src/xfns.c b/src/xfns.c
index b0cef7221f8..4cf4a059a67 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2949,6 +2949,12 @@ unwind_create_frame (Lisp_Object frame)
2949 return Qnil; 2949 return Qnil;
2950} 2950}
2951 2951
2952static Lisp_Object
2953unwind_create_frame_1 (Lisp_Object val)
2954{
2955 inhibit_window_configuration_change_hook = val;
2956 return Qnil;
2957}
2952 2958
2953static void 2959static void
2954x_default_font_parameter (struct frame *f, Lisp_Object parms) 2960x_default_font_parameter (struct frame *f, Lisp_Object parms)
@@ -3321,17 +3327,31 @@ This function is an internal primitive--use `make-frame' instead. */)
3321 happen. */ 3327 happen. */
3322 init_frame_faces (f); 3328 init_frame_faces (f);
3323 3329
3324 /* The X resources controlling the menu-bar and tool-bar are 3330 /* Set the menu-bar-lines and tool-bar-lines parameters. We don't
3325 processed specially at startup, and reflected in the mode 3331 look up the X resources controlling the menu-bar and tool-bar
3326 variables; ignore them here. */ 3332 here; they are processed specially at startup, and reflected in
3327 x_default_parameter (f, parms, Qmenu_bar_lines, 3333 the values of the mode variables.
3328 NILP (Vmenu_bar_mode) 3334
3329 ? make_number (0) : make_number (1), 3335 Avoid calling window-configuration-change-hook; otherwise we
3330 NULL, NULL, RES_TYPE_NUMBER); 3336 could get an infloop in next_frame since the frame is not yet in
3331 x_default_parameter (f, parms, Qtool_bar_lines, 3337 Vframe_list. */
3332 NILP (Vtool_bar_mode) 3338 {
3333 ? make_number (0) : make_number (1), 3339 ptrdiff_t count2 = SPECPDL_INDEX ();
3334 NULL, NULL, RES_TYPE_NUMBER); 3340 record_unwind_protect (unwind_create_frame_1,
3341 inhibit_window_configuration_change_hook);
3342 inhibit_window_configuration_change_hook = Qt;
3343
3344 x_default_parameter (f, parms, Qmenu_bar_lines,
3345 NILP (Vmenu_bar_mode)
3346 ? make_number (0) : make_number (1),
3347 NULL, NULL, RES_TYPE_NUMBER);
3348 x_default_parameter (f, parms, Qtool_bar_lines,
3349 NILP (Vtool_bar_mode)
3350 ? make_number (0) : make_number (1),
3351 NULL, NULL, RES_TYPE_NUMBER);
3352
3353 unbind_to (count2, Qnil);
3354 }
3335 3355
3336 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, 3356 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
3337 "bufferPredicate", "BufferPredicate", 3357 "bufferPredicate", "BufferPredicate",
diff --git a/src/xselect.c b/src/xselect.c
index f7b65809443..290f4d7eb4d 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1981,7 +1981,9 @@ VALUE is typically a string, or a cons of two markers, but may be
1981anything that the functions on `selection-converter-alist' know about. 1981anything that the functions on `selection-converter-alist' know about.
1982 1982
1983FRAME should be a frame that should own the selection. If omitted or 1983FRAME should be a frame that should own the selection. If omitted or
1984nil, it defaults to the selected frame. */) 1984nil, it defaults to the selected frame.
1985
1986On Nextstep, FRAME is unused. */)
1985 (Lisp_Object selection, Lisp_Object value, Lisp_Object frame) 1987 (Lisp_Object selection, Lisp_Object value, Lisp_Object frame)
1986{ 1988{
1987 if (NILP (frame)) frame = selected_frame; 1989 if (NILP (frame)) frame = selected_frame;
@@ -2002,15 +2004,18 @@ nil, it defaults to the selected frame. */)
2002DEFUN ("x-get-selection-internal", Fx_get_selection_internal, 2004DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
2003 Sx_get_selection_internal, 2, 4, 0, 2005 Sx_get_selection_internal, 2, 4, 0,
2004 doc: /* Return text selected from some X window. 2006 doc: /* Return text selected from some X window.
2005SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 2007SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
2006\(Those are literal upper-case symbol names, since that's what X expects.) 2008\(Those are literal upper-case symbol names, since that's what X expects.)
2007TYPE is the type of data desired, typically `STRING'. 2009TARGET-TYPE is the type of data desired, typically `STRING'.
2008TIME_STAMP is the time to use in the XConvertSelection call for foreign 2010
2011TIME-STAMP is the time to use in the XConvertSelection call for foreign
2009selections. If omitted, defaults to the time for the last event. 2012selections. If omitted, defaults to the time for the last event.
2010 2013
2011TERMINAL should be a terminal object or a frame specifying the X 2014TERMINAL should be a terminal object or a frame specifying the X
2012server to query. If omitted or nil, that stands for the selected 2015server to query. If omitted or nil, that stands for the selected
2013frame's display, or the first available X display. */) 2016frame's display, or the first available X display.
2017
2018On Nextstep, TIME-STAMP and TERMINAL are unused. */)
2014 (Lisp_Object selection_symbol, Lisp_Object target_type, 2019 (Lisp_Object selection_symbol, Lisp_Object target_type,
2015 Lisp_Object time_stamp, Lisp_Object terminal) 2020 Lisp_Object time_stamp, Lisp_Object terminal)
2016{ 2021{
@@ -2051,9 +2056,15 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
2051 doc: /* If we own the selection SELECTION, disown it. 2056 doc: /* If we own the selection SELECTION, disown it.
2052Disowning it means there is no such selection. 2057Disowning it means there is no such selection.
2053 2058
2059Sets the last-change time for the selection to TIME-OBJECT (by default
2060the time of the last event).
2061
2054TERMINAL should be a terminal object or a frame specifying the X 2062TERMINAL should be a terminal object or a frame specifying the X
2055server to query. If omitted or nil, that stands for the selected 2063server to query. If omitted or nil, that stands for the selected
2056frame's display, or the first available X display. */) 2064frame's display, or the first available X display.
2065
2066On Nextstep, the TIME-OBJECT and TERMINAL arguments are unused.
2067On MS-DOS, all this does is return non-nil if we own the selection. */)
2057 (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) 2068 (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal)
2058{ 2069{
2059 Time timestamp; 2070 Time timestamp;
@@ -2109,7 +2120,9 @@ and t is the same as `SECONDARY'.
2109 2120
2110TERMINAL should be a terminal object or a frame specifying the X 2121TERMINAL should be a terminal object or a frame specifying the X
2111server to query. If omitted or nil, that stands for the selected 2122server to query. If omitted or nil, that stands for the selected
2112frame's display, or the first available X display. */) 2123frame's display, or the first available X display.
2124
2125On Nextstep, TERMINAL is unused. */)
2113 (Lisp_Object selection, Lisp_Object terminal) 2126 (Lisp_Object selection, Lisp_Object terminal)
2114{ 2127{
2115 struct frame *f = frame_for_x_selection (terminal); 2128 struct frame *f = frame_for_x_selection (terminal);
@@ -2128,13 +2141,15 @@ DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
2128 0, 2, 0, 2141 0, 2, 0,
2129 doc: /* Whether there is an owner for the given X selection. 2142 doc: /* Whether there is an owner for the given X selection.
2130SELECTION should be the name of the selection in question, typically 2143SELECTION should be the name of the selection in question, typically
2131one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects 2144one of the symbols `PRIMARY', `SECONDARY', `CLIPBOARD', or
2132these literal upper-case names.) The symbol nil is the same as 2145`CLIPBOARD_MANAGER' (X expects these literal upper-case names.) The
2133`PRIMARY', and t is the same as `SECONDARY'. 2146symbol nil is the same as `PRIMARY', and t is the same as `SECONDARY'.
2134 2147
2135TERMINAL should be a terminal object or a frame specifying the X 2148TERMINAL should be a terminal object or a frame specifying the X
2136server to query. If omitted or nil, that stands for the selected 2149server to query. If omitted or nil, that stands for the selected
2137frame's display, or the first available X display. */) 2150frame's display, or the first available X display.
2151
2152On Nextstep, TERMINAL is unused. */)
2138 (Lisp_Object selection, Lisp_Object terminal) 2153 (Lisp_Object selection, Lisp_Object terminal)
2139{ 2154{
2140 Window owner; 2155 Window owner;
@@ -2257,8 +2272,14 @@ x_clipboard_manager_save_all (void)
2257 2272
2258 local_frame = XCAR (XCDR (XCDR (XCDR (local_selection)))); 2273 local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
2259 if (FRAME_LIVE_P (XFRAME (local_frame))) 2274 if (FRAME_LIVE_P (XFRAME (local_frame)))
2260 internal_condition_case_1 (x_clipboard_manager_save, local_frame, 2275 {
2261 Qt, x_clipboard_manager_error_2); 2276 Lisp_Object args[1];
2277 args[0] = build_string ("Saving clipboard to X clipboard manager...");
2278 Fmessage (1, args);
2279
2280 internal_condition_case_1 (x_clipboard_manager_save, local_frame,
2281 Qt, x_clipboard_manager_error_2);
2282 }
2262 } 2283 }
2263} 2284}
2264 2285
diff --git a/src/xterm.c b/src/xterm.c
index 6b19533e97c..88cd0bf4091 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2292,7 +2292,8 @@ x_draw_image_foreground (struct glyph_string *s)
2292static void 2292static void
2293x_draw_image_relief (struct glyph_string *s) 2293x_draw_image_relief (struct glyph_string *s)
2294{ 2294{
2295 int x0, y0, x1, y1, thick, raised_p, extra; 2295 int x0, y0, x1, y1, thick, raised_p;
2296 int extra_x, extra_y;
2296 XRectangle r; 2297 XRectangle r;
2297 int x = s->x; 2298 int x = s->x;
2298 int y = s->ybase - image_ascent (s->img, s->face, &s->slice); 2299 int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
@@ -2323,13 +2324,24 @@ x_draw_image_relief (struct glyph_string *s)
2323 raised_p = s->img->relief > 0; 2324 raised_p = s->img->relief > 0;
2324 } 2325 }
2325 2326
2326 extra = s->face->id == TOOL_BAR_FACE_ID 2327 extra_x = extra_y = 0;
2327 ? XINT (Vtool_bar_button_margin) : 0; 2328 if (s->face->id == TOOL_BAR_FACE_ID)
2329 {
2330 if (CONSP (Vtool_bar_button_margin)
2331 && INTEGERP (XCAR (Vtool_bar_button_margin))
2332 && INTEGERP (XCDR (Vtool_bar_button_margin)))
2333 {
2334 extra_x = XINT (XCAR (Vtool_bar_button_margin));
2335 extra_y = XINT (XCDR (Vtool_bar_button_margin));
2336 }
2337 else if (INTEGERP (Vtool_bar_button_margin))
2338 extra_x = extra_y = XINT (Vtool_bar_button_margin);
2339 }
2328 2340
2329 x0 = x - thick - extra; 2341 x0 = x - thick - extra_x;
2330 y0 = y - thick - extra; 2342 y0 = y - thick - extra_y;
2331 x1 = x + s->slice.width + thick - 1 + extra; 2343 x1 = x + s->slice.width + thick - 1 + extra_x;
2332 y1 = y + s->slice.height + thick - 1 + extra; 2344 y1 = y + s->slice.height + thick - 1 + extra_y;
2333 2345
2334 x_setup_relief_colors (s); 2346 x_setup_relief_colors (s);
2335 get_glyph_string_clip_rect (s, &r); 2347 get_glyph_string_clip_rect (s, &r);