changeset 85145:0833864bd9a1

(frame-inherited-parameters): New var. (make-frame): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 10 Oct 2007 20:18:45 +0000
parents 7cbf2833ffb8
children c37307b0bf01
files etc/NEWS lisp/ChangeLog lisp/frame.el
diffstat 3 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Wed Oct 10 20:02:07 2007 +0000
+++ b/etc/NEWS	Wed Oct 10 20:18:45 2007 +0000
@@ -262,6 +262,8 @@
 
 * Lisp Changes in Emacs 23.1
 
+** `frame-inherited-parameters' lets new frames inherit parameters from
+the selected frame.
 ** New keymap `input-decode-map' overrides like key-translation-map, but
 applies before function-key-map.  Also it is terminal-local contrary to
 key-translation-map.  Terminal-specific key-sequences are generally added to
--- a/lisp/ChangeLog	Wed Oct 10 20:02:07 2007 +0000
+++ b/lisp/ChangeLog	Wed Oct 10 20:18:45 2007 +0000
@@ -1,5 +1,8 @@
 2007-10-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* frame.el (frame-inherited-parameters): New var.
+	(make-frame): Use it.
+
 	* font-lock.el (lisp-font-lock-keywords-2): Remove let-environment.
 
 	* env.el (let-environment): Remove.  Unused.
--- a/lisp/frame.el	Wed Oct 10 20:02:07 2007 +0000
+++ b/lisp/frame.el	Wed Oct 10 20:18:45 2007 +0000
@@ -673,6 +673,10 @@
 ;; Alias, kept temporarily.
 (define-obsolete-function-alias 'new-frame 'make-frame "22.1")
 
+(defvar frame-inherited-parameters '(environment client)
+  ;; FIXME: Shouldn't we add `font' here as well?
+  "Parameters `make-frame' copies from the `selected-frame' to the new frame.")
+
 (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.
@@ -723,15 +727,11 @@
     (run-hooks 'before-make-frame-hook)
     (setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist)))))
     (normal-erase-is-backspace-setup-frame frame)
-    ;; Inherit the 'environment and 'client parameters.
-    (let ((env (frame-parameter oldframe 'environment))
-	  (client (frame-parameter oldframe 'client)))
-      (if (not (framep env))
-	  (setq env oldframe))
-      (if (and env (not (assq 'environment parameters)))
-	  (set-frame-parameter frame 'environment env))
-      (if (and client (not (assq 'client parameters)))
-	  (set-frame-parameter frame 'client client)))
+    ;; Inherit the original frame's parameters.
+    (dolist (param frame-inherited-parameters)
+      (unless (assq param parameters)   ;Overridden by explicit parameters.
+        (let ((val (frame-parameter oldframe param)))
+          (when val (set-frame-parameter frame param val)))))
     (run-hook-with-args 'after-make-frame-functions frame)
     frame))