changeset 109348:52a665d72788

merge trunk
author Kenichi Handa <handa@etlken>
date Thu, 01 Jul 2010 15:26:36 +0900
parents bcae1f83a33e (current diff) 4de0b34e2c2e (diff)
children c82f3023b7f2
files
diffstat 10 files changed, 132 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jun 30 15:55:41 2010 +0900
+++ b/lisp/ChangeLog	Thu Jul 01 15:26:36 2010 +0900
@@ -1,3 +1,29 @@
+2010-07-01  Chong Yidong  <cyd@stupidchicken.com>
+
+	* ruler-mode.el (ruler--save-header-line-format): Fix typos.
+
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.el (make-frame): Add default-frame-alist to the PARAMETERS
+	argument passed to frame-creation-function (Bug#5378).
+
+	* faces.el (x-handle-named-frame-geometry)
+	(x-handle-reverse-video, x-create-frame-with-faces)
+	(face-set-after-frame-default, tty-create-frame-with-faces): Don't
+	separately consult default-frame-alist.  It is now passed as the
+	PARAMETER argument.
+
+2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* startup.el (command-line): Don't call tool-bar-setup in a
+	tty-only build.
+
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* ruler-mode.el (ruler--save-header-line-format): New fun.
+	(ruler-mode): Use it as a setter function, so as not to overwrite
+	ruler-mode-header-line-format-old if Ruler mode is on (Bug#5370).
+
 2010-06-29  Chong Yidong  <cyd@stupidchicken.com>
 
 	* vc/vc.el (vc-deduce-backend): New fun.  Handle diff buffers.
@@ -967,7 +993,7 @@
 	(rcirc-user-name-history): Add variable.
 
 2010-05-25  Ryan Yeske  <rcyeske@gmail.com>
-	    Jonathan Rockway  <jon@jrock.us>
+            Jonathan Rockway  <jon@jrock.us>
 
 	* net/rcirc.el (rcirc-server-alist): Add :pass.
 	(rcirc): When prompting for connection parameters, also prompt for
--- a/lisp/faces.el	Wed Jun 30 15:55:41 2010 +0900
+++ b/lisp/faces.el	Thu Jul 01 15:26:36 2010 +0900
@@ -1948,8 +1948,7 @@
   "Add geometry parameters for a named frame to parameter list PARAMETERS.
 Value is the new parameter list."
   ;; Note that `x-resource-name' has a global meaning.
-  (let ((x-resource-name (or (cdr (assq 'name parameters))
-			     (cdr (assq 'name default-frame-alist)))))
+  (let ((x-resource-name (cdr (assq 'name parameters))))
     (when x-resource-name
       ;; Before checking X resources, we must have an X connection.
       (or (window-system)
@@ -1960,7 +1959,7 @@
 	(and (setq res-geometry (x-get-resource "geometry" "Geometry"))
 	     (setq parsed (x-parse-geometry res-geometry))
 	     (setq parameters
-		   (append parameters default-frame-alist parsed
+		   (append parameters parsed
 			   ;; If the resource specifies a position,
 			   ;; take note of that.
 			   (if (or (assq 'top parsed) (assq 'left parsed))
@@ -1972,7 +1971,6 @@
   "Handle the reverse-video frame parameter and X resource.
 `x-create-frame' does not handle this one."
   (when (cdr (or (assq 'reverse parameters)
-		 (assq 'reverse default-frame-alist)
 		 (let ((resource (x-get-resource "reverseVideo"
 						 "ReverseVideo")))
 		   (if resource
@@ -1998,13 +1996,10 @@
 (declare-function x-setup-function-keys "term/x-win" (frame))
 
 (defun x-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If PARAMETERS specify a frame name,
-handle X geometry resources for that name.  If either PARAMETERS
-or `default-frame-alist' contains a `reverse' parameter, or
-the X resource ``reverseVideo'' is present, handle that.
-Value is the new frame created."
+  "Create and return a frame with frame parameters PARAMETERS.
+If PARAMETERS specify a frame name, handle X geometry resources
+for that name.  If PARAMETERS includes a `reverse' parameter, or
+the X resource ``reverseVideo'' is present, handle that."
   (setq parameters (x-handle-named-frame-geometry parameters))
   (let* ((params (copy-tree parameters))
 	 (visibility-spec (assq 'visibility parameters))
@@ -2035,7 +2030,7 @@
 Calculate the face definitions using the face specs, custom theme
 settings, X resources, and `face-new-frame-defaults'.
 Finally, apply any relevant face attributes found amongst the
-frame parameters in PARAMETERS and `default-frame-alist'."
+frame parameters in PARAMETERS."
   (dolist (face (nreverse (face-list))) ;Why reverse?  --Stef
     (condition-case ()
 	(progn
@@ -2061,16 +2056,14 @@
   		       (mouse-color mouse :background))))
     (dolist (param face-params)
       (let* ((param-name (nth 0 param))
-  	     (value (cdr (or (assq param-name parameters)
-  			     (assq param-name default-frame-alist)))))
+  	     (value (cdr (assq param-name parameters))))
   	(if value
   	    (set-face-attribute (nth 1 param) frame
 				(nth 2 param) value))))))
 
 (defun tty-handle-reverse-video (frame parameters)
   "Handle the reverse-video frame parameter for terminal frames."
-  (when (cdr (or (assq 'reverse parameters)
-		 (assq 'reverse default-frame-alist)))
+  (when (cdr (assq 'reverse parameters))
     (let* ((params (frame-parameters frame))
 	   (bg (cdr (assq 'foreground-color params)))
 	   (fg (cdr (assq 'background-color params))))
@@ -2086,11 +2079,8 @@
 
 
 (defun tty-create-frame-with-faces (&optional parameters)
-  "Create a frame from optional frame parameters PARAMETERS.
-Parameters not specified by PARAMETERS are taken from
-`default-frame-alist'.  If either PARAMETERS or `default-frame-alist'
-contains a `reverse' parameter, handle that.  Value is the new frame
-created."
+  "Create and return a frame from optional frame parameters PARAMETERS.
+If PARAMETERS contains a `reverse' parameter, handle that."
   (let ((frame (make-terminal-frame parameters))
 	success)
     (unwind-protect
--- a/lisp/frame.el	Wed Jun 30 15:55:41 2010 +0900
+++ b/lisp/frame.el	Thu Jul 01 15:26:36 2010 +0900
@@ -683,15 +683,17 @@
 
 (defun make-frame (&optional parameters)
   "Return a newly created frame displaying the current buffer.
-Optional argument PARAMETERS is an alist of parameters for the new frame.
-Each element of PARAMETERS should have the form (NAME . VALUE), for example:
+Optional argument PARAMETERS is an alist of frame parameters for
+the new frame.  Each element of PARAMETERS should have the
+form (NAME . VALUE), for example:
 
  (name . STRING)	The frame should be named STRING.
 
  (width . NUMBER)	The frame should be NUMBER characters in width.
  (height . NUMBER)	The frame should be NUMBER text lines high.
 
-You cannot specify either `width' or `height', you must use neither or both.
+You cannot specify either `width' or `height', you must specify
+neither or both.
 
  (minibuffer . t)	The frame should have a minibuffer.
  (minibuffer . nil)	The frame should have no minibuffer.
@@ -703,15 +705,17 @@
 
  (terminal . TERMINAL)  The frame should use the terminal object TERMINAL.
 
-Before the frame is created (via `frame-creation-function-alist'), functions on the
-hook `before-make-frame-hook' are run.  After the frame is created, functions
-on `after-make-frame-functions' are run with one arg, the newly created frame.
+In addition, any parameter specified in `default-frame-alist',
+but not present in PARAMETERS, is applied.
 
-This function itself does not make the new frame the selected frame.
-The previously selected frame remains selected.  However, the
-window system may select the new frame for its own reasons, for
-instance if the frame appears under the mouse pointer and your
-setup is for focus to follow the pointer."
+Before creating the frame (via `frame-creation-function-alist'),
+this function runs the hook `before-make-frame-hook'.  After
+creating the frame, it runs the hook `after-make-frame-functions'
+with one arg, the newly created frame.
+
+On graphical displays, this function does not itself make the new
+frame the selected frame.  However, the window system may select
+the new frame according to its own rules."
   (interactive)
   (let* ((w (cond
 	     ((assq 'terminal parameters)
@@ -726,14 +730,21 @@
 	     (t window-system)))
 	 (frame-creation-function (cdr (assq w frame-creation-function-alist)))
 	 (oldframe (selected-frame))
+	 (params parameters)
 	 frame)
     (unless frame-creation-function
       (error "Don't know how to create a frame on window system %s" w))
+    ;; Add parameters from `window-system-default-frame-alist'.
+    (dolist (p (cdr (assq w window-system-default-frame-alist)))
+      (unless (memq (car p) params)
+	(push p params)))
+    ;; Add parameters from `default-frame-alist'.
+    (dolist (p default-frame-alist)
+      (unless (memq (car p) params)
+	(push p params)))
+    ;; Now make the frame.
     (run-hooks 'before-make-frame-hook)
-    (setq frame
-          (funcall frame-creation-function
-                   (append parameters
-                           (cdr (assq w window-system-default-frame-alist)))))
+    (setq frame (funcall frame-creation-function params))
     (normal-erase-is-backspace-setup-frame frame)
     ;; Inherit the original frame's parameters.
     (dolist (param frame-inherited-parameters)
--- a/lisp/ruler-mode.el	Wed Jun 30 15:55:41 2010 +0900
+++ b/lisp/ruler-mode.el	Thu Jul 01 15:26:36 2010 +0900
@@ -550,21 +550,36 @@
 Call `ruler-mode-ruler-function' to compute the ruler value.")
 
 ;;;###autoload
+(defvar ruler-mode nil
+  "Non-nil if Ruler mode is enabled.
+Use the command `ruler-mode' to change this variable.")
+(make-variable-buffer-local 'ruler-mode)
+
+(defun ruler--save-header-line-format ()
+  "Install the header line format for Ruler mode.
+Unless Ruler mode is already enabled, save the old header line
+format first."
+  (when (and (not ruler-mode)
+	     (local-variable-p 'header-line-format)
+	     (not (local-variable-p 'ruler-mode-header-line-format-old)))
+    (set (make-local-variable 'ruler-mode-header-line-format-old)
+	 header-line-format))
+  (setq header-line-format ruler-mode-header-line-format))
+
+;;;###autoload
 (define-minor-mode ruler-mode
-  "Display a ruler in the header line if ARG > 0."
+  "Toggle Ruler mode.
+In Ruler mode, Emacs displays a ruler in the header line."
   nil nil
   ruler-mode-map
   :group 'ruler-mode
+  :variable (ruler-mode
+	     . (lambda (enable)
+		 (when enable
+		   (ruler--save-header-line-format))
+		 (setq ruler-mode enable)))
   (if ruler-mode
-      (progn
-        ;; When `ruler-mode' is on save previous header line format
-        ;; and install the ruler header line format.
-        (when (and (local-variable-p 'header-line-format)
-		   (not (local-variable-p 'ruler-mode-header-line-format-old)))
-          (set (make-local-variable 'ruler-mode-header-line-format-old)
-               header-line-format))
-        (setq header-line-format ruler-mode-header-line-format)
-        (add-hook 'post-command-hook 'force-mode-line-update nil t))
+      (add-hook 'post-command-hook 'force-mode-line-update nil t)
     ;; When `ruler-mode' is off restore previous header line format if
     ;; the current one is the ruler header line format.
     (when (eq header-line-format ruler-mode-header-line-format)
--- a/lisp/startup.el	Wed Jun 30 15:55:41 2010 +0900
+++ b/lisp/startup.el	Thu Jul 01 15:26:36 2010 +0900
@@ -899,10 +899,11 @@
 	    (setq no-blinking-cursor t)))))
     (frame-initialize))
 
-  ;; Set up the tool-bar (even in tty frames, since Emacs might open a
-  ;; graphical frame later).
-  (unless noninteractive
-    (tool-bar-setup))
+  (when (fboundp 'x-create-frame)
+    ;; Set up the tool-bar (even in tty frames, since Emacs might open a
+    ;; graphical frame later).
+    (unless noninteractive
+      (tool-bar-setup)))
 
   ;; Turn off blinking cursor if so specified in X resources.  This is here
   ;; only because all other settings of no-blinking-cursor are here.
--- a/src/ChangeLog	Wed Jun 30 15:55:41 2010 +0900
+++ b/src/ChangeLog	Thu Jul 01 15:26:36 2010 +0900
@@ -1,3 +1,20 @@
+2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
+	check default-frame-alist.
+
+2010-06-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* process.c (create_process): Avoid using invalid file descriptors.
+
+	* callproc.c (child_setup): Avoid closing a file descriptor twice.
+
+2010-06-30  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font):
+	Improve documentation.  Return font regardless of use_system_font.
+	(syms_of_xsettings): Improve documentation for font-use-system-font.
+
 2009-06-17  Naohiro Aota  <naota@elisp.net>  (tiny change)
 
 	* xftfont.c (xftfont_open): Check font width one by one also when
@@ -71,7 +88,7 @@
 	properties instead to get old x and y position.
 	(xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size,
 	gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size,
-        gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment.
+	gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment.
 	(xg_get_tool_bar_widgets): New function.
 	(xg_tool_bar_menu_proxy, xg_show_toolbar_item)
 	(update_frame_tool_bar): Call xg_get_tool_bar_widgets.
@@ -111,7 +128,7 @@
 
 	* xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar.
 
-	* gtkutil.h (xg_show_scroll_bar): : Remove.
+	* gtkutil.h (xg_show_scroll_bar): Remove.
 
 	* gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed
 	if height is less than scroll bar min size.
--- a/src/callproc.c	Wed Jun 30 15:55:41 2010 +0900
+++ b/src/callproc.c	Thu Jul 01 15:26:36 2010 +0900
@@ -1244,8 +1244,10 @@
   dup2 (out, 1);
   dup2 (err, 2);
   emacs_close (in);
-  emacs_close (out);
-  emacs_close (err);
+  if (out != in)
+    emacs_close (out);
+  if (err != in && err != out)
+    emacs_close (err);
 #endif /* not MSDOS */
 #endif /* not WINDOWSNT */
 
--- a/src/frame.c	Wed Jun 30 15:55:41 2010 +0900
+++ b/src/frame.c	Thu Jul 01 15:26:36 2010 +0900
@@ -627,8 +627,7 @@
 
 /* Get a suitable value for frame parameter PARAMETER for a newly
    created frame, based on (1) the user-supplied frame parameter
-   alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
-   fails, (3) Vdefault_frame_alist.  */
+   alist SUPPLIED_PARMS, and (2) CURRENT_VALUE.  */
 
 static Lisp_Object
 get_future_frame_param (Lisp_Object parameter,
@@ -642,8 +641,6 @@
     result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
   if (NILP (result) && current_value != NULL)
     result = build_string (current_value);
-  if (NILP (result))
-    result = Fassq (parameter, Vdefault_frame_alist);
   if (!NILP (result) && !STRINGP (result))
     result = XCDR (result);
   if (NILP (result) || !STRINGP (result))
@@ -748,7 +745,6 @@
   adjust_glyphs (f);
   calculate_costs (f);
   XSETFRAME (frame, f);
-  Fmodify_frame_parameters (frame, Vdefault_frame_alist);
   Fmodify_frame_parameters (frame, parms);
   Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
                                                  build_string (t->display_info.tty->type)),
--- a/src/process.c	Wed Jun 30 15:55:41 2010 +0900
+++ b/src/process.c	Thu Jul 01 15:26:36 2010 +0900
@@ -2038,7 +2038,7 @@
 	   process_set_signal to fail on SGI when using a pipe.  */
 	setsid ();
 	/* Make the pty's terminal the controlling terminal.  */
-	if (pty_flag)
+	if (pty_flag && xforkin >= 0)
 	  {
 #ifdef TIOCSCTTY
 	    /* We ignore the return value
@@ -2081,8 +2081,11 @@
 	    /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
 	       I can't test it since I don't have 4.3.  */
 	    int j = emacs_open ("/dev/tty", O_RDWR, 0);
-	    ioctl (j, TIOCNOTTY, 0);
-	    emacs_close (j);
+	    if (j >= 0)
+	      {
+		ioctl (j, TIOCNOTTY, 0);
+		emacs_close (j);
+	      }
 #ifndef USG
 	    /* In order to get a controlling terminal on some versions
 	       of BSD, it is necessary to put the process in pgrp 0
--- a/src/xsettings.c	Wed Jun 30 15:55:41 2010 +0900
+++ b/src/xsettings.c	Thu Jul 01 15:26:36 2010 +0900
@@ -719,20 +719,20 @@
 DEFUN ("font-get-system-normal-font", Ffont_get_system_normal_font,
        Sfont_get_system_normal_font,
        0, 0, 0,
-       doc: /* Get the system default font. */)
+       doc: /* Get the system default application font. */)
   ()
 {
-  return current_font && use_system_font
+  return current_font
     ? make_string (current_font, strlen (current_font))
     : Qnil;
 }
 
 DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
        0, 0, 0,
-       doc: /* Get the system default monospaced font. */)
+       doc: /* Get the system default fixed width font. */)
   ()
 {
-  return current_mono_font && use_system_font
+  return current_mono_font
     ? make_string (current_mono_font, strlen (current_mono_font))
     : Qnil;
 }
@@ -774,7 +774,10 @@
   defsubr (&Sfont_get_system_normal_font);
 
   DEFVAR_BOOL ("font-use-system-font", &use_system_font,
-    doc: /* *Non-nil means to use the system defined font.  */);
+    doc: /* *Non-nil means to apply the system defined font dynamically.
+When this is non-nil and the system defined fixed width font changes, we
+update frames dynamically.
+If this variable is nil, Emacs ignores system font changes.  */);
   use_system_font = 0;
 
   DEFVAR_LISP ("xft-settings", &Vxft_settings,