Emacs WAVE Mode (wave-mode) for WAVE Command Language.
Features:
o Case Conversion
o reserved words are converted to upper case
o system variables are capitalized
o COMMON name is capitalized
o PRO or FUNCTION name is capitalized (or upper cased)
o Spacing
o space inserted around:
& - multiple statement
,
= - including keywords
<
>
o Defined Keys
C-c ; - comment region
M-; - insert and indent parallel comment
M-C-d - mark library documentation region
C-M-a - beginning of subprogram
C-M-e - end of subprogram
M-C-h - mark subprogram
M-C-q - indent subprogram
M-RET - start continuation line
M-TAB - insert TAB
C-c C-p - previous statement
C-c C-n - next statement
TAB - indent line
C-c TAB - indent entire buffer
o User Option Variables
Variables controlling indentation style and extra features:
wave-block-indent
Extra indentation within blocks. (default 3)
wave-continuation-indent
Extra indentation within continuation lines. (default 2)
wave-doclib-start
Start of Wave CL document library header. (default ^[;*]\+)
wave-doclib-end
End of Wave CL document library header. (default ^[;*]-)
wave-minimum-statement-indent
Minimum indentation for wave statements. (default 0)
wave-newline-and-indent
Automatically indents current line, inserts newline and
indents it. (default is t)
wave-comment-region
String inserted by \\[wave-comment-region] at start of each line in
region. (default \";; \")
wave-surround-by-blank
Automatically surrounds '=','<','>','&' with blanks,
appends blank to comma. (default is t)
wave-startup-message
Set to nil to inhibit message first time wave-mode is used.
wave-block-match-back-max
Maximum number of lines to search for matching block delimiter
to blocks lines. (default is 40)
Set to 0 to suppress block matching.
wave-upcase-procedure-name
UPPERCASE (t) or Capitalize (nil) function and procedure names. (default is nil)
wave-upcase-common-name nil
UPPERCASE (t) or Capitalize (nil) common block names. (default is nil)
o Indentation
By default current and next comment line is indented, when RET is
entered. This can be suppressed by setting `wave-newline-and-indent'
to nil. TAB is used for explicit indentation.
After the line is indented, all abbreviations on that line are
expanded, spacing ant case conversion is performed.
Code Indentation:
Variable `wave-block-indent' specifies relative indent for
block statements(begin...end),
variable `wave-continuation-indent' specifies relative indent for
continuation lines.
Continuation lines inside [], (), {} (structures) are indented by
`wave-continuation-indent' chars after opening parenthesis.
Continuation lines in PRO, FUNCTION declarations are indented
just after the procedure/function name followed by comma.
Labels not followed by code are left justified to the beginning
of the line.
Include files introduced by '@' are left justified to the beginning
of the line.
Comment Indentation:
Full line comments starting at the beginning of the line are
are not indented.
Full lin comments starting with white space are indented as
a code.
Code line comment is indented to the value of `comment-column'.
o Block Statement, Quote Matching
When end of the block statement is entered (ENDCASE, ENDELSE,
ENDIF, ENDREP, ENDWHILE, or END), cursor flashes shortly to the
beginning of the block.
When closing double or single quote is entered, cursor flashes
shortly to the beginning of the block.
o Abbreviations
Abbreviations are available for all reserved words, often used
functions, and WAVE Toolbox and Widget routines.
'.' character is used as a prefix for abbreviations.
To get entire list of abbreviations type .?, while in wave-mode.
List of abbreviations:
.b BEGIN .c CASE OF
.cb BYTE( ) .cc COMPLEX( )
.cd DOUBLE( ) .cf FLOAT( )
.cl LONG( ) .co COMMON
.cs STRING( ) .cx FIX( )
.d DO .e ELSE
.ec ENDCASE .ee ENDELSE
.ef ENDFOR .ei ENDIF ELSE IF
.el ENDIF ELSE .en ENDIF
.er ENDREP .ew ENDWHILE
.f FOR DO .fu FUNCTION
.g GOTO, .h HELP,
.i IF .k KEYWORD_SET( )
.n N_ELEMENTS( ) .oi ON_IOERROR,
.on ON_ERROR, .or OPENR,
.ou OPENU, .ow OPENW,
.p PRO .pr PRINT,
.pt PLOT, .r REPEAT UNTIL
.re READ, .rf READF,
.rt RETURN .ru READU,
.sc STRCOMPRESS( ) .sl STRLOWCASE( )
.sm STRMID( ) .sn STRLEN( )
.sp STRPOS( ) .sr STRTRIM( )
.st STRPUT( ) .su STRUPCASE( )
.t THEN .tac WtAddCallback( )
.tah WtAddHandler( ) .tc WtCreate( )
.tca WtCallback( ) .tcl WtClose( )
.tg WtGet( ) .ti WtInit( )
.tl WtList( ) .tlo WtLoop( )
.tml WtMainLoop( ) .tp WtPointer( )
.ts WtSet( ) .tt WtTimer( )
.u UNTIL .w WHILE DO
.wb WwButtonBox( ) .wcm WwCommand( )
.wco WwControlBox( ) .wdi WwDialog( )
.wdr WwDrawing( ) .wf WwFileSelection( )
.wg WwGetValue( ) .wi WwInit( )
.wla WwLayout( ) .wli WwList( )
.wlo WwLoop .wm WwMessage( )
.wmb WwMenuBar( ) .wmw WwMainWindow( )
.wo WwOptionMenu( ) .wp WwPopupMenu( )
.wr WwRadioBox( ) .ws WwSetValue( )
.wt WwText( ) .wto WwToolBox( )
.wu WRITEU,
o Modifying in Batch Mode
You can modify your WAVE CL *.pro file in batch mode using
following function and command:
Example:
1. Create following Lisp function in wave-indent.el file:
(load "wave.el")
(wave-mode)
(wave-indent-buffer)
(save-buffer)
2. Issue following command:
emacs -batch <file.pro> -l wave-indent.el
o Installation
To install:
1. Download wave.el file (and other files, if you wish), and place
them to appropriate 'load' directory.
2. Put in your ~/.emacs file:
(you may want to specify a file path for wave.el file)
(setq auto-mode-alist
(append
'(("\\.pro$" . wave-mode))
auto-mode-alist))
(autoload 'wave-mode "wave"
"Major mode for edition WAVE CL .pro files" t)
o Customization
Turning on Wave mode calls the value of the variable wave-mode-hook
with no args, if that value is non-nil.
Example:
;;
;; To customize wave-mode put following code to your .emacs file
;;
(setq wave-mode-hook
(function (lambda ()
(setq wave-block-indent 6
wave-continuation-indent 3
wave-minimum-statement-indent 2
wave-newline-and-indent nil
wave-upcase-procedure-name t
wave-upcase-common-name t
wave-surround-by-blank nil))))
Customization Tips:
I wanted to modify wave-mode behavior in two ways:
1. I didn't want comments on the end of code lines to get moved when the
line got reformatted.
2. I wanted to be able use Tab to insert whitespace in comments, but
continue to use Tab to reformat lines of code.
The following bit of code accomplishes that (courtesy Chadwick Marks):
;;
;; For wave-mode
;;
(defun wave-smart-tab ()
"Do wave-mode indentation if not in a comment."
(interactive)
(if (wave-in-comment) (tab-to-tab-stop) (wave-indent-line))
)
(setq wave-mode-hook
(function (lambda ()
(setq comment-column 0)
(define-key wave-mode-map "\t" 'wave-smart-tab)
)))
I like the DEL key to delete the next character, and backspace (C-h) to
delete the previous character, so I put this in my wave-mode-hook:
(setq wave-mode-hook
(function (lambda ()
(define-key wave-mode-map "\C-?" 'delete-char)
(define-key wave-mode-map "\C-h" 'wave-delete-char))))
o Distribution
WAVE CL wave-mode Emacs mode is available with the PV-WAVE installation
in the directory:
Unix: $WAVE_DIR/lib/emacs
Windows: %WAVE_DIR%\lib\emacs
OpenVMS: WAVE_DIR:[LIB.EMACS]
For better performance, byte compile wave.el file.
In accordance with Free Software Foundation policy, wave-mode is
distributed free of charge; standard FSF copyright policy applies.
Mail bugs, suggestions, improvements to support@boulder.vni.com.
$Id: wave-mode.txt,v 1.6 1997/03/20 17:44:48 landers Exp $