changeset 96774:3760da9fe15e

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1339
author Miles Bader <miles@gnu.org>
date Thu, 17 Jul 2008 23:18:58 +0000
parents 8b4d07d37cc5 (current diff) 0436fdfe2a5f (diff)
children cb62bfe8f09c
files src/ChangeLog src/Makefile.in src/gtkutil.c src/lisp.h src/macfns.c src/macterm.c src/macterm.h src/mactoolbox.c src/process.c src/s/darwin.h
diffstat 10 files changed, 103 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/ChangeLog	Thu Jul 17 23:18:58 2008 +0000
@@ -1,3 +1,33 @@
+2008-07-17  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* gtkutil.c: Include <config.h> instead of "config.h".
+
+	* lisp.h (Foverlay_buffer): Add EXFUN.
+
+	* process.c (create_process) [!WINDOWSNT && FD_CLOEXEC]: Wait for
+	child process to complete child_setup.  Undo 2005-09-21 change.
+
+	* s/darwin.h: Mention setsid after vfork.
+
+2008-07-17  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* Makefile.in (frame.o, keyboard.o, xdisp.o, xfaces.o):
+	Depend on macgui.h.
+
+	* macfns.c (Fx_server_version): Don't use gestaltSystemVersionMajor,
+	gestaltSystemVersionMinor, or gestaltSystemVersionBugFix.
+
+	* macterm.c (keycode_to_xkeysym_table): Add entries for f17, f18,
+	and f19.
+	[MAC_OSX] (fn_keycode_to_keycode_table): Likewise.
+
+	* macterm.h (gestaltSystemVersionMajor, gestaltSystemVersionMinor)
+	(gestaltSystemVersionBugFix) [MAC_OS_X_VERSION_MAX_ALLOWED < 1040]:
+	Remove enumerators.
+
+	* mactoolbox.c [USE_MAC_TSM] (mac_handle_text_input_event):
+	Check if FACE_FROM_ID returns NULL.
+
 2008-07-17  David Robinow  <drobinow@gmail.com>  (tiny change)
 
         * w32inevt.c (change_frame_size): Remove extern declaration.
--- a/src/Makefile.in	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/Makefile.in	Thu Jul 17 23:18:58 2008 +0000
@@ -1103,8 +1103,9 @@
    epaths.h $(config_h)
 filemode.o: filemode.c  $(config_h)
 frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
-   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h \
-   msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
+   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
+   msdos.h dosfns.h dispextern.h w32term.h macterm.h macgui.h termchar.h    \
+   $(config_h)
 fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
 font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
    font.h $(config_h)
@@ -1122,8 +1123,8 @@
    dispextern.h atimer.h systime.h region-cache.h $(config_h)
 keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
    commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
-   systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
-   atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h nsterm.h \
+   systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h atimer.h     \
+   xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h macgui.h nsterm.h \
    $(config_h)
 keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
    atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \
@@ -1190,16 +1191,16 @@
 window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
    disptab.h keyboard.h dispextern.h msdos.h composite.h \
    keymap.h blockinput.h atimer.h systime.h $(INTERVAL_SRC) \
-   xterm.h w32term.h macterm.h nsterm.h $(config_h)
+   xterm.h w32term.h macterm.h macgui.h nsterm.h $(config_h)
 xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
    coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h     \
    charset.h $(config_h) keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h    \
-   w32term.h macterm.h nsterm.h msdos.h composite.h fontset.h blockinput.h \
-   atimer.h systime.h keymap.h font.h
+   w32term.h macterm.h macgui.h nsterm.h msdos.h composite.h fontset.h	      \
+   blockinput.h atimer.h systime.h keymap.h font.h
 xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h	\
    window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h	\
-   systime.h keyboard.h fontset.h w32term.h macterm.h nsterm.h $(INTERVAL_SRC) \
-   termchar.h termhooks.h font.h $(config_h)
+   systime.h keyboard.h fontset.h w32term.h macterm.h macgui.h nsterm.h	\
+   $(INTERVAL_SRC) termchar.h termhooks.h font.h $(config_h)
 xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
    $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
    character.h charset.h coding.h gtkutil.h $(config_h) termhooks.h \
--- a/src/gtkutil.c	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/gtkutil.c	Thu Jul 17 23:18:58 2008 +0000
@@ -17,7 +17,7 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+#include <config.h>
 
 #ifdef USE_GTK
 #include <string.h>
--- a/src/lisp.h	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/lisp.h	Thu Jul 17 23:18:58 2008 +0000
@@ -2850,6 +2850,7 @@
 EXFUN (Fset_buffer_multibyte, 1);
 EXFUN (Foverlay_start, 1);
 EXFUN (Foverlay_end, 1);
+EXFUN (Foverlay_buffer, 1);
 extern void adjust_overlays_for_insert P_ ((EMACS_INT, EMACS_INT));
 extern void adjust_overlays_for_delete P_ ((EMACS_INT, EMACS_INT));
 extern void fix_start_end_in_overlays P_ ((int, int));
--- a/src/macfns.c	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/macfns.c	Thu Jul 17 23:18:58 2008 +0000
@@ -2936,11 +2936,11 @@
     {
       if (response >= 0x00001040)
 	{
-	  err = Gestalt (gestaltSystemVersionMajor, &major);
+	  err = Gestalt ('sys1', &major);
 	  if (err == noErr)
-	    err = Gestalt (gestaltSystemVersionMinor, &minor);
+	    err = Gestalt ('sys2', &minor);
 	  if (err == noErr)
-	    err = Gestalt (gestaltSystemVersionBugFix, &bugfix);
+	    err = Gestalt ('sys3', &bugfix);
 	}
       else
 	{
--- a/src/macterm.c	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/macterm.c	Thu Jul 17 23:18:58 2008 +0000
@@ -9789,12 +9789,12 @@
   /*0x38*/ 0, 0, 0, 0,
   /*0x3C*/ 0, 0, 0, 0,
 
-  /*0x40*/ 0, 0xae /*kp-decimal*/, 0, 0xaa /*kp-multiply*/,
+  /*0x40*/ 0xce /*f17*/, 0xae /*kp-decimal*/, 0, 0xaa /*kp-multiply*/,
   /*0x44*/ 0, 0xab /*kp-add*/, 0, 0x0b /*clear*/,
   /*0x48*/ 0, 0, 0, 0xaf /*kp-divide*/,
-  /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp-subtract*/, 0,
-
-  /*0x50*/ 0, 0xbd /*kp-equal*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
+  /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp-subtract*/, 0xcf /*f18*/,
+
+  /*0x50*/ 0xd0 /*f19*/, 0xbd /*kp-equal*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
   /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
   /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
   /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
@@ -9826,12 +9826,12 @@
   /*0x38*/ 0, 0, 0, 0,
   /*0x3C*/ 0, 0, 0, 0,
 
-  /*0x40*/ 0, 0x2f /*kp-decimal -> '.'*/, 0, 0x23 /*kp-multiply -> 'p'*/,
+  /*0x40*/ 0x40 /*f17 = f17*/, 0x2f /*kp-decimal -> '.'*/, 0, 0x23 /*kp-multiply -> 'p'*/,
   /*0x44*/ 0, 0x2c /*kp-add -> '/'*/, 0, 0x16 /*clear -> '6'*/,
   /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/,
-  /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-subtract -> ';'*/, 0,
-
-  /*0x50*/ 0, 0x1b /*kp-equal -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
+  /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-subtract -> ';'*/, 0x4f /*f18 = f18*/,
+
+  /*0x50*/ 0x50 /*f19 = f19*/, 0x1b /*kp-equal -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
   /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/,
   /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
   /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
--- a/src/macterm.h	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/macterm.h	Thu Jul 17 23:18:58 2008 +0000
@@ -575,6 +575,10 @@
 };
 #endif
 
+#if 0
+/* We can't determine the availability of these enumerators by
+   MAC_OS_X_VERSION_MAX_ALLOWED, because they are defined in
+   MacOSX10.3.9.sdk for Mac OS X 10.4, but not in Mac OS X 10.3.  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
 /* Gestalt selectors */
 enum {
@@ -583,6 +587,7 @@
   gestaltSystemVersionBugFix	= 'sys3'
 };
 #endif
+#endif
 
 #ifdef MAC_OSX
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1020
--- a/src/mactoolbox.c	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/mactoolbox.c	Thu Jul 17 23:18:58 2008 +0000
@@ -573,7 +573,7 @@
 	    int hpos, vpos, x, y;
 	    struct glyph_row *row;
 	    struct glyph *glyph;
-	    XFontStruct *font;
+	    struct face *face;
 
 	    f = mac_focus_frame (&one_mac_display_info);
 	    w = XWINDOW (f->selected_window);
@@ -598,9 +598,10 @@
 		   + row->visible_height
 		   + f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f));
 
-	    font = FACE_FROM_ID (f, glyph->face_id)->font;
-	    if (font)
+	    face = FACE_FROM_ID (f, glyph->face_id);
+	    if (face && face->font)
 	      {
+		XFontStruct *font = face->font;
 		Fixed point_size = Long2Fix (font->mac_fontsize);
 		short height = row->visible_height;
 		short ascent = row->ascent;
--- a/src/process.c	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/process.c	Thu Jul 17 23:18:58 2008 +0000
@@ -1851,6 +1851,9 @@
   int inchannel, outchannel;
   pid_t pid;
   int sv[2];
+#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
+  int wait_child_setup[2];
+#endif
 #ifdef POSIX_SIGNALS
   sigset_t procmask;
   sigset_t blocked;
@@ -1924,6 +1927,25 @@
       forkin = sv[0];
     }
 
+#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
+    {
+      int tem;
+
+      tem = pipe (wait_child_setup);
+      if (tem < 0)
+	report_file_error ("Creating pipe", Qnil);
+      tem = fcntl (wait_child_setup[1], F_GETFD, 0);
+      if (tem >= 0)
+	tem = fcntl (wait_child_setup[1], F_SETFD, tem | FD_CLOEXEC);
+      if (tem < 0)
+	{
+	  emacs_close (wait_child_setup[0]);
+	  emacs_close (wait_child_setup[1]);
+	  report_file_error ("Setting file descriptor flags", Qnil);
+	}
+    }
+#endif
+
 #if 0
   /* Replaced by close_process_descs */
   set_exclusive_use (inchannel);
@@ -2158,6 +2180,9 @@
 	pid = child_setup (xforkin, xforkout, xforkout,
 			   new_argv, 1, current_dir);
 #else  /* not WINDOWSNT */
+#ifdef FD_CLOEXEC
+	emacs_close (wait_child_setup[0]);
+#endif
 	child_setup (xforkin, xforkout, xforkout,
 		     new_argv, 1, current_dir);
 #endif /* not WINDOWSNT */
@@ -2211,6 +2236,20 @@
       else
 #endif
 	XPROCESS (process)->tty_name = Qnil;
+
+#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
+      /* Wait for child_setup to complete in case that vfork is
+	 actually defined as fork.  The descriptor wait_child_setup[1]
+	 of a pipe is closed at the child side either by close-on-exec
+	 on successful execvp or the _exit call in child_setup.  */
+      {
+	char dummy;
+
+	emacs_close (wait_child_setup[1]);
+	emacs_read (wait_child_setup[0], &dummy, 1);
+	emacs_close (wait_child_setup[0]);
+      }
+#endif
     }
 
   /* Restore the signal state whether vfork succeeded or not.
@@ -4666,15 +4705,6 @@
 #endif
 
 	  Atemp = input_wait_mask;
-#if 0
-          /* On Mac OS X 10.0, the SELECT system call always says input is
-             present (for reading) at stdin, even when none is.  This
-             causes the call to SELECT below to return 1 and
-             status_notify not to be called.  As a result output of
-             subprocesses are incorrectly discarded.
-	  */
-          FD_CLR (0, &Atemp);
-#endif
 	  IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
 
 	  EMACS_SET_SECS_USECS (timeout, 0, 0);
--- a/src/s/darwin.h	Thu Jul 17 21:51:46 2008 +0000
+++ b/src/s/darwin.h	Thu Jul 17 23:18:58 2008 +0000
@@ -268,7 +268,8 @@
 
 /* The following solves the problem that Emacs hangs when evaluating
    (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
-   does not exist.  */
+   does not exist.  Also, setsid is not allowed in the vfork child's
+   context as of Darwin 9/Mac OS X 10.5.  */
 #undef HAVE_WORKING_VFORK
 #define vfork fork