Bläddra i källkod

Don't use make-frame-on-display for Aquamacs setups, apparently it
breaks. I've taken the opportunity to re-factor the code for frame
creation a little.

Based on suggestion by Robert Goldman.

Alex Bennee 14 år sedan
förälder
incheckning
fd22433e0b
1 ändrade filer med 23 tillägg och 15 borttagningar
  1. 23 15
      edit-server.el

+ 23 - 15
edit-server.el

@@ -290,6 +290,27 @@ If `edit-server-verbose' is non-nil, then STRING is also echoed to the message l
         (setq edit-server-received 0)
         (setq edit-server-phase 'wait)))))
 
+(defun edit-server-create-frame(buffer)
+  "Create a frame for the edit server"
+  (if edit-server-new-frame
+      (let* ((property-alist
+	     `((name . ,edit-server-new-frame-title)
+	       (width . ,edit-server-new-frame-width)
+	       (height . ,edit-server-new-frame-height)
+	       (minibuffer . ,edit-server-new-frame-minibuffer)
+	       (menu-bar-lines . ,edit-server-new-frame-menu-bar)))
+	; Aquamacs gets confused by make-frame-on-display
+	     (new-frame
+	      (if (featurep 'aquamacs)
+		  (make-frame property-alist)
+		(make-frame-on-display (getenv "DISPLAY")
+				       property-alist))))
+	(if (not edit-server-new-frame-mode-line)
+            (setq mode-line-format nil))
+	(raise-frame new-frame)
+	new-frame)
+    (pop-to-buffer buffer)))
+
 (defun edit-server-create-edit-buffer(proc)
   "Create an edit buffer, place content in it and save the network
   process for the final call back"
@@ -303,21 +324,8 @@ If `edit-server-verbose' is non-nil, then STRING is also echoed to the message l
       (add-hook 'kill-buffer-hook 'edit-server-abort* nil t)
       (buffer-enable-undo)
       (set (make-local-variable 'edit-server-proc) proc)
-      (set (make-local-variable 'edit-server-frame) 
-           (if edit-server-new-frame
-               (make-frame-on-display (getenv "DISPLAY")
-                 `((name . ,edit-server-new-frame-title)
-                   (width . ,edit-server-new-frame-width)
-                   (height . ,edit-server-new-frame-height)
-                   (minibuffer . ,edit-server-new-frame-minibuffer)
-                   (menu-bar-lines . ,edit-server-new-frame-menu-bar)))
-             nil))
-      (if edit-server-new-frame
-        (progn
-          (if (not edit-server-new-frame-mode-line)
-            (setq mode-line-format nil))
-          (raise-frame edit-server-frame))
-        (pop-to-buffer buffer)))))
+      (set (make-local-variable 'edit-server-frame)
+	   (edit-server-create-frame buffer)))))
 
 (defun edit-server-send-response (proc &optional body close)
   "Send an HTTP 200 OK response back to process PROC.