home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / elvos221.zip / lib / elvis.arf < prev    next >
Text File  |  1998-12-10  |  2KB  |  60 lines

  1. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  2. " SAVE THE CURRENT STATE OF THE "saveregexp" OPTION
  3. let s=saveregexp
  4. set nosaveregexp
  5. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  6. " TAKE A GUESS AT THE BUFFER'S PREFERRED DISPLAY MODE
  7. let e=tolower(dirext(filename))
  8. if knownsyntax(filename)
  9. then set! bufdisplay=syntax
  10. if os=="unix" && buflines >= 1
  11. then {
  12.  1s/^#! *[^ ]*\/\([^ ]\+\).*/set! bufdisplay="syntax \1"/x
  13.  if bufdisplay<<11=="syntax perl"
  14.  then set! bufdisplay="syntax perl"
  15. }
  16. if !newfile
  17. then {
  18.  if readeol=="binary" && bufdisplay=="normal"
  19.  then set! bufdisplay=hex
  20.  if e==".man"
  21.  then set! bufdisplay=man
  22.  if strlen(e)==2 && isnumber(e>>1) && buflines>=1
  23.  then 1s/^\./set! bufdisplay=man/x
  24.  if e==".tex"
  25.  then set! bufdisplay=tex
  26.  if e<<4==".htm"
  27.  then set! bufdisplay=html
  28.  if buflines >= 1 && bufdisplay=="hex"
  29.  then 1s/^<[HIThit!]/set! bufdisplay=html/x
  30.  if (filename<<5=="http:" || filename<<4=="ftp:") && strlen(e)<4 && bd=="hex"
  31.  then set! bufdisplay=normal
  32.  if bufdisplay=="normal" && buflines >= 1
  33.  then 1s/^From .*/set! bufdisplay="syntax email"/x
  34.  if dirdir(filename)=="/tmp" || dirdir(filename)=="/var/tmp"
  35.  then set! bufdisplay="syntax email"
  36. }
  37. if bufdisplay=="html" && readonly
  38. then set locked
  39. set e=""
  40. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  41. " Some messages
  42. if tolower(basename(program))!="elvis" && !ro && (bd=="html" || bd=="man" || bd="tex")
  43. then message Hit ^Wd to see source
  44. if partiallastline && readeol!="binary"
  45. then warning Partial last line
  46. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  47. " EXECUTE MODELINES, IF "modeline" OPTION IS SET
  48. if modeline && buflines >= 1 && buflines <= modelines * 2
  49. then %s/ex:\(.*\):/\1/x
  50. if modeline && buflines > modelines * 2
  51. then {
  52.  eval 1,(modelines)s/[ev][xi]:\\\(.*\\\):/\1/x
  53.  eval (buflines - modelines + 1),(buflines)s/[ev][xi]:\\\(.*\\\):/\1/x
  54. }
  55. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  56. " RESTORE THE "saveregexp" OPTION
  57. if s
  58. then set saveregexp
  59. set s=""
  60.