unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Modify parameters on all frames
@ 2003-04-06 15:39 Ehud Karni
  2003-04-06 23:07 ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Ehud Karni @ 2003-04-06 15:39 UTC (permalink / raw)


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

I suggest to add a function to frame.el to change parameters on all
existing and future frames:

(defun modify-all-frames-parameters (alist)
  "modify all current and future frames parameters by changing 
`initial-frame-alist' and `default-frame-alist' and calling 
`modify-frame-parameters' on all existing frames with ALIST.
See help of `modify-frame-parameters' for more information."
  (let ((cframesc (cdr (current-frame-configuration)))
	frames ix fcount   ;; frames - list, index, count
	key val)	   ;; key and value for aput
    (while cframesc
      (setq frames (append (list (car (car cframesc))) frames))
      (setq cframesc (cdr cframesc)))
    (setq fcount (length frames))
    (while alist
      (setq val (car alist))
      (setq key (car val))
      (setq val (cdr val))
      (message "key=%s, val=%s" key val)
      (aput 'initial-frame-alist key val) ;; If before initial frame
      (aput 'default-frame-alist key val) ;; for next frames
      (setq ix 0)
      (while (< ix fcount)
	(modify-frame-parameters (nth ix frames) (list (cons key val)))
	(setq ix (1+ ix)))
      (setq alist (cdr 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:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+kEoVLFvTvpjqOY0RAk6mAJ9e01e2QNYZx8mVKEkeDoTo0nplmwCcCtna
4PiVyDeCfF3aM9kkgM1RMyY=
=oQ5f
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-06 15:39 Modify parameters on all frames Ehud Karni
@ 2003-04-06 23:07 ` Richard Stallman
  2003-04-07 20:39   ` Ehud Karni
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2003-04-06 23:07 UTC (permalink / raw)
  Cc: emacs-devel

    (defun modify-all-frames-parameters (alist)
      "modify all current and future frames parameters by changing 
    `initial-frame-alist' and `default-frame-alist' and calling 
    `modify-frame-parameters' on all existing frames with 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.

Please note that the first line of every doc string should stand on
its own.  Could you rewrite it to do that, and to follow the other doc
string conventions?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-06 23:07 ` Richard Stallman
@ 2003-04-07 20:39   ` Ehud Karni
  2003-04-08  6:45     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Ehud Karni @ 2003-04-07 20:39 UTC (permalink / raw)
  Cc: emacs-devel

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

On Sun, 06 Apr 2003 19:07:40 -0400, Richard Stallman <rms@gnu.org> 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:ehud@unix.mvs.co.il                  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-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-07 20:39   ` Ehud Karni
@ 2003-04-08  6:45     ` Richard Stallman
  2003-04-08 19:56       ` Ehud Karni
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2003-04-08  6:45 UTC (permalink / raw)
  Cc: emacs-devel

      "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."

Doc strings are supposed to say what job the function does, not HOW
the function works.  If HOW needs explaining, please do that with
comments.

Using a counter to loop through the list is ugly--why not loop using
dolist?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-08  6:45     ` Richard Stallman
@ 2003-04-08 19:56       ` Ehud Karni
  2003-04-09  5:39         ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Ehud Karni @ 2003-04-08 19:56 UTC (permalink / raw)
  Cc: emacs-devel

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

On Tue, 08 Apr 2003 02:45:45 -0400, Richard Stallman <rms@gnu.org> wrote:
> 
> Doc strings are supposed to say what job the function does, not HOW
> the function works.  If HOW needs explaining, please do that with
> comments.
> 
> Using a counter to loop through the list is ugly--why not loop using
> dolist?

OK. How about this:

(defun modify-all-frames-parameters (alist)
  "modify all current and future frames parameters according to ALIST.
This changes `default-frame-alist' and possibly `initial-frame-alist'.
See help of `modify-frame-parameters' for more information."
  (let (element)			;; temp
    (dolist (frame (frame-list))
      (modify-frame-parameters frame alist))

    (dolist (pair alist)		;; conses to add/replace
      ;; initial-frame-alist needs setting only when
      ;; frame-notice-user-settings is true
      (and frame-notice-user-settings
	   (setq element (assoc (car pair) initial-frame-alist))
	   (setq initial-frame-alist (delq element initial-frame-alist)))
      (and (setq element (assoc (car pair) 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:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+kylRLFvTvpjqOY0RAkQUAJ9lEu+8E0O9Ha0/Iv2QGZoN8vc0sACeOXPX
JZsK5eyQhCp1PszKjg0WxXw=
=WsBI
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-08 19:56       ` Ehud Karni
@ 2003-04-09  5:39         ` Richard Stallman
  2003-04-09 17:38           ` Ehud Karni
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2003-04-09  5:39 UTC (permalink / raw)
  Cc: emacs-devel

This version is good.  Could you write text for etc/NEWS?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Modify parameters on all frames
  2003-04-09  5:39         ` Richard Stallman
@ 2003-04-09 17:38           ` Ehud Karni
  0 siblings, 0 replies; 7+ messages in thread
From: Ehud Karni @ 2003-04-09 17:38 UTC (permalink / raw)
  Cc: emacs-devel

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

On Wed, 09 Apr 2003 01:39:04 -0400, Richard Stallman <rms@gnu.org> wrote:
> 
> This version is good.  Could you write text for etc/NEWS?

** The new command `modify-all-frames-parameters' modifies parameters
for all (existing and future) frames.

ChangeLog entry:

EhKarni  <ehud@unix.mvs.co.il>  
* frames.el (modify-all-frames-parameters): new function


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:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+lFqxLFvTvpjqOY0RArfDAJ4+ly98BVN6sx+HL2CqlRv4FIy3xgCfe+d2
kKBTUjziFtzc76kt8Bjj7nE=
=LKie
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-04-09 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-06 15:39 Modify parameters on all frames Ehud Karni
2003-04-06 23:07 ` Richard Stallman
2003-04-07 20:39   ` Ehud Karni
2003-04-08  6:45     ` Richard Stallman
2003-04-08 19:56       ` Ehud Karni
2003-04-09  5:39         ` Richard Stallman
2003-04-09 17:38           ` Ehud Karni

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).