home *** CD-ROM | disk | FTP | other *** search
- ; fortran.cmd, emacs, 31 Jan 90, S.D. Maley
- ; Fortran convention support under MicroEmacs 3.10 and later
- ;
- set %sindent 6 ;-- indentation for Fortran statements
- ; align with handle-tab, if you change it
- 72 set-fill-column
- 2 handle-tab ;-- 2 is a modest tab setting, change if you like
-
- bind-to-key execute-macro-36 c
- ; bind-to-key execute-macro-35 " " ;-- too SLOW !!
- bind-to-key execute-macro-34 ^I
-
- set $wraphook execute-macro-33
- set %indent %sindent
-
- ;; when comments must be upper-case ...
- 36 store-macro
- !if &equ $curcol 0
- insert-string "C"
- !else
- insert-string "c"
- !endif
- !endm
-
- ;; handle indentation
- 35 store-macro
- !if &less $curcol %sindent
- execute-procedure find-indent
- execute-procedure indent
- !else
- !if &less $fillcol $curcol
- $wraphook
- !endif
- insert-string " "
- !endif
- !endm
-
- ;; handle tabs
- 34 store-macro
- !if &less $curcol %sindent
- execute-procedure find-indent
- execute-procedure indent
- !else
- !if &less $fillcol $curcol
- $wraphook
- !endif
- handle-tab
- !endif
- !endm
-
- ;; wraparound
- 33 store-macro
- wrap-word
- execute-procedure find-indent
- set $curcol 0
- !if &sequ %indfollows "C"
- insert-string "C"
- !else
- insert-string " +"
- !endif
- set %indent &sub %indent $curcol
- execute-procedure indent
- end-of-line
- !endm
-
- store-procedure find-indent
- ;-- find out the indentation
- !if &equ $curline 1
- set %indent %sindent
- set %indfollows " "
- !else
- set %curline $curline
- set %curcol $curcol
- beginning-of-line
- previous-line
- set %indfollows &chr $curchar
- !if &less $lwidth %sindent
- set %indent %sindent
- !else
- set $curcol 6 ; past insignificance
- !while &equ $curchar 32 ;-- white space
- forward-character
- !endwhile
- set %indent $curcol
- !endif
- set $curline %curline
- set $curcol %curcol
- !endif
- !endm
-
- store-procedure indent
- !if &less 0 %indent
- %indent insert-string " "
- !endif
- !endm
-