emacs-devel
[Top][All Lists]
Advanced

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

Re: Could x-show-tip be reimplemented in Elisp? How does one create bord


From: Johan Bockgård
Subject: Re: Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp?
Date: Tue, 16 Feb 2016 22:33:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Clément Pit--Claudel <address@hidden> writes:

> Indeed, that's what I'd like. x-show-tip works perfectly for me (it
> supports fonts, faces, etc. properly), expect for the fact that
> updating the tooltip text causes it to be closed and reopened.

Try this:

(let* ((x-gtk-use-system-tooltips nil)
       (list '("abc" "def" "ghi" "jkl" "mno"))
       (L (length list))
       (n 0)
       (f (lambda ()
            (let ((tmp -1))
              (mapconcat
               (lambda (s)
                 (setq tmp (1+ tmp))
                 (if (= n tmp)
                     (propertize s 'face 'highlight)
                   (propertize s 'face 'default)))
               list "\n"))))
       (offset 0)
       (edges (window-edges nil t t t))
       (xy    (posn-x-y (posn-at-point (point))))
       (left  (+ (car edges)  (car xy) (* (frame-char-width) offset)))
       (top   (+ (cadr edges) (cdr xy) (frame-char-height)))
       (parameters
        (list (cons 'left left) (cons 'top top) '(border-width . 0))))
  (unwind-protect
      (progn (x-show-tip (funcall f) nil parameters most-positive-fixnum)
             (while
                 (progn
                   (with-current-buffer (get-buffer " *tip*")
                     (erase-buffer)
                     (insert (funcall f)))
                   (pcase (read-key)
                     ('down (setq n (mod (1+ n) L)))
                     ('up (setq n (mod (1- n) L)))
                     (_ nil)))))
    (x-hide-tip)))

;; <--  C-x C-e <down>/<up> ...



reply via email to

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