changeset 33140:61f4c87b845c

(tooltip-gud-tips-setup): New function. (tooltip-gud-tips-p): Add :set to call tooltip-gud-tips-setup. (tooltip-mode): Call tooltip-gud-tips-setup. (tooltip-gud-tips): Use `gud-basic-call' instead of process-send-string, so the prompt gets frobbed appropriately. Handle nil return value from `tooltip-gud-print-command'.
author Miles Bader <miles@gnu.org>
date Thu, 02 Nov 2000 04:28:01 +0000
parents 1e844cbdaf3e
children 66b0773e0877
files lisp/tooltip.el
diffstat 1 files changed, 25 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tooltip.el	Thu Nov 02 02:29:18 2000 +0000
+++ b/lisp/tooltip.el	Thu Nov 02 04:28:01 2000 +0000
@@ -1,6 +1,6 @@
 ;;; tooltip.el --- Show tooltip windows
 
-;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <gerd@acm.org>
 ;; Keywords: help c mouse tools
@@ -93,6 +93,9 @@
   "*Non-nil means show tooltips in GUD sessions."
   :type 'boolean
   :tag "GUD"
+  :set #'(lambda (symbol on)
+	   (setq tooltip-gud-tips-p on)
+	   (if on (tooltip-gud-tips-setup)))
   :group 'tooltip)
 
 
@@ -184,20 +187,22 @@
     ;; `ignore' is the default binding for mouse movements.
     (define-key global-map [mouse-movement]
       (if on 'tooltip-mouse-motion 'ignore))
-    (when (and on tooltip-gud-tips-p)
-      (global-set-key [S-mouse-3] 'tooltip-gud-toggle-dereference)
-      (add-hook 'gdb-mode-hook
-		#'(lambda () (setq tooltip-gud-debugger 'gdb)))
-      (add-hook 'sdb-mode-hook
-		#'(lambda () (setq tooltip-gud-debugger 'sdb)))
-      (add-hook 'dbx-mode-hook
-		#'(lambda () (setq tooltip-gud-debugger 'dbx)))
-      (add-hook 'xdb-mode-hook
-		#'(lambda () (setq tooltip-gud-debugger 'xdb)))
-      (add-hook 'perldb-mode-hook
-		#'(lambda () (setq tooltip-gud-debugger 'perldb))))))
+    (tooltip-gud-tips-setup)))
 
-
+(defun tooltip-gud-tips-setup ()
+  "Setup debugger mode-hooks for tooltips."
+  (when (and tooltip-mode tooltip-gud-tips-p)
+    (global-set-key [S-mouse-3] 'tooltip-gud-toggle-dereference)
+    (add-hook 'gdb-mode-hook
+	      #'(lambda () (setq tooltip-gud-debugger 'gdb)))
+    (add-hook 'sdb-mode-hook
+	      #'(lambda () (setq tooltip-gud-debugger 'sdb)))
+    (add-hook 'dbx-mode-hook
+	      #'(lambda () (setq tooltip-gud-debugger 'dbx)))
+    (add-hook 'xdb-mode-hook
+	      #'(lambda () (setq tooltip-gud-debugger 'xdb)))
+    (add-hook 'perldb-mode-hook
+	      #'(lambda () (setq tooltip-gud-debugger 'perldb)))))
 
 ;;; Timeout for tooltip display
 
@@ -416,12 +421,12 @@
 		      (eval (cons 'and tooltip-gud-display))))
       (let ((expr (tooltip-expr-to-print event)))
 	(when expr
-	  (setq tooltip-gud-original-filter (process-filter process))
-	  (set-process-filter process 'tooltip-gud-process-output)
-	  (process-send-string
-	   process (concat (tooltip-gud-print-command expr) "\n"))
-	  expr)))))
-
+	  (let ((cmd (tooltip-gud-print-command expr)))
+	    (unless (null cmd)	       ; CMD can be nil if unknown debugger
+	      (setq tooltip-gud-original-filter (process-filter process))
+	      (set-process-filter process 'tooltip-gud-process-output)
+	      (gud-basic-call cmd)
+	      expr)))))))
 
 
 ;;; Tooltip help.