changeset 94231:c0d59c1fcc51

(gdb-locals-header): New variable. (gdb-locals-mode, gdb-registers-mode): Use it for header line.
author Nick Roberts <nickrob@snap.net.nz>
date Tue, 22 Apr 2008 05:57:37 +0000
parents 7579b6f924c3
children 4eab57a07eab
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 38 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Tue Apr 22 05:57:00 2008 +0000
+++ b/lisp/progmodes/gdb-ui.el	Tue Apr 22 05:57:37 2008 +0000
@@ -196,8 +196,7 @@
 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
 
 (defvar gdb-locals-font-lock-keywords-1
-  '(
-    ;; var = (struct struct_tag) value
+  '(;; var = (struct struct_tag) value
     ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
       (1 font-lock-variable-name-face)
       (3 font-lock-keyword-face)
@@ -208,17 +207,14 @@
       (3 font-lock-type-face))
     ;; var = val
     ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
-      (1 font-lock-variable-name-face))
-    )
+      (1 font-lock-variable-name-face)))
   "Font lock keywords used in `gdb-local-mode'.")
 
 (defvar gdb-locals-font-lock-keywords-2
-  '(
-    ;; var = type value
+  '(;; var = type value
     ( "\\(^\\(\\sw\\|[_.]\\)+\\)\t+\\(\\(\\sw\\|[_.]\\)+\\)"
       (1 font-lock-variable-name-face)
-      (3 font-lock-type-face))
-    )
+      (3 font-lock-type-face)))
   "Font lock keywords used in `gdb-local-mode'.")
 
 ;; Variables for GDB 6.4+
@@ -2553,6 +2549,37 @@
     (define-key map "q" 'kill-this-buffer)
      map))
 
+(defvar gdb-locals-header
+ `(,(propertize "Locals"
+		'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-locals-buffer))
+		     (set-window-dedicated-p (selected-window) t)))))
+   " "
+   ,(propertize "Registers"
+		'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-registers-buffer))
+		     (set-window-dedicated-p (selected-window) t)))))))
+
 (defun gdb-registers-mode ()
   "Major mode for gdb registers.
 
@@ -2560,6 +2587,7 @@
   (kill-all-local-variables)
   (setq major-mode 'gdb-registers-mode)
   (setq mode-name "Registers")
+  (setq header-line-format gdb-locals-header)
   (setq buffer-read-only t)
   (gdb-thread-identification)
   (use-local-map gdb-registers-mode-map)
@@ -2985,9 +3013,10 @@
   (kill-all-local-variables)
   (setq major-mode 'gdb-locals-mode)
   (setq mode-name (concat "Locals:" gdb-selected-frame))
+  (use-local-map gdb-locals-mode-map)
   (setq buffer-read-only t)
+  (setq header-line-format gdb-locals-header)
   (gdb-thread-identification)
-  (use-local-map gdb-locals-mode-map)
   (set (make-local-variable 'font-lock-defaults)
        '(gdb-locals-font-lock-keywords))
   (run-mode-hooks 'gdb-locals-mode-hook)