comparison lisp/tooltip.el @ 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 a35cc9700ff7
children 73a360d50e18
comparison
equal deleted inserted replaced
33139:1e844cbdaf3e 33140:61f4c87b845c
1 ;;; tooltip.el --- Show tooltip windows 1 ;;; tooltip.el --- Show tooltip windows
2 2
3 ;; Copyright (C) 1997, 1999 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
4 4
5 ;; Author: Gerd Moellmann <gerd@acm.org> 5 ;; Author: Gerd Moellmann <gerd@acm.org>
6 ;; Keywords: help c mouse tools 6 ;; Keywords: help c mouse tools
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
91 91
92 (defcustom tooltip-gud-tips-p nil 92 (defcustom tooltip-gud-tips-p nil
93 "*Non-nil means show tooltips in GUD sessions." 93 "*Non-nil means show tooltips in GUD sessions."
94 :type 'boolean 94 :type 'boolean
95 :tag "GUD" 95 :tag "GUD"
96 :set #'(lambda (symbol on)
97 (setq tooltip-gud-tips-p on)
98 (if on (tooltip-gud-tips-setup)))
96 :group 'tooltip) 99 :group 'tooltip)
97 100
98 101
99 (defcustom tooltip-gud-modes '(gud-mode c-mode c++-mode) 102 (defcustom tooltip-gud-modes '(gud-mode c-mode c++-mode)
100 "List of modes for which to enable GUD tips." 103 "List of modes for which to enable GUD tips."
182 (funcall hook-fn 'tooltip-hook 'tooltip-help-tips) 185 (funcall hook-fn 'tooltip-hook 'tooltip-help-tips)
183 (setq show-help-function (if on 'tooltip-show-help-function nil)) 186 (setq show-help-function (if on 'tooltip-show-help-function nil))
184 ;; `ignore' is the default binding for mouse movements. 187 ;; `ignore' is the default binding for mouse movements.
185 (define-key global-map [mouse-movement] 188 (define-key global-map [mouse-movement]
186 (if on 'tooltip-mouse-motion 'ignore)) 189 (if on 'tooltip-mouse-motion 'ignore))
187 (when (and on tooltip-gud-tips-p) 190 (tooltip-gud-tips-setup)))
188 (global-set-key [S-mouse-3] 'tooltip-gud-toggle-dereference) 191
189 (add-hook 'gdb-mode-hook 192 (defun tooltip-gud-tips-setup ()
190 #'(lambda () (setq tooltip-gud-debugger 'gdb))) 193 "Setup debugger mode-hooks for tooltips."
191 (add-hook 'sdb-mode-hook 194 (when (and tooltip-mode tooltip-gud-tips-p)
192 #'(lambda () (setq tooltip-gud-debugger 'sdb))) 195 (global-set-key [S-mouse-3] 'tooltip-gud-toggle-dereference)
193 (add-hook 'dbx-mode-hook 196 (add-hook 'gdb-mode-hook
194 #'(lambda () (setq tooltip-gud-debugger 'dbx))) 197 #'(lambda () (setq tooltip-gud-debugger 'gdb)))
195 (add-hook 'xdb-mode-hook 198 (add-hook 'sdb-mode-hook
196 #'(lambda () (setq tooltip-gud-debugger 'xdb))) 199 #'(lambda () (setq tooltip-gud-debugger 'sdb)))
197 (add-hook 'perldb-mode-hook 200 (add-hook 'dbx-mode-hook
198 #'(lambda () (setq tooltip-gud-debugger 'perldb)))))) 201 #'(lambda () (setq tooltip-gud-debugger 'dbx)))
199 202 (add-hook 'xdb-mode-hook
200 203 #'(lambda () (setq tooltip-gud-debugger 'xdb)))
204 (add-hook 'perldb-mode-hook
205 #'(lambda () (setq tooltip-gud-debugger 'perldb)))))
201 206
202 ;;; Timeout for tooltip display 207 ;;; Timeout for tooltip display
203 208
204 (defun tooltip-delay () 209 (defun tooltip-delay ()
205 "Return the delay in seconds for the next tooltip." 210 "Return the delay in seconds for the next tooltip."
414 (posn-point (event-end event)) 419 (posn-point (event-end event))
415 (progn (setq tooltip-gud-event event) 420 (progn (setq tooltip-gud-event event)
416 (eval (cons 'and tooltip-gud-display)))) 421 (eval (cons 'and tooltip-gud-display))))
417 (let ((expr (tooltip-expr-to-print event))) 422 (let ((expr (tooltip-expr-to-print event)))
418 (when expr 423 (when expr
419 (setq tooltip-gud-original-filter (process-filter process)) 424 (let ((cmd (tooltip-gud-print-command expr)))
420 (set-process-filter process 'tooltip-gud-process-output) 425 (unless (null cmd) ; CMD can be nil if unknown debugger
421 (process-send-string 426 (setq tooltip-gud-original-filter (process-filter process))
422 process (concat (tooltip-gud-print-command expr) "\n")) 427 (set-process-filter process 'tooltip-gud-process-output)
423 expr))))) 428 (gud-basic-call cmd)
424 429 expr)))))))
425 430
426 431
427 ;;; Tooltip help. 432 ;;; Tooltip help.
428 433
429 (defvar tooltip-help-message nil 434 (defvar tooltip-help-message nil