home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / mutt / init.mut < prev    next >
Lisp/Scheme  |  1988-10-05  |  5KB  |  148 lines

  1.     ;; init.mut - The ME initialization file
  2.     ;;   C Durland
  3.  
  4. (defun
  5.   center-cursor { (arg-prefix 0)(reposition-window) }
  6.   CR->CR&indent
  7.   {
  8.     (bind-to-key "newline-and-indent" "^M") 
  9.     (msg "CR mapped to newline-and-indent")
  10.   }
  11.   CR->CR    { (bind-to-key "newline" "") (msg "CR mapped to newline") }
  12.   delete-line    { (beginning-of-line)(arg-prefix 1)(kill-line) }
  13.   insert-line    { (beginning-of-line)(open-line) }
  14.   mark-and-end    { (set-mark)(end-of-buffer) }
  15.   mark-and-home    { (set-mark)(beginning-of-buffer) }
  16.   visit-a-file  { (ask-user)(visit-file)(delete-other-windows) }
  17.   delete-current-window
  18.     { (if (not (delete-window -1)) (msg "Could not delete window")) }
  19.   describe-key    ; what is a key bound to
  20.   {
  21.     (string key 10 bind 80)
  22.  
  23.     (key (ask "Key: "))
  24.     (if (== "" (bind (key-bound-to key)))(msg key " is not bound.")
  25.     (msg key " is bound to " bind))
  26.   }
  27.   rename-buffer
  28.   {
  29.     (string name 200)
  30.  
  31.     (name (ask "New file name for buffer: "))
  32.     (if (not (file-name -1 name)) (msg "Could not rename buffer."))
  33.   }
  34.   not-modified { (buffer-modified -1 FALSE) }
  35. )
  36.  
  37. (const REG 0)
  38. (defun        ;; rectangle commands
  39.   copy-rect  { (copy-rectangle REG) }
  40.   cut-rect   { (copy-rectangle REG) (erase-rectangle TRUE) }
  41.   erase-rect { (erase-rectangle TRUE) }
  42.   clear-rect { (erase-rectangle FALSE) }
  43. )
  44.  
  45. (include pmatch.mut)    ; paren matching
  46. (include indent.mut)    ; shift a region right or left
  47. (include markring.mut)    ; a ring of marks
  48. (include sysvar.mut)    ; allow user to view or modify system vars
  49. (include nextfile.mut)    ; read next file from command line
  50. (include bstats.mut)    ; buffer stats
  51.  
  52. (include isearch.mut)    ; incremental search
  53. (include twiddle.mut)    ; transpose characters
  54.  
  55. (include killbuf.mut)    ; an "improved" kill-buffer
  56. (include nomunge.mut)    ; read only mode for a buffer
  57.  
  58. (include wspace.mut)
  59.  
  60. (include autoload.mut)
  61. (defun
  62.   adjust-lines    { (autoload "adjust-lines" "adjust.mut" (push-args 0)) }
  63.   calculator    { (autoload "calculator"   "calc.mut") }
  64.   c-mode    { (autoload "c-mode"       "cmode.mut") }
  65.   mutt-mode    { (autoload "mutt-mode"    "muttmode.mut") }
  66.   text-mode    { (autoload "text-mode"    "textmode.mut") }
  67.   pu        { (autoload "pu"       "dir.mut") }
  68.   cd        { (autoload "cd"       "dir.mut") }
  69.   pwd        { (autoload "pwd"       "dir.mut") }
  70.   edit-picture    { (autoload "edit-picture" "picture.mut") }
  71. )
  72.  
  73. (defun set-mode (string filename) HIDDEN
  74. {
  75.   (if (RE-string '.+\(\.[a-zA-Z]+\)' filename)
  76.   {
  77.     (switch (get-matched '\1')
  78.       ".c"    (floc "c-mode" ())
  79.       ".h"    (floc "c-mode" ())
  80.       ".mut"    (floc "mutt-mode" ())
  81.       ".doc"    (floc "text-mode" ())
  82.       ".txt"    (floc "text-mode" ())
  83.     )
  84.   })
  85. })
  86.  
  87. (defun buffer-created-hook
  88. {
  89.   (init-markring)
  90.   (set-mode (buffer-name -1))
  91. })
  92.  
  93. (defun MAIN    ; and now the init time code
  94. {
  95.   (msg "loading init file ...")
  96.  
  97.   (HELP 0)    ; I don't need no steenking help
  98.  
  99.       ; set up the soft keys if the terminal type is known
  100. ;  (switch (getenv "TERM")
  101. ;    "xterm" (load "xterm")
  102. ;    "vt100" (load "xterm")
  103. ;  )
  104.  
  105. ;  (modify-syntax-entry "w-")    ; a dash is part of a word
  106.  
  107.       ; get rid of some keys I don't like
  108. ;  (bind-to-key "" "^W")(bind-to-key "kill-region" "M-C-W")
  109. ;  (bind-to-key "calculator"    "C-C")
  110.  
  111.   (bind-to-key "kill-whitespace" "F-1")    ; F1
  112.   (bind-to-key "next-buffer"     "F-2")    ; F2
  113.   (bind-to-key "delete-line"     "F-5")    ; F5
  114.   (bind-to-key "p-match"     "F-6")    ; F6 in pmatch.mut
  115.   (bind-to-key "CR->CR&indent"     "F-7")    ; F7
  116.   (bind-to-key "CR->CR"         "F-8")    ; F8
  117.   (bind-to-key "set-mark"     "F-0")    ; F10
  118.  
  119.   (bind-to-key "center-cursor"     "F-G")    ; insert key
  120.   (bind-to-key "mark-and-end"     "F-B")    ; end key
  121.   (bind-to-key "mark-and-home"     "F-A")    ; home key
  122.  
  123.   (bind-to-key "isearch-forward"    "^S")        ; in isearch.mut
  124.   (bind-to-key "isearch-reverse"    "^R")        ; in isearch.mut
  125.  
  126.   (bind-to-key "twiddle-left-of-dot"    "C-T")        ; in twiddle.mut
  127.   (bind-to-key "next-file"        "^XF")        ; in nextfile.mut
  128.   (bind-to-key "push-mark"        "F-9")        ; in markring.mut
  129.   (bind-to-key "push-mark"        "M-^P")        ; in markring.mut
  130.   (bind-to-key "pop-mark"        "M-P")        ; in markring.mut
  131.   (bind-to-key "scroll-up"        "M-Z")
  132.   (bind-to-key "scroll-down"        "C-Z")
  133.   (bind-to-key "visit-a-file"        "^X^V")
  134.   (bind-to-key "re-query-replace"    "M-^Q")
  135.   (bind-to-key "re-search-forward"    "M-S")
  136.   (bind-to-key "re-search-reverse"    "M-R")
  137.   (bind-to-key "delete-current-window"    "^X0")
  138.   (bind-to-key "list-buffers"        "^X^B")        ; in bstats.mut
  139.   (bind-to-key "show-buffer-stats"    "^X=")        ; in bstats.mut
  140.  
  141.   (arg-prefix 1)(load "mext")        ; load local ME extensions
  142.  
  143.   (msg "init file loaded")
  144.  
  145.   (update)
  146.   (next-file)(kill-buffer "*scratch*")
  147. })
  148.