Re: How To Override FrontEnd/init.m Settings?
- To: mathgroup at smc.vnet.net
- Subject: [mg57639] Re: [mg57456] How To Override FrontEnd/init.m Settings?
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 2 Jun 2005 05:18:13 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
- Sender: owner-wri-mathgroup at wolfram.com
Harold, Your example works perfectly for me in Mathematica 5.0 if placed in $UserBaseDirectory/FrontEnd/init.m. It does, indeed, produce the error you describe when placed in $UserBaseDirectory/Kernel/init.m. This is because of the sequence in which the 5.0 kernel does things at startup...at the time that the kernel's init.m file is read, it does not yet understand everything it needs to know to communicate with the FE (which SetOptions[$Frontend, opts___] requires). We recognized this was inconvenient for some, and the sequencing problem was fixed in 5.1. But adding front end preferences to the kernel's init.m file is probably not what you want, anyway. Changes to the front end wouldn't take effect until after the kernel had been launched. But this file remains an excellent place to make user-specific kernel-based changes (e.g. defining functions, loading packages). As for why things didn't appear to work in the front end's init.m file, I have a couple of ideas. First, to be clear...putting something in FrontEnd/init.m could absolutely *not* have caused the SetOptions::optnf message. This message is emitted exclusively by the kernel. If, indeed, you were getting that message, there might have been some confusion on which directory you were editing the init.m file in. Another possibility is that you may have tried to edit the FrontEnd/init.m file while the Mathematica front end was running, in which case the front end may very well have ignored your changes and, furthermore, overwritten them. The front end only reads this file once...at startup...but it frequently overwrites this file while running to make sure the latest preferences are always stored, so this is a quite likely hypothesis. I think you have all of the tools here to properly deploy user-specific configuration files without having to invent any new schema that require modifying $InstallationDirectory. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Sat, 28 May 2005 05:39:37 -0400 (EDT), Harold wrote: > $Version = 5.0 for Microsoft Windows (November 18, 2003) > > $Host = Windows XP Pro, Version 5.1 > > Mathgroup: > > When a change is made to the OptionBrowser, it is stored in > $UserBaseDirectory/FrontEnd/init.m. My normal Magnification = 1.66. > To determine how $UserBaseDirectory/FrontEnd/init.m settings could be > overridden by a new user's FrontEnd/init.m settings, I placed the > override > > SetOptions[ $FrontEnd, Magnification->3 ] > > into an init.m file, and tried using it in all the FrontEnd/init.m and > Kernel/init.m file initialization options described in MathBook's File > Layout > Front End, Kernel, and Configuration sections. No matter > where I put this new init.m file, Mathematica gives a load error beep, > and prints > > SetOptions::optnf: Magnification is not a known option for > $FrontEnd. > > However, if I move this init.m file to $InstallationDirectory, AND > change its name from init.m to just "x" (no file extension), and > relaunch Mathematica, I get a normal Untitled-1 notebook with my > default font. Into this notebook I type > > << x > > and Mathematica accepts the one line "SetOptions[ $FrontEnd, > Magnification->3 ]" without complaint, and instantly changes the > system's font size to 300% magnification. > > This series of experiments brings me to the following conclusion. > > Suppose I have several Mathematica users on the same machine, each of > whom wants a different set of FrontEnd settings overrides and Kernel > customizations. For simplicity, I would like to tell them we need only > put what they want into _one_ file in $InstallationDirectory, which > we'll name with each user's unique 3 initials (say jmb). Then all they > have to do when the Untitled-1 notebook appears is type > > << jmb <Num-Enter> > > and Mathematica will accept all their FrontEnd overrides and Kernel > customizations. > > What really bothers me is that I've found no simple way to make > Mathematica accept FrontEnd command overrides when I follow the > FrontEnd/init.m directions given in the Mathematica 5.0 Book. > > Does anyone have some different or additional thoughts on this issue? > > - Harold