emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/gdb-ui.el,v


From: Nick Roberts
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/gdb-ui.el,v
Date: Wed, 07 Feb 2007 21:57:04 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Nick Roberts <nickrob>  07/02/07 21:57:04

Index: gdb-ui.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/gdb-ui.el,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -b -r1.203 -r1.204
--- gdb-ui.el   7 Feb 2007 21:12:52 -0000       1.203
+++ gdb-ui.el   7 Feb 2007 21:57:04 -0000       1.204
@@ -606,6 +606,16 @@
     (setq gdb-version "6.4+"))
   (gdb-init-2))
 
+(defmacro gdb-if-arrow (arrow-position &rest body)
+  `(if ,arrow-position
+      (let ((buffer (marker-buffer ,arrow-position)) (line))
+       (if (equal buffer (window-buffer (posn-window end)))
+           (with-current-buffer buffer
+             (when (or (equal start end)
+                       (equal (posn-point start)
+                              (marker-position ,arrow-position)))
+               ,@body))))))
+
 (defun gdb-mouse-until (event)
   "Continue running until a source line past the current line.
 The destination source line can be selected either by clicking with mouse-2
@@ -613,28 +623,14 @@
   (interactive "e")
   (let ((start (event-start event))
        (end (event-end event)))
-    (if gud-overlay-arrow-position
-       (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line))
-         (if (equal buffer (window-buffer (posn-window end)))
-             (with-current-buffer buffer
-               (when (or (equal start end)
-                         (equal (posn-point start)
-                                (marker-position
-                                 gud-overlay-arrow-position)))
+    (gdb-if-arrow gud-overlay-arrow-position
                  (setq line (line-number-at-pos (posn-point end)))
-                 (gud-call (concat "until " (number-to-string line))))))))
-    (if gdb-overlay-arrow-position
-    (let ((buffer (marker-buffer gdb-overlay-arrow-position)))
-      (if (equal buffer (window-buffer (posn-window end)))
-         (with-current-buffer buffer
-           (when (or (equal start end)
-                     (equal (posn-point start)
-                            (marker-position
-                             gdb-overlay-arrow-position)))
+                 (gud-call (concat "until " (number-to-string line))))
+    (gdb-if-arrow gdb-overlay-arrow-position
              (save-excursion
                (goto-line (line-number-at-pos (posn-point end)))
                (forward-char 2)
-               (gud-call (concat "until *%a"))))))))))
+                   (gud-call (concat "until *%a"))))))
 
 (defun gdb-mouse-jump (event)
   "Set execution address/line.
@@ -645,32 +641,18 @@
   (interactive "e")
   (let ((start (event-start event))
        (end (event-end event)))
-    (if gud-overlay-arrow-position
-       (let ((buffer (marker-buffer gud-overlay-arrow-position)) (line))
-         (if (equal buffer (window-buffer (posn-window end)))
-             (with-current-buffer buffer
-               (when (or (equal start end)
-                         (equal (posn-point start)
-                                (marker-position
-                                 gud-overlay-arrow-position)))
+    (gdb-if-arrow gud-overlay-arrow-position
                  (setq line (line-number-at-pos (posn-point end)))
                  (progn
                    (gud-call (concat "tbreak " (number-to-string line)))
-                   (gud-call (concat "jump " (number-to-string line)))))))))
-    (if gdb-overlay-arrow-position
-       (let ((buffer (marker-buffer gdb-overlay-arrow-position)))
-         (if (equal buffer (window-buffer (posn-window end)))
-             (with-current-buffer buffer
-               (when (or (equal start end)
-                         (equal (posn-point start)
-                                (marker-position
-                                 gdb-overlay-arrow-position)))
+                   (gud-call (concat "jump " (number-to-string line)))))
+    (gdb-if-arrow gdb-overlay-arrow-position
                  (save-excursion
                    (goto-line (line-number-at-pos (posn-point end)))
                    (forward-char 2)
                    (progn
                      (gud-call (concat "tbreak *%a"))
-                     (gud-call (concat "jump *%a")))))))))))
+                     (gud-call (concat "jump *%a")))))))
 
 (defcustom gdb-speedbar-auto-raise nil
   "If non-nil raise speedbar every time display of watch expressions is\




reply via email to

[Prev in Thread] Current Thread [Next in Thread]