[m-dev.] diff: fix Emacs mdb support

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 5 18:06:48 AEDT 2000


Estimated hours taken: 2

scripts/gud.el:
	Fix to work with Emacs 20.4.1 on Linux.
	There were several problems:
	(1) The gud-redirect-io stuff was broken, since it relies on ttys,
	    and apparently Emacs now just uses pipes rather than ttys.
	    For now I've just disabled that by setting gud-redirect-io
	    to false (nil).
	(2) There were some bugs in the code for the case where gud-redirect-io
	    was false (nil):
	    - I'd accidentally omitted the `progn' around the body of an
	      if-then-else, and thus accidentally written `if (...) A else B'
	      when I had intended to write `if (...) { A; B; }'.
	    - One part of the code was assuming that the gud-prog-buffer
	      variable was set, but this was only true for the case where
	      gud-redirect-io was true (t).

Workspace: /home/pgrad/fjh/ws/hg
Index: scripts/gud.el
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/gud.el,v
retrieving revision 1.6
diff -u -d -r1.6 gud.el
--- scripts/gud.el	2000/01/15 07:08:48	1.6
+++ scripts/gud.el	2000/12/05 07:03:37
@@ -1374,17 +1374,22 @@
   (setq gud-menu-name "MDB")
   (setq gud-buffer-name-prefix "mdb")
   (setq gud-show-commands t)
-  (setq gud-redirect-io t)
+  ;; Setting gud-redirect-io is broken in recent versions of
+  ;; GNU Emacs (e.g. 20.4.1), since Emacs apparently now uses
+  ;; pipes rather than ttys.  So we don't enable this by
+  ;; default anymore.
+  ;; (setq gud-redirect-io t)
 
   (gud-common-init command-line 'gud-mdb-massage-args
 		   'gud-mdb-marker-filter 'gud-mdb-find-file)
 
   (gud-mdb-define-menu-entries)
   (gud-mdb-add-menu-entries)
-  (save-excursion
-    (set-buffer gud-prog-buffer)
-    (display-buffer gud-prog-buffer)
-    (gud-mdb-add-menu-entries))
+  (if gud-prog-buffer
+      (save-excursion
+        (set-buffer gud-prog-buffer)
+        (display-buffer gud-prog-buffer)
+        (gud-mdb-add-menu-entries)))
 
   (setq comint-prompt-regexp "^mdb> ")
   (setq paragraph-start comint-prompt-regexp)
@@ -1593,8 +1598,9 @@
     (apply 'make-comint prog-buf-name program nil
 	   (funcall massage-args file args))
     (if gud-redirect-io
-	(setq gud-prog-buffer (concat "*" prog-buf-name "*"))
-	(set-buffer debugger-buf)))
+        (progn
+	  (setq gud-prog-buffer (concat "*" prog-buf-name "*"))
+	  (set-buffer debugger-buf))))
 
   ;; Since comint clobbered the mode, we don't set it until now.
   (gud-mode)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list