When I use
mouse-over on an Link (thanks to Tobias) it shows an Image and text. When I used
display-local-help the image disappeared (perhaps due to lack of space in the message area).
I want to start the
mouse-over with any key. Therefore I need a function name.
Not a real solution, but does do some of what you want:
(defun my/show-tooltip () (interactive) (let ((tooltip-frame-parameters '((left . 100) (top . 200))) (text (get-text-property (point) 'help-echo))) (if (stringp text) (tooltip-show text))))
What's missing to be a real solution:
help-echoproperty is not necessarily a string, it can also be a function or any expression. I expect this to be easily solvable. See the description of the
help-echoproperty in the elisp manual.
I don't know how to get graphic coordinates from a buffer position (need to put them as
I have no idea if a
displayproperty on the string is honored by
Many Thanks !! It works. I had used pos-tip-show. It also works with a button with tooltip-show. Here is the code for displaying a link with image and text. I simplified the example a bit so that it works without any additional functions. I wish you all a lot of fun! Andreas
(defun display-local-help-als-tooltip (&optional arg) "Display of the tooltip with the keyboard instead of the mouse. Template was display-local-help." (interactive "P") (let ((help (help-at-pt-kbd-string))) (if help (tooltip-show help ) (if (not arg) (tooltip-show "No indication available at this point.") )))) (defun wikipedia-tooltip (window object position) "Tooltip with image and text." (save-excursion (goto-char position) (let ((path (org-element-property :path (org-element-context)))(beg) (end) (text)(imgfile) (img) (s)) ;;Here the image should be inserted dynamically. (setq imgfile (format "x:/Temp/milk.jpg")) ; path ;; The text is actually determined by a function. (setq text "Milk is very ...") (if (file-exists-p imgfile) ;; If a picture exists, show it with the text. (progn (setq img (create-image (expand-file-name imgfile) 'imagemagick nil :width 300)) (concat (propertize " " 'display img) (format "\n%s" text))) ;; No picture available, then just show the text. text) ))) (defun wikipedia-link-face (path) '(:foreground "red" )) (org-link-set-parameters "wikipedia" :help-echo 'wikipedia-tooltip :face 'wikipedia-link-face)