aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2007-10-10 20:18:45 +0000
committerStefan Monnier <[email protected]>2007-10-10 20:18:45 +0000
commitab6198b2a36679b3418b547289b950567bd7d097 (patch)
tree09dc204f33892c22ba466d5d3b26f88e15d2aad3
parent01ff458e81a80e037caa33ebdc4330d6923b43f3 (diff)
(frame-inherited-parameters): New var.
(make-frame): Use it.
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/frame.el18
3 files changed, 14 insertions, 9 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 0a1c5263d9..74ed0d9ab9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -262,6 +262,8 @@ supported on other platforms, but not on Windows due to using the winsock
* 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
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0cf312e387..11c8b15107 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2007-10-10 Stefan Monnier <[email protected]>
+ * 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.
diff --git a/lisp/frame.el b/lisp/frame.el
index d968880426..656a462e7c 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -673,6 +673,10 @@ The functions are run with one arg, the newly created frame.")
;; 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 @@ setup is for focus to follow the pointer."
(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))