3 lines
12 KiB
HTML
3 lines
12 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>08-YOUR-INIT</title><link href="navigation.css" rel="stylesheet" type="text/css"/><link href="document.css" rel="stylesheet" type="text/css"/></head><body><p class="top_nav"><a href="part10.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part12.htm">Next ></a></p><h1 style="padding-top: 3pt;padding-left: 35pt;text-indent: 0pt;text-align: left;"><a name="bookmark10">8. YOUR INIT FILE</a></h1><p style="padding-left: 35pt;text-indent: 0pt;line-height: 6pt;text-align: left;"><span><img width="640" height="8" alt="image" src="Image_066.png"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: justify;">Lisp has a number of global variables that control the environment. Global variables make it easy to customize the environment to fit your needs. One way to do this is to</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 106%;text-align: justify;">develop an <span class="s3">INIT </span>file. This is a file that is loaded when you start an image. You can use it to set variables, load files, define functions, and any other things that you want to do to make the Medley environment suit you.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">Using the USERGREETFILES Variable </h2><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">As described in File Variables section of Chapter 11, each program file has a global Your <span class="s3">INIT </span>file could be called <span class="s3">INIT</span>, <span class="s3">INIT.LISP</span>, <span class="s3">INIT.USER</span>, or whatever the</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">convention is at your site. There is no default name preferred by the system, it just</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 106%;text-align: left;">looks for the files listed in the variable <span class="s3">USERGREETFILES </span>(see below). Check to see what the preference is at your site. Put this file in your directory. Your directory name should be the same as your login name. The <span class="s3">INIT </span>file is loaded by the function <span class="s3">GREET</span>. <span class="s3">GREET </span>is normally run when Medley is started. If this is not the case at your site, or you want</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">to use the machine and Medley has already been started, you can run the function</p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;text-align: left;">GREET <span class="p">yourself. If your user name was, for example, </span>TURING <span class="p">, then you would type:</span></p><p class="s3" style="padding-top: 7pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(GREET ’TURING)</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">This does a number of things, including undoing any previous greeting operation,</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">loading the site init file, and loading your init file. Where <span class="s3">GREET </span>looks for your INIT file depends on the value of the variable <span class="s3">USERGREETFILES</span>. The value of this variable is set when the system’s <span class="s3">SYSOUT </span>file is made, so check its value at your site! For example, its value could be:</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 197pt;text-indent: 0pt;text-align: left;"><span><img width="236" height="89" alt="image" src="Image_067.gif"/></span></p><p style="padding-top: 9pt;padding-left: 202pt;text-indent: 0pt;text-align: left;">Figure 8-1. Possible Value of <span class="s3">USERGREETFILES</span></p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;line-height: 106%;text-align: left;">In each place you see <span class="s3">>USER></span>, the argument passed to <span class="s3">GREET </span>is substituted into the path. This is your login name if you are just starting Medley. For example, the first value in the list would have the system check to see whether there was a</p><p class="s3" style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">{DSK}<LISPFlLES>TURING>INIT.LISP <span class="p">file. No error is generated if you do not have an </span>INIT <span class="p">file, and none of the files in </span>USERGREETFILES <span class="p">are foun d.</span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">Making an Init File </h2><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">As described in File Variables section of Chapter 11, each program file has a global</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">variable associated with it, whose name is formed by appending <span class="s3">COMS </span>to the end of the root filename. For any of the standard <span class="s3">INIT </span>file names, the variable <span class="s3">INITCOMS </span>is used. To set up an init file, begin by editing this variable. Type:</p><p class="s3" style="padding-top: 6pt;padding-left: 143pt;text-indent: 0pt;text-align: left;">(DV INITCOMS)</p><p class="s7" style="padding-top: 3pt;padding-left: 35pt;text-indent: 0pt;text-align: left;"> 8. YOUR INIT FILE </p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">An SEdit window wiil appear. This window is the same as the one called with the</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">function <span class="s3">DF</span>, and described in the Using the List Structure Editor section in Chapter 7. This chapter assumes that you know how to use the SEdit structure editor .</p><p style="padding-top: 6pt;padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">The <span class="s3">COMS </span>variable is a list of lists. The first atom in each internal list specifies for the file package what types of items are in the list, and what it is to do with them. This</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">section will deal with three types of lists: <span class="s3">VARS</span>, <span class="s3">FILES</span>, and <span class="s3">P</span>. Please read about others in Chapter 17 of the <i>IRM</i>.</p><p style="padding-top: 6pt;padding-left: 107pt;text-indent: 0pt;text-align: justify;">Notice that inside the vars list, there is yet another list. The first item in the list is the name of the variable. It is bound to the value of the second item. There are many other variables that you can set by adding them to the VARS list. Some of these variables are described in Chapter 24, and many others can be foun d in the <i>IRM</i>.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">If you want to automatically load files, that can be done in your init file also. For</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">example, if you always want to load tho Library file <span class="s3">SPY.LCOM </span>, you can load it by editing tho <span class="s3">INITCOMS </span>variable to list the appropriate file in the list starting with <span class="s3">FILES</span>:</p><p style="padding-top: 10pt;text-indent: 0pt;line-height: 11pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 11pt;text-align: center;">.</p><p class="s3" style="padding-left: 215pt;text-indent: 0pt;line-height: 11pt;text-align: left;">(FILES SPY)</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 11pt;text-align: center;">.</p><p style="padding-top: 5pt;padding-left: 111pt;text-indent: 0pt;text-align: center;">Figure 8-2. <span class="s3">INITCOMS </span>Changed to Load <span class="s3">SPY.LCOM </span>File</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Other files can also be added by simply adding their names to this <span class="s3">FILES </span>list.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Another list that can appear in a <span class="s3">COMS </span>list begins with <span class="s3">P</span>. This list contains Lisp</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">expressions that are evaluated when the file is loaded. Do not put <span class="s3">DEFINEQ </span>expressions in this list. Define the function in the environment, and then save it on the file in the</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 11pt;text-align: left;">usual way (see Chapter 7).</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">One type of expression you might want to see here, however, is a <span class="s3">FONTCREATE </span>function (see Chapter 16). For example, of you want to use a Helvetica 12 BOLD font, and there is not a font descriptor for it normally in your environment, the appropriate call to <span class="s3">FONTCREATE </span>should be in the "P" list. The <span class="s3">INITCOMS </span>would look like this:</p><p style="text-indent: 0pt;line-height: 11pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p class="s3" style="padding-left: 214pt;text-indent: 0pt;line-height: 10pt;text-align: left;">(FILES SPY)</p><p class="s3" style="padding-left: 214pt;text-indent: 0pt;line-height: 10pt;text-align: left;">(P (FONTCREATE ’HELVETICA 12 ’BOLD))</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 10pt;text-align: center;">.</p><p style="text-indent: 0pt;line-height: 11pt;text-align: center;">.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 111pt;text-indent: 0pt;text-align: center;">Figure 8-3. <span class="s3">INITCOMS </span>Edited to Include a call to <span class="s3">FONTCREATE</span></p><p style="padding-top: 7pt;padding-left: 106pt;text-indent: 0pt;line-height: 106%;text-align: left;">To quit, exit from SEdit in the usual way. When you run the function <span class="s3">MAKEFILES </span>(see Chapter 7), be sure that you are connected to the directory (see Chapter 4) where the <span class="s3">INIT </span>file should appear. Now when <span class="s3">GREET </span>is run, your Init file will be loaded.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 35pt;text-indent: 0pt;line-height: 1pt;text-align: left;"><span><img width="665" height="1" alt="image" src="Image_068.png"/></span></p><p class="s8" style="padding-left: 35pt;text-indent: 0pt;text-align: left;">8-2 <span class="s6">Medley for the Novice, Release 2.0</span></p><p class="nav"> </p><p class="nav"> </p><p class="nav"><a href="part10.htm">< Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part12.htm">Next ></a></p><p class="nav"> </p></body></html>
|