changeset 94192:1ec796ca1199

(gdb-mouse-set-clear-breakpoint): Select window clicked on first (regression in 22.2). (gdb): Display thread number in mode-line. (gdb-make-header-line-mouse-map): Move to avoid byte compiler warnings. (gdb-breakpoints-header): New variable. (gdb-breakpoints-mode, gdb-threads-mode): Use it for header line.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 19 Apr 2008 22:49:32 +0000
parents 04bc9669d8d5
children 45c2732a3285
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 52 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Sat Apr 19 22:47:40 2008 +0000
+++ b/lisp/progmodes/gdb-ui.el	Sat Apr 19 22:49:32 2008 +0000
@@ -253,28 +253,16 @@
 See Info node `(emacs)GDB Graphical Interface' for a more
 detailed description of this mode.
 
-
 +----------------------------------------------------------------------+
 |                               GDB Toolbar                            |
 +-----------------------------------+----------------------------------+
-| GUD buffer (I/O of GDB)           | Locals buffer                    |
-|                                   |                                  |
-|                                   |                                  |
-|                                   |                                  |
-+-----------------------------------+----------------------------------+
-| Source buffer                     | I/O buffer (of debugged program) |
-|                                   | (comint-mode)                    |
-|                                   |                                  |
+|  GUD buffer (I/O of GDB)          |  Locals buffer                   |
+|-----------------------------------+----------------------------------+
 |                                   |                                  |
-|                                   |                                  |
-|                                   |                                  |
-|                                   |                                  |
+|  Source buffer                    |  I/O buffer for debugged program |
 |                                   |                                  |
-+-----------------------------------+----------------------------------+
-| Stack buffer                      | Breakpoints buffer               |
-| RET      gdb-frames-select        | SPC    gdb-toggle-breakpoint     |
-|                                   | RET    gdb-goto-breakpoint       |
-|                                   | D      gdb-delete-breakpoint     |
+|-----------------------------------+----------------------------------+
+|  Stack buffer                     |  Breakpoints/threads buffer      |
 +-----------------------------------+----------------------------------+
 
 To run GDB in text command mode, replace the GDB \"--annotate=3\"
@@ -334,6 +322,7 @@
   (setq gdb-flush-pending-output nil)
   (setq gdb-early-user-input nil)
   (setq gud-filter-pending-text nil)
+  (gdb-thread-identification)
   (run-hooks 'gdb-mode-hook))
 
 ;; Keep as an alias for compatibility with Emacs 22.1.
@@ -2015,9 +2004,9 @@
   (interactive "e")
   (mouse-minibuffer-check event)
   (let ((posn (event-end event)))
-    (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode))
-	(if (numberp (posn-point posn))
-	    (with-selected-window (posn-window posn)
+    (with-selected-window (posn-window posn)
+      (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode))
+	  (if (numberp (posn-point posn))
 	      (save-excursion
 		(goto-char (posn-point posn))
 		(if (or (posn-object posn)
@@ -2118,6 +2107,47 @@
   (if (one-window-p) (delete-frame)
     (delete-window)))
 
+;;from make-mode-line-mouse-map
+(defun gdb-make-header-line-mouse-map (mouse function) "\
+Return a keymap with single entry for mouse key MOUSE on the header line.
+MOUSE is defined to run function FUNCTION with no args in the buffer
+corresponding to the mode line clicked."
+  (let ((map (make-sparse-keymap)))
+    (define-key map (vector 'header-line mouse) function)
+    (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
+    map))
+
+(defvar gdb-breakpoints-header
+ `(,(propertize "Breakpoints"
+		'help-echo "mouse-1: select"
+		'mouse-face 'mode-line-highlight
+		'face 'mode-line
+		'local-map
+		(gdb-make-header-line-mouse-map
+		 'mouse-1
+		 (lambda (event) (interactive "e")
+		   (save-selected-window
+		     (select-window (posn-window (event-start event)))
+		     (set-window-dedicated-p (selected-window) nil)
+		     (switch-to-buffer
+		      (gdb-get-buffer-create 'gdb-breakpoints-buffer))
+		     (set-window-dedicated-p (selected-window) t)))))
+   " "
+   ,(propertize "Threads"
+		'help-echo "mouse-1: select"
+		'mouse-face 'mode-line-highlight
+		'face 'mode-line
+		'local-map
+		(gdb-make-header-line-mouse-map
+		 'mouse-1
+		 (lambda (event) (interactive "e")
+		   (save-selected-window
+		     (select-window (posn-window (event-start event)))
+		     (set-window-dedicated-p (selected-window) nil)
+		     (switch-to-buffer
+		      (gdb-get-buffer-create 'gdb-threads-buffer))
+		     (set-window-dedicated-p (selected-window) t)))))))
+
 (defun gdb-breakpoints-mode ()
   "Major mode for gdb breakpoints.
 
@@ -2127,6 +2157,7 @@
   (setq mode-name "Breakpoints")
   (use-local-map gdb-breakpoints-mode-map)
   (setq buffer-read-only t)
+  (setq header-line-format gdb-breakpoints-header)
   (run-mode-hooks 'gdb-breakpoints-mode-hook)
   (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
       'gdb-invalidate-breakpoints
@@ -2436,6 +2467,7 @@
   (setq major-mode 'gdb-threads-mode)
   (setq mode-name "Threads")
   (setq buffer-read-only t)
+  (setq header-line-format gdb-breakpoints-header)
   (use-local-map gdb-threads-mode-map)
   (set (make-local-variable 'font-lock-defaults)
        '(gdb-threads-font-lock-keywords))
@@ -2768,16 +2800,6 @@
 					       (vector (car selection))))))
       (if binding (call-interactively binding)))))
 
-;;from make-mode-line-mouse-map
-(defun gdb-make-header-line-mouse-map (mouse function) "\
-Return a keymap with single entry for mouse key MOUSE on the header line.
-MOUSE is defined to run function FUNCTION with no args in the buffer
-corresponding to the mode line clicked."
-  (let ((map (make-sparse-keymap)))
-    (define-key map (vector 'header-line mouse) function)
-    (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
-    map))
-
 (defvar gdb-memory-font-lock-keywords
   '(;; <__function.name+n>
     ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))