forked from kmroz/rmoo
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrmoo-extras.el
75 lines (64 loc) · 2.97 KB
/
rmoo-extras.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
;; rmoo-extras.el
;;
;; Extras that really don't belong anywhere else.
;;
;; Original Author: Ron Tapia <[email protected]>
;; Revised by: mattcamp
;;
(require 'rmoo)
(require 'moocode-mode)
(require 'rmoo-objects)
(defvar rmoo-extras-verb-edit-command "@edit" "Command to use to get verb code.")
(defvar rmoo-extras-prop-edit-command "@edit" "Command to use to get a non-text property.")
(make-variable-buffer-local 'rmoo-extras-verb-edit-command)
(make-variable-buffer-local 'rmoo-extras-prop-edit-command)
;;
;; These expect to get called from buffer with a MOO process.
;;
;; Maybe they should be in the files that define the appropriate modes.
;;
(defun rmoo-extras-get-verb (verb)
(interactive (progn
(setq rmoo-objects-current-moo rmoo-world-here)
(list (completing-read
"Verb: "
'rmoo-objects-verb-completion-function))))
(comint-send-string nil (concat rmoo-extras-verb-edit-command " " verb "\n")))
(defun rmoo-extras-read-property (string)
(setq rmoo-objects-current-moo rmoo-world-here)
(completing-read
string 'rmoo-objects-property-completion-function))
(defun rmoo-extras-get-prop (prop)
"Sends a command to a MOO asking for a property.
If you're lucky, it may even display the verb code in a Text Mode buffer."
(interactive (list (rmoo-extras-read-property "Property: ")))
(comint-send-string nil (concat rmoo-extras-prop-edit-command " " prop "\n")))
(defun rmoo-@paste-kill (&optional prefix)
"Send whatever's in the kill ring to the MOO, using #8855's @paste command."
(interactive (list (if current-prefix-arg
(read-string "Prefix: " "|")
"")))
(rmoo-send-here (concat "@paste " prefix "\n" (car kill-ring) "\n.")))
;;
;; Interface to moo.el
;;
(define-key rmoo-interactive-mode-map "\^c\^v" 'rmoo-extras-get-verb)
(define-key rmoo-interactive-mode-map "\^c\^p" 'rmoo-extras-get-prop)
;;(define-key rmoo-interactive-mode-map "\^c\^p" 'rmoo-@paste-kill)
;;(define-key rmoo-interactive-mode-map "\^c\^t" 'rmoo-extras-get-text-prop)
;;(define-key rmoo-interactive-mode-map "\^c\^j" 'rmoo-extras-get-jtext)
;;(defun rmoo-extras-get-jtext (prop)
;; "Sends a command to a MOO asking for a property that is a list.
;;If you're lucky, it may even display the verb code in a MOO List Mode buffer."
;; (interactive (list (rmoo-extras-read-property "JDocument: ")))
;; (send-string nil (concat rmoo-extras-jtext-edit-command " " prop "\n")))
;;(defun rmoo-extras-get-text-prop (prop)
;; "Sends a command to a MOO asking for a text property.
;;If you're lucky, it may even display the verb code in a MOO Text Mode buffer."
;; (interactive (list (rmoo-extras-read-property "Property: ")))
;; (send-string nil (concat rmoo-extras-text-edit-command " " prop "\n")))
;;
;;(defvar rmoo-extras-text-edit-command "@edit" "Command to use to get text properties.")
;;(defvar rmoo-extras-jtext-edit-command "" "Command to use to get a jtext property.")
;;(make-variable-buffer-local 'rmoo-extras-jtext-edit-command)
;;(make-variable-buffer-local 'rmoo-extras-text-edit-command)