emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/tooltip.el,v


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/lisp/tooltip.el,v
Date: Wed, 09 Apr 2008 09:34:06 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jan Djärv <jhd>        08/04/09 09:34:06

Index: tooltip.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tooltip.el,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- tooltip.el  8 Jan 2008 20:44:54 -0000       1.82
+++ tooltip.el  9 Apr 2008 09:34:06 -0000       1.83
@@ -67,7 +67,7 @@
       (remove-hook 'pre-command-hook 'tooltip-hide))
     (remove-hook 'tooltip-hook 'tooltip-help-tips))
   (setq show-help-function
-       (if tooltip-mode 'tooltip-show-help nil)))
+       (if tooltip-mode 'tooltip-show-help 'tooltip-show-help-non-mode)))
 
 
 ;;; Customizable settings
@@ -228,7 +228,7 @@
 Optional second arg USE-ECHO-AREA non-nil means to show tooltip
 in echo area."
   (if use-echo-area
-      (message "%s" text)
+      (tooltip-show-help-non-mode text)
     (condition-case error
        (let ((params (copy-sequence tooltip-frame-parameters))
              (fg (face-attribute 'tooltip :foreground))
@@ -316,6 +316,22 @@
 (defvar tooltip-help-message nil
   "The last help message received via `tooltip-show-help'.")
 
+(defun tooltip-trunc-str (str maxlen pieces)
+  (let ((s (car pieces)))
+    (if (and pieces (< (+ (length str) (length s) 2) maxlen))
+      (tooltip-trunc-str (concat str 
+                                (if (> (length str) 0) ", "  "") 
+                                s)
+                        maxlen (cdr pieces))
+      (if (> (length str) 0) str s))))
+
+(defun tooltip-show-help-non-mode (msg)
+  "Function installed as `show-help-function' when tooltip is off."
+  (message "%s" (if msg
+                   (tooltip-trunc-str "" (frame-parameter nil 'width)
+                                      (split-string msg "\n" t))
+                 "")))
+
 (defun tooltip-show-help (msg)
   "Function installed as `show-help-function'.
 MSG is either a help string to display, or nil to cancel the display."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]