From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#43609: 28.0.50; eldoc-documentation-function [vs new eldoc-display-functions] Date: Tue, 06 Oct 2020 10:29:36 +0100 Message-ID: <87d01vem7z.fsf@gmail.com> References: <2e610c3f-6e5f-c7dd-af2e-aeb5e20d8664@gmx.at> <87r1qjjppu.fsf@gmail.com> <3fa6b315-7fc0-06ee-81e9-b68d164aec1b@gmx.at> <87a6x7jf9a.fsf@gmail.com> <874knbi0jc.fsf_-_@gmail.com> <87362tggvl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37884"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: casouri@gmail.com, 43609@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 06 11:30:36 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPjIq-0009lJ-IS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 11:30:36 +0200 Original-Received: from localhost ([::1]:37008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPjIp-0002Wn-0d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 05:30:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjIJ-0002Vt-Be for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 05:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40134) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPjII-0000Su-VK for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 05:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kPjII-0000oY-KG for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 05:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Oct 2020 09:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43609 X-GNU-PR-Package: emacs Original-Received: via spool by 43609-submit@debbugs.gnu.org id=B43609.16019765893075 (code B ref 43609); Tue, 06 Oct 2020 09:30:02 +0000 Original-Received: (at 43609) by debbugs.gnu.org; 6 Oct 2020 09:29:49 +0000 Original-Received: from localhost ([127.0.0.1]:51679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPjI4-0000nX-RF for submit@debbugs.gnu.org; Tue, 06 Oct 2020 05:29:49 -0400 Original-Received: from mail-wr1-f54.google.com ([209.85.221.54]:33280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPjI3-0000nL-9F for 43609@debbugs.gnu.org; Tue, 06 Oct 2020 05:29:47 -0400 Original-Received: by mail-wr1-f54.google.com with SMTP id m6so12661387wrn.0 for <43609@debbugs.gnu.org>; Tue, 06 Oct 2020 02:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IQzsOJSxZ/CXzypuPyWr95zG2pxpZJpNPczpRgMPTKk=; b=L7yEwlDEvlYfviH0lcwwFTos0kQ+oqDoX9guONudJOfLd2ntPibV6et8UyFYYOMeNd 9F2H7wqrC2YL1lpuER5qNxIGBm30uwZHYQCrFv1vlY12FwjV8/S+7UKxBbWWLNEDQOyi USA+aOJaz8tZIRVrhCciAl+KODfQq4mXfIrbBwYTg2UIpixza3x0/8TlGJm1SfTDBKQk YfClASlMkhBBJz1hR5qQC6rrZ1Q5AmU6ThtEmRMlrxS1OaZjBDY7uc7iM1jnTZwcIEEx zL06SijYOArxOxgMTYLw7EQ6IOGcGjLw8WS/ptdecPISR3QG9xCeRRrRTzbiW3U7KHZU 35fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IQzsOJSxZ/CXzypuPyWr95zG2pxpZJpNPczpRgMPTKk=; b=E8MlVWh1VV+/zQS4EWerwLNJAJxf8rxNoS6b5yiLg5FFJhh3fla6iW+9ihvkJHhBou AJRu0Ppx+t/DbmHZW1K6FAoHYbJR6lBzal8JXZLh0d+EpcM9nYuNAY9pjnlvhUg8sHxP FCT//sQyucu6GdACs2/vdnEvEkY0sM37V1ETTLf6TNbqaGBDhmjvJshLTvNXxr3TIwz1 NNqs4+K0mBJ0WXa1c0CySl3UtHfjwsEDy5llrGBI9yAkAqXwBvDUbodhjU2P5WPDgofs keWvnlJG5smgrI4Tn7/2xJsHckcnoF3SKvoFS6Fc1iZQ5nyWIirMycZjnHwSeARYsmPI uNvw== X-Gm-Message-State: AOAM533tE9ZBOrjVea4IMZ9hF4QvVfbNx0TSK8pH5UbYgTpfRLC1R5uQ mnJWMVopjTiA2KrTe1KYfac= X-Google-Smtp-Source: ABdhPJz87FxflApLss7f1yaHatKS3z1PY1x/NzLDzVJZ+6M6/JOI0jOcxGBF4KyyDAJeBA1DoFVVFA== X-Received: by 2002:adf:f584:: with SMTP id f4mr3663435wro.383.1601976581076; Tue, 06 Oct 2020 02:29:41 -0700 (PDT) Original-Received: from krug (89-180-147-150.net.novis.pt. [89.180.147.150]) by smtp.gmail.com with ESMTPSA id z191sm3183112wme.40.2020.10.06.02.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 02:29:39 -0700 (PDT) In-Reply-To: (martin rudalics's message of "Tue, 6 Oct 2020 10:23:13 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189893 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable martin rudalics writes: > I tried to do that but wasn't able to get some useful behavior out of > it. All Emacs tells me is that it was entering the debugger. Since you > have both, the 'martin' function and the eldoc-tooltip-joao.el file, > could you please just put the former into the latter and send it to me > so I'm not doing anything wrong. OK. I've done a bit more work on that file, which I attach. See the Commentary: section. You'll notice I removed a eldoc-tooltip--make-2 function and removed the global mode (I don't think it's strictly needed and sort of stands in the way of this useful functionality, but you can add it back, if you wish.) > Maybe it's also the 'martin' function itself but I also (1) get an > empty tooltip using that function in my normal eldoc-tooltip.el - so > 'martin' apparently does not always "return nil when there=E2=80=99s no d= oc > appropriate for the context" and (2) window scrolling sometimes stops > here without apparent reason - something which may be completely > unrelated to the eldoc problem, given that I have not pulled master > for months. Right, I fixed these bugs in the eldoc-tooltip-joao.el. Sorry, but last time I tested only very briefly, now I spent some more minutes on it. >> Makes perfect sense I guess. You should be able to >> >> (remove-hook 'eldoc-display-functions 'eldoc-display-in-echo-area) > > This works indeed. It's good to have some third party testing being done on this. >> instead of a global minor mode. Then you would let ElDoc mode _drive_ >> your extension. > > I'm not yet sure of the consequences of doing that. Hopefully, a very useful new feature that works cooperates fully with the ElDoc framework. We'll see later how to add backward compatibility to Emacs 27 and earlier. Instead of reimplementing ElDoc's idle timers, I think the best bet is to leverage `eldoc-message` either via `eldoc-message-function' or with some advice for older version, like Yuan Fu does. It won't be as clean as the Emacs 28 implementation, but should work. Jo=C3=A3o --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=eldoc-tooltip-joao.el Content-Transfer-Encoding: quoted-printable ;;; eldoc-tooltip-joao.el --- show ElDoc as tooltips -*- lexical-binding:t= -*- ;; Copyright (C) 2015 Free Software Foundation, Inc. ;; Author: Martin Rudalics , Jo=C3=A3o T=C3=A1vora ;; Keywords: ElDoc, tooltips ;; Version: 1.0 ;; eldoc-tooltip.el is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 3, or (at ;; your option) any later version. ;; eldoc-tooltip.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;; ;;; This is a variation of Martin Rudalics' eldoc-tooltip.el made to ;;; work with `eldoc-display-functions'. Instead of making a global ;;; minor mode, some simple innocuous function are added to frame- and ;;; window-management hooks just by loading this variable (to remove ;;; them, support for `unload-feature' can be added later). ;;; ;;; This library exposes `eldoc-display-in-tooltip' and to activate it ;;; you should: ;;; ;;; (add-hook 'eldoc-display-functions 'eldoc-display-in-tooltip) ;;; ;;; To deactivate it: ;;; ;;; (remove-hook 'eldoc-display-functions 'eldoc-display-in-tooltip) (require 'cl-lib) ;;; Code: (defgroup eldoc-tooltip nil "Show ElDoc in tooltips." :version "25.1" :group 'extensions) ;;;=20 (set-frame-parameter nil 'eldoc-focus t) (add-hook 'focus-in-hook 'eldoc-tooltip--focus-in) (add-hook 'focus-out-hook 'eldoc-tooltip--focus-out) (add-hook 'window-configuration-change-hook 'eldoc-tooltip--hide-tip) (add-hook 'window-size-change-functions 'eldoc-tooltip--hide-tip) (defgroup eldoc-tooltip nil "Show function arglist or variable docstring in tooltip." :group 'eldoc) (defcustom eldoc-tooltip-duration 60 "Number of seconds to show eldoc tooltip. If user input arrives before this time has elapsed, the tooltip will be hidden." :type 'number :group 'eldoc-tooltip) (defcustom eldoc-tooltip-location 'eols "Where to show ElDoc tooltip. Options are: `above' - over text on line above point `below' - over text on line below point `eols' - at ends of lines near point `top' on top of selected window `bottom' - on bottom of selected window" :type '(choice (const :tag "on line above point" above) (const :tag "on line below point" below) (const :tag "at line ends near point" eols) (const :tag "on top of selected window" top) (const :tag "on bottom of selected window" bottom)) :group 'eldoc-tooltip) (defcustom eldoc-tooltip-x-offset-alist '((above . 2) (current . 2) (below . 2) (top . 2) (bottom . 2)) "Offsets to adjust x-position of tooltips. These pixel offsets are added to the x-position of tooltips that respectively appear on the line above the current line (`above'), the current line (`current'), the line below the current line (`below'), the top edge of the window (`top') and the bottom edge of the window (`bottom')." :type '(alist :key-type (symbol :tag "Location") :value-type integer) :group 'eldoc-tooltip) (defcustom eldoc-tooltip-indent-above-below t "Non-nil means to show tooltips at indent of current line. This options takes affect only when tooltips shown at the beginning of a line, that is when `eldoc-tooltip-location' equals `above' or `below'. When this option is nil, such tooltips start at the visual beginning of the respective line." :type 'boolean :group 'eldoc-tooltip) (defcustom eldoc-tooltip-current-eol-extra-x-offset t "Extra offset for tooltip at end of current line. If non-nil this adds an extra offset of one character's width to avoid that the tooltip window overlays a block cursor at the end of the current line. If nil the offset is entirely determined by the value of `eldoc-tooltip-x-offsets'. Tooltips appearing above or below the current line are not affected by this option." :type 'boolean :group 'eldoc-tooltip) (defcustom eldoc-tooltip-y-offset-alist '((above . 0) (current . -2) (below . -2) (top . 2) (bottom . -2)) "Alist of offsets to adjust y-position of tooltips. These pixel offsets are added to the y-position of tooltips that respectively appear on the line above the current line (`above'), the current line (`current'), the line below the current line (`below'), the top edge of the window (`top') and the bottom edge of the window (`bottom')." :type '(alist :key-type (symbol :tag "Location") :value-type integer) :group 'eldoc-tooltip) (defcustom eldoc-tooltip-max-size '(120 . 1) "Maximimum size of ElDoc tooltips. A cons of rows and columns." :type '(cons (integer :tag "Columns") (integer :tag "Lines")) :group 'eldoc-tooltip) (defcustom eldoc-tooltip-frame-parameters '((background-color . "honeydew") (alpha . 60)) "Frame parameter alist used for ElDoc tooltips. The list of frame parameters passed to `x-show-tip' is built by appending to this a list built from the `left' and `top'/`bottom' parameters as produced by `eldoc-tooltip-make' and the value of `tooltip-frame-parameters'." :type '(alist :key-type symbol :value-type sexp) :group 'tooltip) (defvar eldoc-tooltip-idle-timer nil "ElDoc tooltip timer.") (defvar eldoc-tooltip-debug nil "Non-nil means display message about position of tooltip window.") (defun eldoc-tooltip--focus-in () "ElDoc tooltip mode function when selected frame gains focus." (set-frame-parameter nil 'eldoc-focus t)) ;; In the following two we should check that we own the tooltip. (defun eldoc-tooltip--focus-out () "ElDoc tooltip mode function when selected frame loses focus." (set-frame-parameter nil 'eldoc-focus nil) (x-hide-tip)) (defun eldoc-tooltip--hide-tip (&optional _ignore) "Hide ElDoc tooltip." (x-hide-tip)) (defun eldoc-tooltip--current-line-wrapped-p () "Return non-nil when current line is wrapped." (save-excursion (< (progn (beginning-of-line) (vertical-motion 1) (point)) (progn (forward-line) (point))))) (defun eldoc-display-in-tooltip (docs interactive) "Make ElDoc tooltip." (let* (;; We make a tooltip iff there are some docs and this is not ;; an interactive call to `eldoc' (a decision that can be ;; reviewed, maybe) (text (and (not interactive) (mapconcat (cl-function (lambda (doc &key thing face &allow-other-keys) (format "%s: %s" (propertize (format "%s" thing) 'face face) doc))) docs "\n"))) ;; We make a tooltip iff `point' is visible in the selected ;; window, the frame has focus and we get a suitable text from ;; the corresponding eldoc function. Remember that ;; `pos-visible-in-window-p' may return non-nil even when POS ;; is scrolled off horizontally. (pos-point (and text (pos-visible-in-window-p (point) nil t)))) (when pos-point (let* ((edges (window-inside-pixel-edges)) (frame-geometry (frame-geometry)) ;; (x-frame-geometry) (frame-left-position (or (cadr (assq 'frame-position frame-geometry)) (cadr (assq 'outer-position frame-geometry)) (nth 1 (assq 'outer-edges frame-geometry)))) (frame-top-position (or (cddr (assq 'frame-position frame-geometry)) (cddr (assq 'outer-position frame-geometry)) (nth 2 (assq 'outer-edges frame-geometry)))) (frame-left (let ((edge (frame-parameter nil 'left))) (if (numberp edge) edge 0))) (left (+ frame-left ;; Count left border iff frame's left edge is on ;; screen (this should catch frame maximation by ;; moving the border off-display tricks). (if (< frame-left-position 0) 0 (cadr (assq 'external-border-size frame-geometry))) (nth 0 edges) ;; Count tool bar when it's on the left. (or (and (cdr (assq 'tool-bar-external frame-geometry)) (eq (cdr (assq 'tool-bar-position frame-geometry)) 'left) (cddr (assq 'tool-bar-size frame-geometry))) 0) ;; Count vertical scroll bar when it's on the ;; left. Don't care about fringes or margins yet. (if (eq (car (window-current-scroll-bars)) 'left) (window-scroll-bar-width) 0))) (frame-top (let ((edge (frame-parameter nil 'top))) (if (numberp edge) edge 0))) (top (+ frame-top ;; Count top border iff frame's top edge is on screen ;; (to catch frame maximation by moving the border ;; off-display tricks). Also, apparently ns counts the ;; top border in the title height already. (if (or (< frame-top-position 0) (eq (window-system) 'ns)) 0 (cddr (assq 'external-border-size frame-geometry))) ;; Add heights of title, menu and tool bar but only if ;; they are external (an "internal" tool or menu bar is ;; already counted by `window-pixel-edges'). (or (cdr (assq 'title-height frame-geometry)) (cddr (assq 'title-bar-size frame-geometry)) 0) (or (and (cdr (assq 'menu-bar-external frame-geometry)) (cddr (assq 'menu-bar-size frame-geometry))) 0) (or (and (cdr (assq 'tool-bar-external frame-geometry)) (eq (cdr (assq 'tool-bar-position frame-geometry)) 'top) (cddr (assq 'tool-bar-size frame-geometry))) 0) (if (eq eldoc-tooltip-location 'bottom) ;; Don't obscure mode line. (- (nth 3 edges) (window-mode-line-height) (window-bottom-divider-width)) (nth 1 edges)))) (x-max-tooltip-size eldoc-tooltip-max-size) parameters) (pcase eldoc-tooltip-location ((or `above `below) (let ((x-adjust (or (cdr (assq eldoc-tooltip-location eldoc-tooltip-x-offset-alist)) 0)) (y-adjust (or (cdr (assq eldoc-tooltip-location eldoc-tooltip-y-offset-alist)) 0)) (pos-x (if eldoc-tooltip-indent-above-below (save-excursion (beginning-of-line) (skip-chars-forward " \t") (nth 0 (pos-visible-in-window-p (point) nil t))) 0)) (pos-y (+ (nth 1 pos-point) (if (eq eldoc-tooltip-location 'above) 0 ;; `window-line-height' returns nil when ;; display is not up-to-date. (or (car (window-line-height)) (frame-char-height)))))) (when eldoc-tooltip-debug (message "%s %s %s %s [x: %s %s %s] [y: %s %s %s] -> %s" (if (or (< frame-top 0) (eq (window-system) 'ns)) 0 (cddr (assq 'external-border-size frame-geometry))) (or (cdr (assq 'title-height frame-geometry)) (cddr (assq 'title-bar-size frame-geometry)) 0) (or (and (cdr (assq 'menu-bar-external frame-geometry)) (cddr (assq 'menu-bar-size frame-geometry))) 0) (or (and (cdr (assq 'tool-bar-external frame-geometry)) (eq (cdr (assq 'tool-bar-position frame-geometry)) 'top) (cddr (assq 'tool-bar-size frame-geometry))) 0) left pos-x x-adjust top pos-y y-adjust (cons (+ left 0 x-adjust) (+ top pos-y y-adjust)))) (setq parameters (list (cons 'left (+ left pos-x x-adjust)) (if (eq eldoc-tooltip-location 'above) (cons 'bottom (+ top pos-y y-adjust)) (cons 'top (+ top pos-y y-adjust))))))) (`eols (let (where pos-above pos-this pos-below pos-x pos-y x-adjust y-adjust) (setq pos-this (pos-visible-in-window-p (line-end-position) nil t)) ;; Try current line first. (when pos-this (setq where 'current) (setq pos-x (nth 0 pos-this)) (setq pos-y (nth 1 pos-this))) ;; Try line above next. (when (and (setq pos-above (and (/=3D (line-beginning-position) (point-min)) (pos-visible-in-window-p (line-end-position 0) nil t))) (or (not pos-x) (< (nth 0 pos-above) pos-x))) (setq where 'above) (setq pos-x (nth 0 pos-above)) (setq pos-y (if truncate-lines ;; When lines are truncated use top ;; of the current line. (nth 1 pos-point) ;; Otherwise use top of beginning of ;; current line. (or (nth 1 (pos-visible-in-window-p (line-beginning-position) nil t)) 0)))) ;; Try line below last. (when (and (/=3D (line-end-position) (point-max)) (or truncate-lines (save-excursion (forward-line) (not (eldoc-tooltip--current-line-wrapped-p)))) (setq pos-below (pos-visible-in-window-p (line-end-position 2) nil t)) (or (not pos-x) (< (nth 0 pos-below) pos-x))) (setq where 'below) (setq pos-x (nth 0 pos-below)) (setq pos-y (nth 1 pos-below))) ;; If we didn't get a result till now simulate `above'. (unless pos-x (setq where 'above) (setq pos-x 0) (setq pos-y (nth 1 pos-point))) ;; If the window is scrolled horizontally, make sure the ;; tooltip doesn't start on the left of it. (setq pos-x (max 0 pos-x)) ;; Adjust offsets now. (setq x-adjust (or (cdr (assq where eldoc-tooltip-x-offset-alist)) 0)) (setq y-adjust (or (cdr (assq where eldoc-tooltip-y-offset-alist)) 0)) (when (and eldoc-tooltip-current-eol-extra-x-offset (or (=3D (point) (point-max)) (looking-at "\n"))) ;; Don't obscure block pointer at EOL. (setq x-adjust (+ x-adjust (frame-char-width)))) (when eldoc-tooltip-debug (message "%s %s %s %s - %s / %s / %s / %s -> %s [x: %s %s %s] [y: %= s %s %s] -> %s" (if (or (< frame-top 0) (eq (window-system) 'ns)) 0 (cddr (assq 'external-border-size frame-geometry))) (or (cdr (assq 'title-height frame-geometry)) (cddr (assq 'title-bar-size frame-geometry)) 0) (or (and (cdr (assq 'menu-bar-external frame-geometry)) (cddr (assq 'menu-bar-size frame-geometry))) 0) (or (and (cdr (assq 'tool-bar-external frame-geometry)) (eq (cdr (assq 'tool-bar-position frame-geometry)) 'top) (cddr (assq 'tool-bar-size frame-geometry))) 0) pos-above pos-point pos-this pos-below where left pos-x x-adjust top pos-y y-adjust (cons (+ left pos-x x-adjust) (+ top pos-y y-adjust)))) (setq parameters (list (cons 'left (+ left pos-x x-adjust)) (if (eq where 'above) (cons 'bottom (+ top pos-y y-adjust)) (cons 'top (+ top pos-y y-adjust))))))) (`top (let* ((x-adjust (cdr (assq 'top eldoc-tooltip-x-offset-alist))) (y-adjust (cdr (assq 'top eldoc-tooltip-y-offset-alist)))) (when eldoc-tooltip-debug (message "[x: %s %s] [y: %s %s] -> %s" left x-adjust top y-adjust (cons (+ left x-adjust) (+ top y-adjust)))) (setq parameters (list (cons 'left (+ left x-adjust)) (cons 'bottom (+ top y-adjust)))))) (`bottom (let* ((x-adjust (cdr (assq 'top eldoc-tooltip-x-offset-alist))) (y-adjust (cdr (assq 'top eldoc-tooltip-y-offset-alist)))) (when eldoc-tooltip-debug (message "[x: %s %s] [y: %s %s] -> %s" left x-adjust top y-adjust (cons (+ left x-adjust) (+ top y-adjust)))) (setq parameters (list (cons 'left (+ left x-adjust)) (cons 'bottom (+ top y-adjust))))))) ;; Show tip. (when parameters (x-show-tip text (selected-frame) (append eldoc-tooltip-frame-parameters parameters tooltip-frame-parameters) eldoc-tooltip-duration 0 0)))))) (provide 'eldoc-tooltip) ;;; eldoc-tooltip-joao.el ends here --=-=-=--