Skip to content

Commit

Permalink
racket-xp: Don't pre-redisplay help-echo if eldoc will do so
Browse files Browse the repository at this point in the history
  • Loading branch information
greghendershott committed Nov 28, 2024
1 parent 09f5019 commit c15bf5f
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions racket-xp.el
Original file line number Diff line number Diff line change
Expand Up @@ -728,28 +728,32 @@ Obsolete: Newer versions of Emacs instead use the variable
(let ((point (window-point window)))
(unless (equal point (window-parameter window 'racket-xp-point))
(set-window-parameter window 'racket-xp-point point)
(pcase (get-text-property point 'help-echo)
((and s (pred racket--non-empty-string-p))
(racket-show
s
;; Because some `racket-show' flavors present a tooltip, a
;; position after the end of the span is preferable: less
;; likely to hide the target of the annotation.
(pcase (or (next-single-property-change point 'help-echo)
(point-max))
((and end (guard (pos-visible-in-window-p end window))) end)
;; But if end isn't visible (#629) prefer beginning.
(end
(pcase (or (previous-single-property-change end 'help-echo)
(point-min))
((and beg (guard (pos-visible-in-window-p beg window))) beg)
;; But if neither beginning nor end are visible, just
;; show starting at top line of window.
(_ (save-excursion
(goto-char (window-start window))
(forward-line -1)
(point))))))))
(_ (racket-show "")))
;; Show help-echo unless eldoc-mode will do so.
(unless (and eldoc-mode
(bound-and-true-p eldoc-documentation-functions))
(pcase (get-text-property point 'help-echo)
((and s (pred racket--non-empty-string-p))
(racket-show
s
;; Because some `racket-show' flavors present a tooltip, a
;; position after the end of the span is preferable: less
;; likely to hide the target of the annotation.
(pcase (or (next-single-property-change point 'help-echo)
(point-max))
((and end (guard (pos-visible-in-window-p end window))) end)
;; But if end isn't visible (#629) prefer beginning.
(end
(pcase (or (previous-single-property-change end 'help-echo)
(point-min))
((and beg (guard (pos-visible-in-window-p beg window))) beg)
;; But if neither beginning nor end are visible, just
;; show starting at top line of window.
(_ (save-excursion
(goto-char (window-start window))
(forward-line -1)
(point))))))))
(_ (racket-show ""))))
;; Show def and use overlays.
(let ((def (get-text-property point 'racket-xp-def))
(use (get-text-property point 'racket-xp-use)))
(unless (and (equal def (window-parameter window 'racket-xp-def))
Expand Down Expand Up @@ -780,6 +784,7 @@ Obsolete: Newer versions of Emacs instead use the variable
(pcase use
(`(,beg ,end)
(racket--add-overlay beg end racket-xp-use-face)))))))))))
;; Show recursion tail/target overlays
(let ((target (get-text-property point 'racket-xp-tail-target))
(context (get-text-property point 'racket-xp-tail-position)))
(unless (and (equal target (window-parameter window 'racket-xp-tail-target))
Expand Down

0 comments on commit c15bf5f

Please sign in to comment.