* [PATCH] Single stepping through code from Emacs
@ 2008-07-12 19:15 Neil Jerram
2008-07-15 8:02 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2008-07-12 19:15 UTC (permalink / raw
To: guile-devel, guile-user
Here is a minor enhancement to Guile's Emacs support. I'll commit in
a few days; let me know if you have any comments before that.
Neil
When you use GDS to evaluate Scheme code from Emacs, you can now use
`C-u' to indicate that you want to single step through that code. See
`Evaluating Scheme Code' in the manual for more details.
* scheme-using.texi (Evaluating Scheme Code): Document use of
`C-u' prefix with evaluation commands.
* gds-scheme.el (gds-eval-region, gds-eval-expression)
(gds-eval-defun, gds-eval-last-sexp): Support `C-u' prefix,
meaning that user wants to single step through the code.
* gds-client.scm (handle-nondebug-protocol): Add support for
setting a trap on code that is about to be evaluated.
---
NEWS | 6 ++++++
doc/ref/scheme-using.texi | 8 ++++++++
emacs/gds-scheme.el | 28 +++++++++++++++-------------
ice-9/gds-client.scm | 10 ++++++++--
4 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/NEWS b/NEWS
index 2c93494..b12cbbc 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,12 @@ Changes in 1.8.6 (since 1.8.5)
** New convenience function `scm_c_symbol_length ()'
+** Single stepping through code from Emacs
+
+When you use GDS to evaluate Scheme code from Emacs, you can now use
+`C-u' to indicate that you want to single step through that code. See
+`Evaluating Scheme Code' in the manual for more details.
+
* Bugs fixed
** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi
index 59cc0e6..a8a2568 100644
--- a/doc/ref/scheme-using.texi
+++ b/doc/ref/scheme-using.texi
@@ -842,6 +842,14 @@ region contains a balanced expression, or try to
expand the region so
that it does; it uses the region exactly as it is.
@end table
+If you type @kbd{C-u} before one of these commands, GDS will
+immediately pop up a Scheme stack buffer, showing the requested
+evaluation, so that you can single step through it. (This is achieved
+by setting a @code{<source-trap>} trap at the start of the requested
+evaluation; see @ref{Source Traps} for more on how those work.) The
+Scheme stack display, and the options for continuing through the code,
+are described in the next two sections.
+
@node Displaying the Scheme Stack
@subsection Displaying the Scheme Stack
diff --git a/emacs/gds-scheme.el b/emacs/gds-scheme.el
index bc3a20b..ed3874f 100755
--- a/emacs/gds-scheme.el
+++ b/emacs/gds-scheme.el
@@ -279,7 +279,7 @@ region's code."
(setq line (count-lines (point-min) (point))))
(cons line column)))
-(defun gds-eval-region (start end)
+(defun gds-eval-region (start end &optional debugp)
"Evaluate the current region."
(interactive "r")
(or gds-client
@@ -289,24 +289,26 @@ region's code."
(port-name (gds-port-name start end))
(lc (gds-line-and-column start)))
(let ((code (buffer-substring-no-properties start end)))
- (gds-send (format "eval (region . %S) %s %S %d %d %S"
+ (gds-send (format "eval (region . %S) %s %S %d %d %S %s"
(gds-abbreviated code)
(if module (prin1-to-string module) "#f")
port-name (car lc) (cdr lc)
- code)
+ code
+ (if debugp '(debug) '(none)))
gds-client))))
-(defun gds-eval-expression (expr &optional correlator)
+(defun gds-eval-expression (expr &optional correlator debugp)
"Evaluate the supplied EXPR (a string)."
- (interactive "sEvaluate expression: \nP")
+ (interactive "sEvaluate expression: \ni\nP")
(or gds-client
(gds-auto-associate-buffer)
(call-interactively 'gds-associate-buffer))
(set-text-properties 0 (length expr) nil expr)
- (gds-send (format "eval (%S . %S) #f \"Emacs expression\" 0 0 %S"
+ (gds-send (format "eval (%S . %S) #f \"Emacs expression\" 0 0 %S %s"
(or correlator 'expression)
(gds-abbreviated expr)
- expr)
+ expr
+ (if debugp '(debug) '(none)))
gds-client))
(defconst gds-abbreviated-length 35)
@@ -325,19 +327,19 @@ region's code."
(concat (substring code 0 (- gds-abbreviated-length 3)) "...")
code))
-(defun gds-eval-defun ()
+(defun gds-eval-defun (&optional debugp)
"Evaluate the defun (top-level form) at point."
- (interactive)
+ (interactive "P")
(save-excursion
(end-of-defun)
(let ((end (point)))
(beginning-of-defun)
- (gds-eval-region (point) end))))
+ (gds-eval-region (point) end debugp))))
-(defun gds-eval-last-sexp ()
+(defun gds-eval-last-sexp (&optional debugp)
"Evaluate the sexp before point."
- (interactive)
- (gds-eval-region (save-excursion (backward-sexp) (point)) (point)))
+ (interactive "P")
+ (gds-eval-region (save-excursion (backward-sexp) (point)) (point) debugp))
;;;; Help.
diff --git a/ice-9/gds-client.scm b/ice-9/gds-client.scm
index 4db4f82..960015a 100755
--- a/ice-9/gds-client.scm
+++ b/ice-9/gds-client.scm
@@ -352,7 +352,7 @@ Thanks!\n\n"
((eval)
(set! last-lazy-trap-context #f)
- (apply (lambda (correlator module port-name line column code)
+ (apply (lambda (correlator module port-name line column code flags)
(with-input-from-string code
(lambda ()
(set-port-filename! (current-input-port) port-name)
@@ -380,7 +380,13 @@ Thanks!\n\n"
(+ n 1))))
;; Another complete expression read; add
;; it to the list.
- (loop (cons x exprs) (read)))))
+ (begin
+ (if (and (pair? x)
+ (memq 'debug flags))
+ (install-trap (make <source-trap>
+ #:expression x
+ #:behaviour gds-debug-trap)))
+ (loop (cons x exprs) (read))))))
(lambda (key . args)
(write-form `(eval-results
,correlator
--
1.4.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Single stepping through code from Emacs
2008-07-12 19:15 [PATCH] Single stepping through code from Emacs Neil Jerram
@ 2008-07-15 8:02 ` Ludovic Courtès
2008-07-15 15:19 ` LTDL path problems guile 1.8.5 Roland Orre
2008-07-17 21:46 ` [PATCH] Single stepping through code from Emacs Neil Jerram
0 siblings, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2008-07-15 8:02 UTC (permalink / raw
To: guile-user; +Cc: guile-devel
Hi,
"Neil Jerram" <neiljerram@googlemail.com> writes:
> Here is a minor enhancement to Guile's Emacs support. I'll commit in
> a few days; let me know if you have any comments before that.
Looks very nice!
Thanks,
Ludo'.
^ permalink raw reply [flat|nested] 5+ messages in thread
* LTDL path problems guile 1.8.5
2008-07-15 8:02 ` Ludovic Courtès
@ 2008-07-15 15:19 ` Roland Orre
2008-07-15 15:54 ` Ludovic Courtès
2008-07-17 21:46 ` [PATCH] Single stepping through code from Emacs Neil Jerram
1 sibling, 1 reply; 5+ messages in thread
From: Roland Orre @ 2008-07-15 15:19 UTC (permalink / raw
To: guile-user
I finally see the only way out of my 64-bits problems to upgrade to 1.8
The problem, configure fails in the test for ltdl
I downloaded libtool-2.2.4, which seemed to be the latest
from http://www.gnu.org/software/libtool/
I installed it under the guile directory so
that the libltdl/lib/ is first in LD_LIBRARY_PATH and
libltdl/bin is first in PATH
but configure fails on
checking for lt_dlinit in -lltdl...
test ${ac_cv_lib_ltdl_lt_dlinit+set} = set
configure: error: libltdl not found. See README.
The README was not very helpful on this issue and
I can not find where the
ac_cv_lib_ltdl_lt_dlinit+set
would possibly be set, I don't even understand what
the syntax ${ac_cv_lib_ltdl_lt_dlinit+set} means
I also tried with a git snapshot, but when running
./autogen.sh it needs a utility named gnulib-tool which
is referenced at several places on the web, but not found
anywhere. Is this the same as above libtool so I'm
expected to make a link from libtool to gnulib-tool ?
Best regards
Roland
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: LTDL path problems guile 1.8.5
2008-07-15 15:19 ` LTDL path problems guile 1.8.5 Roland Orre
@ 2008-07-15 15:54 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2008-07-15 15:54 UTC (permalink / raw
To: guile-user
Hi,
Roland Orre <roland.orre@neurologic.se> writes:
> The problem, configure fails in the test for ltdl
> I downloaded libtool-2.2.4, which seemed to be the latest
> from http://www.gnu.org/software/libtool/
The 1.8.x series still depends on Libtool 1.5.26 (I'm planning to
investigate what's needed to switch to 2.2, though). Can you try that?
> I also tried with a git snapshot, but when running
> ./autogen.sh it needs a utility named gnulib-tool which
> is referenced at several places on the web, but not found
> anywhere. Is this the same as above libtool so I'm
> expected to make a link from libtool to gnulib-tool ?
`gnulib-tool', which is part of Gnulib
(http://www.gnu.org/software/gnulib/), is only needed for the 1.9
branch, which may not be what you want.
Once you have a local clone of the Git repository, you can get the 1.8.x
branch this way:
$ git branch --track branch_release-1-8 origin/branch_release-1-8
$ git checkout branch_release-1-8
Hope this helps,
Ludovic.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Single stepping through code from Emacs
2008-07-15 8:02 ` Ludovic Courtès
2008-07-15 15:19 ` LTDL path problems guile 1.8.5 Roland Orre
@ 2008-07-17 21:46 ` Neil Jerram
1 sibling, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2008-07-17 21:46 UTC (permalink / raw
To: Ludovic Courtès; +Cc: guile-user, guile-devel
2008/7/15 Ludovic Courtès <ludo@gnu.org>:
> Hi,
>
> "Neil Jerram" <neiljerram@googlemail.com> writes:
>
>> Here is a minor enhancement to Guile's Emacs support. I'll commit in
>> a few days; let me know if you have any comments before that.
>
> Looks very nice!
>
> Thanks,
> Ludo'.
Thanks, that's in now, and with ChangeLogs :-)
Neil
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-17 21:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-12 19:15 [PATCH] Single stepping through code from Emacs Neil Jerram
2008-07-15 8:02 ` Ludovic Courtès
2008-07-15 15:19 ` LTDL path problems guile 1.8.5 Roland Orre
2008-07-15 15:54 ` Ludovic Courtès
2008-07-17 21:46 ` [PATCH] Single stepping through code from Emacs Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).