[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy 28d416157a 4/8: Improve tooltip on minibuffer candi
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy 28d416157a 4/8: Improve tooltip on minibuffer candidates |
Date: |
Wed, 14 Feb 2024 16:41:24 -0500 (EST) |
branch: externals/ivy
commit 28d416157a5256ca7ae60567afa970322da75e33
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Improve tooltip on minibuffer candidates
This change not only introduces Emacs 29 \`KEYSEQ' highlighting, but
also makes the tooltip more customizable. Previously, mouse-1 and
mouse-3 were hard-coded in the help-echo string, whereas they now
appear together with the summary of their default binding.
* ivy.el (ivy-mouse-1-help, ivy-mouse-3-help): New variables
replacing (and obsoleting) ivy-mouse-1-tooltip and
ivy-mouse-3-tooltip, respectively.
(ivy--help-echo): New help-echo function.
(ivy--format-minibuffer-line): Use it in place of a help-echo form.
---
ivy.el | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/ivy.el b/ivy.el
index f2444ca697..3828786e32 100644
--- a/ivy.el
+++ b/ivy.el
@@ -735,6 +735,27 @@ candidate, not the prompt."
"Display alternative actions."
"The doc visible in the tooltip for mouse-3 binding in the minibuffer.")
+(make-obsolete-variable 'ivy-mouse-1-tooltip 'ivy-mouse-1-help
+ "0.15.0 (2024-01-14)")
+(make-obsolete-variable 'ivy-mouse-3-tooltip 'ivy-mouse-3-help
+ "0.15.0 (2024-01-14)")
+
+(defvar ivy-mouse-1-help
+ (eval-when-compile
+ (format (if (> emacs-major-version 28) "\\`%s': %s" "%s: %s")
+ "mouse-1" "Exit the minibuffer with the selected candidate"))
+ "Tooltip doc for \\`mouse-1' binding in the minibuffer.")
+
+(defvar ivy-mouse-3-help
+ (eval-when-compile
+ (format (if (> emacs-major-version 28) "\\`%s': %s" "%s: %s")
+ "mouse-3" "Display alternative actions"))
+ "Tooltip doc for \\`mouse-3' binding in the minibuffer.")
+
+(defun ivy--help-echo (_win _obj _pos)
+ "Return a `help-echo' string for mouse bindings on minibuffer candidates."
+ (concat ivy-mouse-1-help (if tooltip-mode "\n" " ") ivy-mouse-3-help))
+
(defun ivy-mouse-offset (event)
"Compute the offset between the candidate at point and the selected one."
(if event
@@ -4133,17 +4154,10 @@ in this case."
(funcall ivy--highlight-function str))
str))
(olen (length str)))
- (add-text-properties
- 0 olen
- '(mouse-face
- ivy-minibuffer-match-highlight
- help-echo
- (format
- (if tooltip-mode
- "mouse-1: %s\nmouse-3: %s"
- "mouse-1: %s mouse-3: %s")
- ivy-mouse-1-tooltip ivy-mouse-3-tooltip))
- str)
+ (add-text-properties 0 olen
+ '( mouse-face ivy-minibuffer-match-highlight
+ help-echo ivy--help-echo)
+ str)
(when annot
(setq str (concat str (funcall annot str)))
(add-face-text-property
- [elpa] externals/ivy updated (75d7136cfc -> d631cb3419), Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 438f0833ac 1/8: ; .github/workflows/test.yml: Add Emacs 29.2., Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 5486305830 3/8: Improve obsoletion warning messages, Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 4546ce0ca4 7/8: ; * .elpaignore: Add .mailmap., Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 28d416157a 4/8: Improve tooltip on minibuffer candidates,
Basil L. Contovounesios <=
- [elpa] externals/ivy 92e69ceac5 2/8: Update copyright notices for 2024, Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 749ac1235a 6/8: Update contributor email addresses, Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy d631cb3419 8/8: Merge branch 'master' into externals/ivy, Basil L. Contovounesios, 2024/02/14
- [elpa] externals/ivy 12803ed607 5/8: Add support for Emacs 28 affixation-function, Basil L. Contovounesios, 2024/02/14