RE: Some questions concerning buffers
"Clementson, Bill" <[email protected]> Fri, 23 May 2003 10:03:07 -0600
| Newsgroups | gmane.lisp.ilisp.general |
|---|---|
| Message-ID | <[email protected]> |
From: Nicolas Neuss on Friday, May 23, 2003 7:41 AM > Rolf Wester <[email protected]> writes: >=20 > > 2. When I define the function > >=20 > > (defun test () > > (loop for i from 0 to 99 do > > (loop for j from 0 below 3000 do (* j i)) do > > (print i) (force-output *standard-output*))) >=20 > I had the same problem and do not quite understand the=20 > solution you give on c.l.l. involving=20 > ilisp-*use-fsf-compliant-keybindings*. Do you mean to use=20 > the "-and-go" versions of evaluation and compilation=20 > functions? This works, but what if I want to remain in my=20 > sourc code window? In this case, the setting of the=20 > fsf-keybindings does not matter for me. >=20 > I have an ugly solution which is to define a keyboard macro=20 > consisting of (eval-and-go & jumping back). If nobody posts=20 > a better solution I'll probably turn this into a function and=20 > set it to some key. I'm not sure if I understand the problem exactly, so the following may not be what you two want. I think you want to be able to evaluate an sexp in a lisp source code buffer and have the output go to the listener buffer without leaving the source buffer - is that correct? If so, the following code may do what you want. It's a quick hack, so please don't look too closely at the code :). (defun copy-eval-last-sexp (arg) "Evaluate the last s-expression in the source buffer in the Lisp listener." (interactive "p") (let ((end (point)) (beg (save-excursion (backward-list 1) (point))) (edit-buffer (current-buffer))) (cond ((and (member* ilisp-buffer (buffer-list) :key #'buffer-name :test #'equal) (get-buffer-process (get-buffer ilisp-buffer))) (switch-to-buffer ilisp-buffer) (end-of-buffer) (switch-to-buffer edit-buffer) (append-to-buffer ilisp-buffer beg end) (switch-to-buffer ilisp-buffer) (return-ilisp) (switch-to-buffer ilisp-buffer) (switch-to-buffer edit-buffer))))) (global-set-key [f9] 'copy-eval-last-sexp) Evaluate the function and set it to a key (in this example, I've globally set it to F9). Start up ilisp and open your test file. Put the cursor after the (run 2000) expression in the source file and press F9 (or whatever key you set it to). The output should go directly to the ilisp listener buffer while you continue to edit the source file. Hope that helps. -- Bill Clementson ------------------------------------------------------- This SF.net email is sponsored by: ObjectStore. If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge