forked from lisdude/rmoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrmoo-mail.el
59 lines (50 loc) · 1.7 KB
/
rmoo-mail.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;rmoo-mail.el
;;
;; Original Author: Ron Tapia <[email protected]>
;; Revised by: mattcamp
(require 'rmoo)
(provide 'rmoo-mail)
(defvar rmoo-mail-command "@qsend"
"Command to use to upload mail to a MOO.")
(make-variable-buffer-local 'rmoo-mail-command)
(defvar rmoo-mail-use-new-frame nil
"If non-nil, create a new frame for mailing.")
(defvar rmoo-mail-mode-hooks nil "Hooks to run whenever MOO Mail mode
starts up in a buffer.")
;;(defvar rmoo-mail-mode-map (make-sparse-keymap))
(defvar rmoo-mail-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\^c\^s" 'rmoo-upload-buffer-directly)
map))
(define-key rmoo-interactive-mode-map "\^c\^m" 'rmoo-mail)
(provide 'rmoo-mail)
(defun rmoo-mail (to subject)
(interactive (list (read-string "To: ")
(read-string "Subject: ")))
(let ((buf (get-buffer-create (generate-new-buffer-name
(concat "*Mail to: " to " *"))))
(world rmoo-world-here)
(command rmoo-mail-command)
frame)
(set-buffer buf)
(setq rmoo-world-here world)
(rmoo-mail-mode)
(goto-char (point-min))
(setq rmoo-mail-command command)
(insert-before-markers (concat command
" \"" to "\"\n"
subject "\n"
"\n."))
(backward-char 2)
(if rmoo-mail-use-new-frame
(make-frame)
(switch-to-buffer-other-window (current-buffer)))))
(defun rmoo-mail-send-buffer ()
(interactive)
(rmoo-send-here (concat rmoo-mail-command "\n" (buffer-string))))
(defun rmoo-mail-mode ()
(interactive)
(setq mode-name (concat "RMOOMail@" (symbol-name rmoo-world-here)))
(setq major-mode 'rmoo-mail-mode)
(use-local-map rmoo-mail-mode-map)
(run-hooks 'rmoo-mail-mode-hooks))