Hi Sampo,

These features are really handy - especially having the stack displayed
all the time, tres cool!

I made a couple of tweaks for my setup which might be useful to others:

- I tend to run the factor listener and stack windows in a seperate
frame to the sourcecode editing buffers. Unfortunately
'comint-redirect-send-command-to-process' keeps popping up the factor
stack buffer in my sourcecode frame, so I added the optional
'no-display' argument to stop this happening.

- I added the F8 key for 'refresh-all' to factor-mode as well as
factor-listener-mode, since it's handy to be able to refresh everything
without switching buffers (e.g. when you're sending code from the source
buffer with C-r')

Also I added functionality to save the last thing that was sent to the
listener with C-cC-r so that it can be resent with C-cC-c. I find this
handy because I often have a unittest I want to keep running until it
works, so the loop is 'fix-code, refresh, rerun-test'.
(N.B. I'm not emacs-lisp guru, so there's probably a better way to do
this than saving the text in a variable)

- I also added C-cC-l to clear the stack from the sourcecode buffers.


Out of interest, what do you use for debugging in emacs - has anybody
got a stepper running in the console listener?

Cheers,

Phil

Sampo Vuori wrote:
Hi,

the attached version adds two features I have been missing,
stack-effect hinting and stack buffer (both realtime). I hope they
won't annoy anyone as they can't be disabled at the moment.
stack-effects will be displayed in the minibuffer area and status of
stack will be in the *factor-stack* buffer. For some reason I can't
get everything to play nicely when using the mode hooks so I use
define following function in my .emacs -file and run the function when
I start a factor-session.

(defun start-factor-ide ()
  (interactive)
  (split-window-vertically)
  (other-window 1)
  (run-factor)
  (split-window-vertically))

that gives me one bigger window with the source code, two smaller ones
showing the repl and the stack.

- Sampo


------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


------------------------------------------------------------------------

_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk



--- /home/pld/tmp/factor.el	2008-02-15 07:27:18.000000000 +0000
+++ factor.el	2008-02-15 08:54:30.000000000 +0000
@@ -116,6 +116,7 @@
 (defvar factor-binary "/scratch/repos/Factor/factor")
 (defvar factor-image "/scratch/repos/Factor/factor.image")
 
+
 (defun factor-telnet-to-port (port)
   (interactive "nPort: ")
   (switch-to-buffer
@@ -134,11 +135,20 @@
   (comint-send-string "*factor*" (format "\"%s\"" (buffer-file-name)))
   (comint-send-string "*factor*" " run-file\n"))
 
+(defvar factor-last-sent nil)
+
 (defun factor-send-region (start end)
   (interactive "r")
+  (setq factor-last-sent (buffer-substring start end))
   (comint-send-region "*factor*" start end)
   (comint-send-string "*factor*" "\n"))
 
+(defun factor-resend ()
+  (interactive)
+  (comint-send-string "*factor*" factor-last-sent)
+  (comint-send-string "*factor*" "\n"))
+
+
 (defun factor-see ()
   (interactive)
   (comint-send-string "*factor*" (format "\\ %s see\n" (thing-at-point 'sexp))))
@@ -171,7 +181,7 @@
   (when (get-buffer "*factor-stack*")
     (with-current-buffer (get-buffer "*factor-stack*")
       (erase-buffer)
-      (comint-redirect-send-command-to-process ".s" "*factor-stack*" (get-process "factor") nil)
+      (comint-redirect-send-command-to-process ".s" "*factor-stack*" (get-process "factor") nil t)
       (goto-char (point-max))
 ))
   text)
@@ -181,10 +191,15 @@
   (beginning-of-line)
   (insert "! "))
 
+(defun factor-clear-stack ()
+  (interactive)
+  (comint-send-string "*factor*" "clear\n"))
+  
+
 (defun get-response-string (msg process)
   "Send msg to process and return output as a string"
   (with-temp-buffer
-    (comint-redirect-send-command-to-process msg (buffer-name) process nil)
+    (comint-redirect-send-command-to-process msg (buffer-name) process nil t)
     (accept-process-output nil 1)
     (buffer-string)))
 
@@ -203,7 +218,9 @@
 
 (define-key factor-mode-map "\C-c\C-f" 'factor-run-file)
 (define-key factor-mode-map "\C-c\C-r" 'factor-send-region)
+(define-key factor-mode-map "\C-c\C-c" 'factor-resend)
 (define-key factor-mode-map "\C-c\C-s" 'factor-see)
+(define-key factor-mode-map "\C-c\C-l" 'factor-clear-stack)
 (define-key factor-mode-map "\C-ce"    'factor-edit)
 (define-key factor-mode-map "\C-c\C-h" 'factor-help)
 (define-key factor-mode-map "\C-cc"    'comment-region)
@@ -217,6 +234,7 @@
 (define-derived-mode factor-listener-mode comint-mode "Factor Listener")
 
 (define-key factor-listener-mode-map [f8] 'factor-refresh-all)
+(define-key factor-mode-map [f8] 'factor-refresh-all)
 
 (defun run-factor ()
   (interactive)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to