all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Dynamic setting of custom vars?
@ 2003-03-25 15:59 Greg Fenton
  2003-03-25 17:04 ` Stefan Monnier
  2003-03-25 17:08 ` Per Abrahamsen
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Fenton @ 2003-03-25 15:59 UTC (permalink / raw)


I am trying to set som custom vars based on conditions of the 
system we are running on.

In my .emacs, I have the following code:

;-----------------------------------------------------------
(cond
  ((string-match "my-laptop" (downcase (system-name)))
     (setq glf-height 60))
  ((string-match "my-linux-box" (downcase (system-name)))
     (setq glf-height 80)))

(custom-set-variables
  '(default-frame-alist
      (quote ((width . 81) (height . glf-height))))
  '(initial-frame-alist
      (quote ((width . 81) (height . glf-height))))
)
;-----------------------------------------------------------


However, it appears that the value of glf-height is being ignored 
during the creation of the intial frame (trying to create 
subsequent frames throws an error "(wrong-type-argument integerp 
glf-height)".

I assume I must reference the variable in some other way in the 
custom-set-variables or that the value of glf-height is not 
visible to the make-frame-command.

Is what I'm doing at all possible?  Is there a better way (should 
I simply avoid custom-set-variables)?

Thanks in advance,
greg.fenton

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

* Re: Dynamic setting of custom vars?
  2003-03-25 15:59 Dynamic setting of custom vars? Greg Fenton
@ 2003-03-25 17:04 ` Stefan Monnier
  2003-03-25 17:08 ` Per Abrahamsen
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2003-03-25 17:04 UTC (permalink / raw)


>>>>> "Greg" == Greg Fenton <greg.fenton.NO.SPAM@ianywhere.com> writes:
> should I simply avoid custom-set-variables?

Yes.  It is used by the `custom' GUI-like interface, but should
preferably not be used when hand-writing your .emacs file.


        Stefan

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

* Re: Dynamic setting of custom vars?
  2003-03-25 15:59 Dynamic setting of custom vars? Greg Fenton
  2003-03-25 17:04 ` Stefan Monnier
@ 2003-03-25 17:08 ` Per Abrahamsen
  1 sibling, 0 replies; 3+ messages in thread
From: Per Abrahamsen @ 2003-03-25 17:08 UTC (permalink / raw)


Greg Fenton <greg.fenton.NO.SPAM@ianywhere.com> writes:

> Is what I'm doing at all possible?  Is there a better way (should I
> simply avoid custom-set-variables)?

Avoiding custom-set-variables for system dependent variables are by far
the easiest solution.  I recommend that.

Another solutions would set custom-file depending on the system
setting.  Then all customize variables will in effect be system
dependent.  For some, this may be the best solution.

A third solution would be

  (cond ((string-match "my-laptop" (downcase (system-name)))
         (setq glf-height 60))
        ((string-match "my-linux-box" (downcase (system-name)))
         (setq glf-height 80)))
  
  (custom-set-variables
    '(default-frame-alist (list '(width . 81) (cons 'height glf-height)))
    '(initial-frame-alist (list '(width . 81) (cons 'height glf-height))))

I.e. instead of using quote, build the list.

I don't recomment this, since if you customize the value later, you
lose the information.  So you can just as well use setq, which is
simpler, and allows Customize to warn youif you try to change it.

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

end of thread, other threads:[~2003-03-25 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-25 15:59 Dynamic setting of custom vars? Greg Fenton
2003-03-25 17:04 ` Stefan Monnier
2003-03-25 17:08 ` Per Abrahamsen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.