[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
issue with gdb-mi.el and Guile
From: |
David Boles |
Subject: |
issue with gdb-mi.el and Guile |
Date: |
Thu, 1 Jun 2017 20:37:46 -0500 |
When using the guile command at the gdb prompt within emacs, it is easy to end
up in a state in which the behavior of repeating the previous gdb command when
hitting return is disabled. Basically, the gdb-send function in gdb-mi.el
thinks that if you’ve entered “guile” at the gdb command prompt, then you must
be in guile mode until it sees you enter a “,q”, “,quit”, or “end”.
Most of the time I use the guile control command to execute single Guile
expressions (otherwise, I’d enter the guile repl). The patch below modifies
this behavior in gdb-mi.el. I am decidedly not a “real Emacs Lisp” developer so
there may well be a better/cleaner way to accomplish the same task.
Nevertheless, this patch greatly improves the experience of using Guile within
gdb within Emacs. The diff below is against a fresh tree a few days old.
Thanks,
- db
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 1af520d..438fb75 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1778,6 +1778,9 @@ static char *magick[] = {
As long as GDB is in the recursive reading loop, it does not expect
commands to be prefixed by \"-interpreter-exec console\".")
+(defvar gdb-guile-command-non-empty-regexp
"^[[:blank:]]*\\(guile\\)\\([[:blank:]]+[[:graph:]].*\\)$"
+ "Regexp matching a non-empty GDB guile command.")
+
(defun gdb-strip-string-backslash (string)
(replace-regexp-in-string "\\\\$" "" string))
@@ -1831,7 +1834,8 @@ commands to be prefixed by \"-interpreter-exec
console\".")
(> gdb-control-level 0))
(setq gdb-control-level (1- gdb-control-level)))
(setq gdb-continuation nil)))
- (if (string-match gdb-control-commands-regexp string)
+ (if (and (string-match gdb-control-commands-regexp string)
+ (not (string-match gdb-guile-command-non-empty-regexp string)))
(setq gdb-control-level (1+ gdb-control-level))))
(defun gdb-mi-quote (string)
- issue with gdb-mi.el and Guile,
David Boles <=