aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2008-04-09 09:34:16 +0000
committerJan Djärv2008-04-09 09:34:16 +0000
commit14c0a34db0216423c493349efd9079e968586ef5 (patch)
tree70a89a5e4ee5f160eab11133ce0dbc4b217a0ad8
parent96bdb5cf192adcda434b2ca1d45abd18dd037137 (diff)
downloademacs-14c0a34db0216423c493349efd9079e968586ef5.tar.gz
emacs-14c0a34db0216423c493349efd9079e968586ef5.zip
(tooltip-mode): Set tooltip-show-help-non-mode as
show-help-function when turning tooltip off. (tooltip-show): Call tooltip-show-help-non-mode if use-echo-area. (tooltip-trunc-str, tooltip-show-help-non-mode): New.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/tooltip.el20
2 files changed, 25 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 55bac7a63bf..8a2a05d8cfd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-04-09 Jan Djärv <jan.h.d@swipnet.se>
2
3 * tooltip.el (tooltip-mode): Set tooltip-show-help-non-mode as
4 show-help-function when turning tooltip off.
5 (tooltip-show): Call tooltip-show-help-non-mode if use-echo-area.
6 (tooltip-trunc-str, tooltip-show-help-non-mode): New.
7
12008-04-09 Alan Mackenzie <acm@muc.de> 82008-04-09 Alan Mackenzie <acm@muc.de>
2 9
3 * font-lock.el (font-lock-extend-after-change-region-function): 10 * font-lock.el (font-lock-extend-after-change-region-function):
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 253ce48e8ec..bfbedcf0c13 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -67,7 +67,7 @@ the help text in the echo area, and does not make a pop-up window."
67 (remove-hook 'pre-command-hook 'tooltip-hide)) 67 (remove-hook 'pre-command-hook 'tooltip-hide))
68 (remove-hook 'tooltip-hook 'tooltip-help-tips)) 68 (remove-hook 'tooltip-hook 'tooltip-help-tips))
69 (setq show-help-function 69 (setq show-help-function
70 (if tooltip-mode 'tooltip-show-help nil))) 70 (if tooltip-mode 'tooltip-show-help 'tooltip-show-help-non-mode)))
71 71
72 72
73;;; Customizable settings 73;;; Customizable settings
@@ -228,7 +228,7 @@ position.
228Optional second arg USE-ECHO-AREA non-nil means to show tooltip 228Optional second arg USE-ECHO-AREA non-nil means to show tooltip
229in echo area." 229in echo area."
230 (if use-echo-area 230 (if use-echo-area
231 (message "%s" text) 231 (tooltip-show-help-non-mode text)
232 (condition-case error 232 (condition-case error
233 (let ((params (copy-sequence tooltip-frame-parameters)) 233 (let ((params (copy-sequence tooltip-frame-parameters))
234 (fg (face-attribute 'tooltip :foreground)) 234 (fg (face-attribute 'tooltip :foreground))
@@ -316,6 +316,22 @@ the buffer of PROCESS."
316(defvar tooltip-help-message nil 316(defvar tooltip-help-message nil
317 "The last help message received via `tooltip-show-help'.") 317 "The last help message received via `tooltip-show-help'.")
318 318
319(defun tooltip-trunc-str (str maxlen pieces)
320 (let ((s (car pieces)))
321 (if (and pieces (< (+ (length str) (length s) 2) maxlen))
322 (tooltip-trunc-str (concat str
323 (if (> (length str) 0) ", " "")
324 s)
325 maxlen (cdr pieces))
326 (if (> (length str) 0) str s))))
327
328(defun tooltip-show-help-non-mode (msg)
329 "Function installed as `show-help-function' when tooltip is off."
330 (message "%s" (if msg
331 (tooltip-trunc-str "" (frame-parameter nil 'width)
332 (split-string msg "\n" t))
333 "")))
334
319(defun tooltip-show-help (msg) 335(defun tooltip-show-help (msg)
320 "Function installed as `show-help-function'. 336 "Function installed as `show-help-function'.
321MSG is either a help string to display, or nil to cancel the display." 337MSG is either a help string to display, or nil to cancel the display."