home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / mutt / package / mailmode.mut < prev    next >
Text File  |  1995-01-14  |  4KB  |  150 lines

  1. ;; mailmode.mut :  Stuff for replying to or composing mail/notes messages.
  2. ;; A super set of text mode.
  3. ;; Routines:
  4. ;;   mail-quote-region:
  5. ;;     Put a symbol infront of each line of text (ignore empty lines) in
  6. ;;     the region to indicate that somebody else wrote it.
  7. ;; C Durland    Public Domain
  8.  
  9. (const quoter "> ")        ;; what to put in front of quoted text
  10.  
  11. (include me.mh)
  12.  
  13. (small-int mail-mode-keymap)
  14.  
  15. (defun
  16.   mail-mode
  17.   {
  18.     (text-mode)
  19.     (minor-mode "Mail")
  20.  
  21.     (if (== 0 mail-mode-keymap)
  22.       {
  23.     (mail-mode-keymap (create-keymap LOCAL-KEYMAP))
  24.     (bind-key mail-mode-keymap "mail-format-quote-region" "M-`")
  25.       })
  26.     (install-keymap mail-mode-keymap LOCAL-KEYMAP)
  27.  
  28.     (if (pgm-exists "mail-mode-hook") (floc "mail-mode-hook"()))
  29.   }
  30. )
  31.  
  32. (include runblock.mut)
  33.  
  34. (defun
  35.   what-do-you-want-to-quote-with (bool ask-them) HIDDEN
  36.   {
  37.     (if ask-them
  38. ;      { (ask-user) (concat (ask "what do you want to quote with? ") quoter) }
  39.       { (ask-user) (ask "what do you want to quote with? ") }
  40.       quoter
  41.     )
  42.   }
  43.   mail-quote-region
  44.   {
  45.     (run-pgm-on-block (floc quote-a-line-of-text)
  46.     (what-do-you-want-to-quote-with (arg-flag)))
  47.   }
  48.   mail-format-quote-region
  49.   {
  50. ;    (byte type)(small-int left-edge width height)(int size)    ;; RegionInfo
  51. ;    (int mark-id)
  52. ;    (string the-quote)
  53. ;
  54. ;    (region-stats (loc type) THE-DOT THE-MARK TRUE)
  55. ;    (the-quote (what-do-you-want-to-quote-with (arg-flag)))
  56. ;
  57. ;    (set-mark (mark-id (create-mark)))
  58. ;    (adjust-lines height
  59. ;      (- (if (== 0 (word-wrap)) 72 (word-wrap)) (length-of the-quote))
  60. ;      FALSE)
  61. ;    (forward-line -1)(set-mark)
  62. ;    (goto-mark mark-id)(free-mark mark-id)
  63. ;    (run-pgm-on-block (floc quote-a-line-of-text) the-quote)
  64.  
  65.  
  66.     (byte type)(small-int left-edge width height)(int size)    ;; RegionInfo
  67.     (string the-quote)
  68.  
  69.     (region-stats (loc type) THE-DOT THE-MARK TRUE)
  70.     (the-quote (what-do-you-want-to-quote-with (arg-flag)))
  71.  
  72.     (save-point
  73.       {{    ;; args: (int height)(string the-quote)
  74.     (adjust-lines (arg 0)
  75.       (- (if (== 0 (word-wrap)) 72 (word-wrap)) (length-of (arg 1)))
  76.       FALSE)
  77.     (forward-line -1)(set-mark)
  78.       }}
  79.       height the-quote)        ;;!!!???
  80.     (run-pgm-on-block (floc quote-a-line-of-text) the-quote)
  81.   }
  82. )
  83.  
  84. ;;;;;;;;;;;;;;;;;;;;;;;;; details ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  85. (defun
  86.   quote-a-line-of-text (string quoter) HIDDEN
  87.   {
  88.     (if (looking-at '\ *$')
  89.       { (arg-prefix 1)(cut-line)(open-line) }    ;; clear blank line
  90.       (insert-text quoter))            ;; add the quote mark
  91.   }
  92. )
  93.  
  94. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  95. ;;;;;;;;;;;;;;;;;;;;;;;;;;; Talk to Mailer ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  96. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  97.  
  98. (defun
  99.   mail-region
  100.   {
  101.     (int bag)
  102.     (string to subject)
  103.  
  104.     (bag (create-bag))
  105.     (append-to-bag bag APPEND-REGION)
  106.  
  107.     (to (ask "Mail region to: "))
  108.     (subject (ask "Subject: "))
  109.  
  110.     (OS-filter (concat "mailx -s " "\"" subject "\" " to) bag)
  111.   }
  112. )
  113.  
  114. (int mail-buffer)
  115. (const COMPOSE-MAIL-BUFFER-NAME "*compose-mail*")
  116.  
  117. (defun
  118.   mail-compose
  119.   {
  120.     (int mail-window)
  121.  
  122.     (if (== -2 (mail-buffer (attached-buffer COMPOSE-MAIL-BUFFER-NAME)))
  123.       {
  124.     (mail-buffer
  125.       (create-buffer COMPOSE-MAIL-BUFFER-NAME BFHuman))
  126.     (current-buffer mail-buffer)
  127.     (mail-mode)
  128.     (insert-text "To: ^J")
  129.     (insert-text "Subject: ^J")
  130.     (insert-text "Cc: ^J")
  131.     (insert-text "Bcc: ^J")
  132.     (insert-text "")
  133.     (beginning-of-buffer)(end-of-line)
  134.       })
  135.     (current-window (mail-window (popup-buffer mail-buffer)))
  136.   }
  137. ;  mail-compose-send
  138. ;  {
  139. ;    (int bag)
  140. ;
  141. ;    (save-point
  142. ;      {{
  143. ;    (beginning-of-buffer)
  144. ;    (append-to-bag (arg 0) APPEND-CHARACTERS 99999999)
  145. ;      }} (bag (create-bag)))
  146. ;
  147. ;    (OS-filter (concat "rmail craig@cv") bag)    ;;;!!!????
  148. ;  }
  149. )
  150.