]> gitweb.factorcode.org Git - factor.git/commitdiff
FUEL: New option to make listener's prompt non-readonly.
authorJose A. Ortega Ruiz <jao@gnu.org>
Sat, 31 Jul 2010 18:04:00 +0000 (20:04 +0200)
committerJose A. Ortega Ruiz <jao@gnu.org>
Sat, 31 Jul 2010 18:11:36 +0000 (20:11 +0200)
By setting fuel-listener-prompt-read-only-p to nil, you'll be able to
delete (portions of) the prompt in the listener. This doesn't have
much value by itself, except that, moreover, a non-read-only prompt
makes some i/o operations work. E.g.:

 "input x:" print flush readln

will work with the new variable set to nil.

misc/fuel/fuel-listener.el

index 485d97e81f7761b91a45876f93fc634358ad1626..e4dbc3fc9e2e81d0c2b22bd3ec306ce90e9824b4 100644 (file)
@@ -1,6 +1,6 @@
 ;;; fuel-listener.el --- starting the fuel listener
 
-;; Copyright (C) 2008, 2009  Jose Antonio Ortega Ruiz
+;; Copyright (C) 2008, 2009, 2010  Jose Antonio Ortega Ruiz
 ;; See http://factorcode.org/license.txt for BSD license.
 
 ;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
@@ -69,6 +69,11 @@ buffer."
   :type 'integer
   :group 'fuel-listener)
 
+(defcustom fuel-listener-prompt-read-only-p t
+  "Whether listener's prompt should be read-only."
+  :type 'boolean
+  :group 'fuel-listener)
+
 \f
 ;;; Listener history:
 
@@ -82,11 +87,14 @@ buffer."
           (insert "Press C-cz to bring me back.\n" ))))))
 
 (defun fuel-listener--history-setup ()
-  (set (make-local-variable 'comint-input-ring-file-name) fuel-listener-history-filename)
-  (set (make-local-variable 'comint-input-ring-size) fuel-listener-history-size)
+  (set (make-local-variable 'comint-input-ring-file-name)
+       fuel-listener-history-filename)
+  (set (make-local-variable 'comint-input-ring-size)
+       fuel-listener-history-size)
   (add-hook 'kill-buffer-hook 'comint-write-input-ring nil t)
   (comint-read-input-ring t)
-  (set-process-sentinel (get-buffer-process (current-buffer)) 'fuel-listener--sentinel))
+  (set-process-sentinel (get-buffer-process (current-buffer))
+                        'fuel-listener--sentinel))
 
 \f
 ;;; Fuel listener buffer/process:
@@ -236,7 +244,8 @@ the vocabulary name."
 \\{fuel-listener-mode-map}"
   (set (make-local-variable 'comint-prompt-regexp) fuel-con--prompt-regex)
   (set (make-local-variable 'comint-use-prompt-regexp) t)
-  (set (make-local-variable 'comint-prompt-read-only) t)
+  (set (make-local-variable 'comint-prompt-read-only)
+       fuel-listener-prompt-read-only-p)
   (fuel-listener--setup-completion)
   (fuel-listener--setup-stack-mode))