(insert (propertize lirc-prompt-string
'face 'lirc-prompt
'read-only t
- 'rear-nonsticky t))))))
+ 'rear-nonsticky t))))
+ (set-marker-insertion-type lirc-input-marker nil)))
(defvar lirc-prompt-marker nil
"Marker for prompt position in LIRC buffer.")
(lirc-display-string (lirc-msg->string msg))))))
+;;; Command entering
+;;
+
+(defun lirc-enter-string (string)
+ (cond ((string-prefix-p "/" string)
+ (let ((cmd-str (substring string 1)))
+ (lirc-send-msg (lirc-msg nil nil cmd-str))))
+ (t
+ (error "Unknown command" string))))
+
+(defun lirc-enter ()
+ "Enter current contents of line after prompt."
+ (interactive)
+ (with-current-buffer "*lirc*"
+ (lirc-enter-string
+ (buffer-substring lirc-input-marker (point-max)))))
+
+
;;; Mode
;;
(defvar lirc-mode-map
(let ((map (make-sparse-keymap)))
+ (define-key map (kbd "RET") 'lirc-enter)
map))
(define-derived-mode lirc-mode text-mode "lirc"