SPP-MODE.EL is an Emacs editing mode for SPP code developed by Jonathan Eisenhamer at STScI. Below is the original announcement. -------------------------------------------------------------------------------- From eisenham@stsci.edu Mon Feb 10 08:46:39 1992 From: (Jonathan Eisenhamer) To: iraf@noao.edu Subject: SPP major mode for Emacs Greetings, Below is a description of some utilities I've developed to help in my spp programming. It is a major mode for Emacs that knows about spp syntax. I don't know whether anyone there uses Emacs or not. All disclaimers apply- i.e. not really supported except for my own use, etc. If anyone is interested, let me know and I'll send the necessary files. This is to announce three new tools for Emacs that will, hopefully, help in SPP program development. Below is a brief description followed by how to get started and where the pertinent files reside. The first two tools are contained in an Emacs function, spp-mode. For those into Emacs, spp-mode is a major mode that defines a case-sensitive environment for writing SPP code. Specifically, if one is editing a file in spp-mode, lines are indented according to the their logical position relative to previously written code. The main reason for such capability is that properly-indented code is easier to maintain, but it is a real pain to try to keep the indentation correct, especially when modifying existing code. The second tool that the use of spp-mode will buy is the ability to use abbreviations for common words and structures. Emacs has the general capability for defining associations between abbreviations and the text the abbreviation stands for. Thus, when one types the abbreviation, Emacs dynamically expands the abbreviation into the full text that it stands for. spp-mode defines a basic abbreviation table containing command words and a few basic structures found in much of SPP. Since things like abbreviations are rather personal, the defined list is more of an example of what can be done with this feature. Finally, Emacs has a general ability to search for tags. Specifically, for SPP, a tag is a procedure or task definition. A C-routine, spptags, builds a simple database file which associates a procedure definition (tag) and the file that tag appears in. Thus while editing, if one desires to look at the code for a particular IRAF routine, the find-tag command is invoked which will cause Emacs to open the appropriate file and place the cursor at the procedure declaration. Below is a brief discussion of how to get started with this business. You will of course need to know the basics of Emacs. Specifically, you need to know how to visit a file, move the cursor, and switch buffers and/or windows. Go ahead and do it. Emacs is neither harder nor easier than any other editor- just different. There is a basic on-line tutorial that will teach you all the above basics. To invoke it, start emacs, 'emacs', and then type 'C-h t' (that is: type Control-h and then a 't'). This takes about 10 minutes. Jeff Hayes has copies of the Emacs manual in his office. The manual is also online in Emacs under the Info utility. If you decide to use Emacs, the Info utility is an absolute must. To invoke it, hit the ESC key, then 'x', and type 'info'. There is a tutorial about using Info that is VERY EASY!!! Go for it- Life's not a dress rehearsal. Finally, there is some local help available. I'll be happy to demo, explain, setup, etc. Dave and Bernie have also "taken up the cause" but may not want to admit it. My .emacs file is available for perusal, check out ~eisenham/.emacs. All thoughts and comments are appreciated. Feel free to look at and modify anything and everything that you find distasteful or disturbing. Now, to use spp-mode, you need to add the following lines to your .emacs file (which should be located in your home directory): (setq load-path (append '("/ra/p4/lib") load-path)) (autoload 'spp-mode "spp-mode") (setq auto-mode-alist (append '(("\\.x$" . spp-mode)) auto-mode-alist)) The first line defines the LOAD PATH, similar to the Unix PATH environmental variable, necessary to find the code for spp-mode, located in the file spp-mode.el. The next tells Emacs to load the spp-mode code when the function is invoked. The final line tells Emacs that whenever a file that ends in '.x' is loaded, that the major mode should be spp-mode. Once added, restart emacs. Now when you load ("visit" in Emacs terminology) an spp file, you'll be automatically placed in spp-mode. To get further help about spp-mode and how you can customize it, go to a buffer that has spp-mode (i.e. load an spp file) and type 'C-h m'. Control-h invokes the Emacs help facility, and m means to describe the current major mode. To see what abbreviations are defined, go to a buffer with spp-mode invoked, and type 'M-x list-abbrevs'. Note: The key M- is the Meta Key. Normally, the meta key is the ESC key. So to type M-x, you hit the ESC key and then the x key. On Sun keyboards, the meta key is also defined as the two diamond keys on either side of the space bar and they work much like the Control key; i.e. to type M-x you hold down a diamond key and type x. This will bring up a buffer containing a list of abbreviations. The string on the left is the abbreviation, the number is how many times that abbreviation has been invoked, the third column is the text the abbreviation expands to and an optional fourth column is a function that is called when the abbreviation is invoked. For example, the first abbreviation is ';b'. When you are in your spp-mode buffer, if you type ';b', it will be replaced with the word 'begin'. Note also that it calls the function spp-begin-end. The function adds a line and the word end and leaves the cursor between the begin and end. Finally, how to use the tag facility. I have built three files located in /ra/p4/lib; tags.all, tags.iraf, and tags.stsdasx. tags.iraf and tags.stsdas contains the databases for development versions of iraf and stsdas respectively. tags.all is a concatenation of the two databases, with the stsdas database first. To see how the tags work, visit your favorite spp source, move the cursor on top of some routine, for example a call to imunmap. Then type the following: 'M-.' The cursor should now move to the one-line status or "minibuffer" at the bottom of the Emacs screen and it should read something like: 'Find tag (imunmap):". At this point, you can either hit RETURN to find the imunmap tag or type in the name of another routine you'd like to see. Hit return. Now, in the minibuffer, you'll get a question about what TAGS file you want to use. Type in the file '/ra/p4/lib/tags.iraf' and hit RETURN. At this point, another buffer will appear containing the source file where the procedure imunmap is defined. jde