emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modify parameters on all frames


From: Ehud Karni
Subject: Re: Modify parameters on all frames
Date: Mon, 7 Apr 2003 23:39:01 +0300

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 06 Apr 2003 19:07:40 -0400, Richard Stallman <address@hidden> wrote:
> 
>     (defun modify-all-frames-parameters (alist)
> 
> This function seems like a good idea, but it is written rather
> inefficiently.  It ought to call modify-frame-parameters just once per
> frame.  Using aput is undesirable since that loads a Lisp file that
> you could easily avoid loading.

OK, how is this one:

(defun modify-all-frames-parameters (alist)
  "modify all current and future frames parameters.
Do this by calling `modify-frame-parameters' on all existing frames
with ALIST, and changing `default-frame-alist' (and, when needed,
also `initial-frame-alist').
See help of `modify-frame-parameters' for more information."
  (let* ((frames (frame-list))          ;; all frames
         (ix (length frames))           ;; list index
         (keys (mapcar 'car alist))     ;; keys to delete
         element)                       ;; temp
    (while (> ix 0)
      (setq ix (1- ix))
      (modify-frame-parameters (nth ix frames) alist))
    (setq ix (length keys))
    (while (> ix 0)
      (setq ix (1- ix))
      ;; initial-frame-alist needs setting only when
      ;; frame-notice-user-settings is true
      (and frame-notice-user-settings
           (setq element (assoc (nth ix keys) initial-frame-alist))
           (setq initial-frame-alist (delq element initial-frame-alist))))
      (and (setq element (assoc (nth ix keys) default-frame-alist))
           (setq default-frame-alist (delq element default-frame-alist))))
  (and frame-notice-user-settings
       (setq initial-frame-alist (append initial-frame-alist alist)))
  (setq default-frame-alist (append default-frame-alist alist)))


Ehud.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+keHkLFvTvpjqOY0RAlFAAJkB27OyGUdU2kwQXCc8WouvwqpHmACdFwDJ
hn6FcuPj/ScnXHJ39pgg/Gs=
=Kw0R
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]