]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix ediff problems. (Reported by Dan Nicolaescu.)
authorKaroly Lorentey <lorentey@elte.hu>
Sun, 12 Mar 2006 04:12:31 +0000 (04:12 +0000)
committerKaroly Lorentey <lorentey@elte.hu>
Sun, 12 Mar 2006 04:12:31 +0000 (04:12 +0000)
* lisp/subr.el (with-selected-frame): Make sure the current buffer is
  restored as well.

* src/xfns.c (Fx_create_frame): Use `store_frame_param' to set
  `window-system' frame parameter, and make sure it overrides any
  user-supplied setting.

* src/xfns.c (x_icon): Disable redundant call to
  `x_wm_set_window_state'. (Also applied in CVS.)

* lisp/faces.el (x-create-frame-with-faces): Don't make frame visible
  until we are done setting up all its parameters.

* lisp/ediff-wind.el (ediff-setup-windows-automatic): New function.
  (ediff-window-setup-function): Use it as default.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-528

lisp/ediff-wind.el
lisp/faces.el
lisp/subr.el
src/xfns.c

index 28369f9f6bde36710f3dc2459ff59bd19151767c..5e9381f5dab6821f1130dd6fa001485659a134cd 100644 (file)
   :group 'frames)
 
 
-(defcustom ediff-window-setup-function (if (ediff-window-display-p)
-                                       'ediff-setup-windows-multiframe
-                                     'ediff-setup-windows-plain)
+(defcustom ediff-window-setup-function 'ediff-setup-windows-automatic)
   "*Function called to set up windows.
-Ediff provides a choice of two functions: `ediff-setup-windows-plain', for
-doing everything in one frame, and `ediff-setup-windows-multiframe',
-which sets the control panel in a separate frame.  Also, if the latter
-function detects that one of the buffers A/B is seen in some other frame,
-it will try to keep that buffer in that frame.
+Ediff provides a choice of three functions: `ediff-setup-windows-plain', for
+doing everything in one frame, `ediff-setup-windows-multiframe', which sets
+the control panel in a separate frame, and
+`ediff-setup-windows-automatic' (the default), which chooses an appropriate
+behaviour based on the current window system.  If the multiframe function
+detects that one of the buffers A/B is seen in some other frame, it will try
+to keep that buffer in that frame.
 
 If you don't like the two functions provided---write your own one.
 The basic guidelines:
@@ -94,7 +94,8 @@ The basic guidelines:
        Buffer C may not be used in jobs that compare only two buffers.
 If you plan to do something fancy, take a close look at how the two
 provided functions are written."
-  :type '(choice (const :tag "Multi Frame" ediff-setup-windows-multiframe)
+  :type '(choice (const :tag "Automatic" ediff-setup-windows-automatic)
+                (const :tag "Multi Frame" ediff-setup-windows-multiframe)
                 (const :tag "Single Frame" ediff-setup-windows-plain)
                 (function :tag "Other function"))
   :group 'ediff-window)
@@ -333,6 +334,12 @@ into icons, regardless of the window manager."
        buffer-A buffer-B buffer-C control-buffer))
   (run-hooks 'ediff-after-setup-windows-hook))
 
+;; Set up windows using the correct method based on the current window system.
+(defun ediff-setup-windows-automatic (buffer-A buffer-B buffer-C control-buffer)
+  (if (ediff-window-display-p)
+      (ediff-setup-windows-multiframe buffer-A buffer-B buffer-C control-buffer)
+    (ediff-setup-windows-plain buffer-A buffer-B buffer-C control-buffer)))
+
 ;; Just set up 3 windows.
 ;; Usually used without windowing systems
 ;; With windowing, we want to use dedicated frames.
index ee11868b549bd8e9ff82e6491827843fc65e097e..b1906faee8779fc197f09b2e9c52de9a78188319 100644 (file)
@@ -1734,14 +1734,14 @@ Value is the new frame created."
          (x-handle-reverse-video frame parameters)
          (frame-set-background-mode frame)
          (face-set-after-frame-default frame)
-         (if (or (null frame-list) (null visibility-spec))
-             (make-frame-visible frame)
-           (modify-frame-parameters frame (list visibility-spec)))
          ;; Arrange for the kill and yank functions to set and check the clipboard.
          (modify-frame-parameters
           frame '((interprogram-cut-function . x-select-text)))
          (modify-frame-parameters
           frame '((interprogram-paste-function . x-cut-buffer-or-selection-value)))
+         (if (or (null frame-list) (null visibility-spec))
+             (make-frame-visible frame)
+           (modify-frame-parameters frame (list visibility-spec)))
          (setq success t))
       (unless success
        (delete-frame frame)))
index ef49c9b1c9aefe15150100e893a0f7bc081b8809..6c473e5a686ebc49a705a0056683043e84ae05cd 100644 (file)
@@ -2130,12 +2130,17 @@ See also `with-temp-buffer'."
 The value returned is the value of the last form in BODY.
 See also `with-temp-buffer'."
   (declare (indent 1) (debug t))
-  `(let ((save-selected-frame (selected-frame)))
-     (unwind-protect
-        (progn (select-frame ,frame)
-               ,@body)
-       (if (frame-live-p save-selected-frame)
-          (select-frame save-selected-frame)))))
+  (let ((old-frame (make-symbol "old-frame"))
+       (old-buffer (make-symbol "old-buffer")))
+    `(let ((,old-frame (selected-frame))
+          (,old-buffer (current-buffer)))
+       (unwind-protect
+          (progn (select-frame ,frame)
+                 ,@body)
+        (if (frame-live-p ,old-frame)
+            (select-frame ,old-frame))
+        (if (buffer-live-p ,old-buffer)
+            (set-buffer ,old-buffer))))))
 
 (defmacro with-temp-file (file &rest body)
   "Create a new buffer, evaluate BODY there, and write the buffer to FILE.
index 3616b4a710007af65f08a3cb7c25f4e16d55ce4b..d3067e00fe8ca9f365dc3c7c54d325518ca03839 100644 (file)
@@ -2830,12 +2830,15 @@ x_icon (f, parms)
   if (! EQ (icon_x, Qunbound))
     x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
 
+#if 0 /* x_get_arg removes the visibility parameter as a side effect,
+         but x_create_frame still needs it.  */
   /* Start up iconic or window? */
   x_wm_set_window_state
     (f, (EQ (x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL),
             Qicon)
         ? IconicState
         : NormalState));
+#endif
 
   x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name)
                                     ? f->icon_name
@@ -3169,8 +3172,6 @@ This function is an internal primitive--use `make-frame' instead.  */)
       specbind (Qx_resource_name, name);
     }
 
-  Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil));
-
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
   {
@@ -3410,6 +3411,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
     if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
       f->param_alist = Fcons (XCAR (tem), f->param_alist);
 
+  store_frame_param (f, Qwindow_system, Qx);
+
   UNGCPRO;
 
   /* Make sure windows on this frame appear in calls to next-window