[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vertico-posframe f5ff9b4 3/4: Add variable vertico-posf
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vertico-posframe f5ff9b4 3/4: Add variable vertico-posframe-show-minibuffer-rules. |
Date: |
Sun, 31 Oct 2021 21:57:32 -0400 (EDT) |
branch: externals/vertico-posframe
commit f5ff9b4b8e9ec56a7077b6809d3c889c7adc84b9
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Add variable vertico-posframe-show-minibuffer-rules.
* vertico-posframe.el (vertico-posframe-show-minibuffer-rules): New
variable.
(vertico-posframe--show-minibuffer-p): Use above variable.
---
vertico-posframe.el | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/vertico-posframe.el b/vertico-posframe.el
index ea03471..86e3987 100644
--- a/vertico-posframe.el
+++ b/vertico-posframe.el
@@ -107,6 +107,19 @@ When 0, no border is showed."
"The frame parameters used by vertico-posframe."
:type 'string)
+(defcustom vertico-posframe-show-minibuffer-rules
+ (list "^eval-*")
+ "A list of rule showed minibuffer.
+
+a rule can be a regexp or a function.
+
+1. when rule is a regexp and it match `this-command'.
+2. when rule is a function and it return t.
+3. when rule is a symbol, its value is t.
+
+minibuffer will not be hided by minibuffer-cover."
+ :type '(repeat (choice string function)))
+
(defface vertico-posframe
'((t (:inherit default)))
"Face used by the vertico-posframe."
@@ -229,7 +242,16 @@ Show STRING when it is a string."
(defun vertico-posframe--show-minibuffer-p ()
"Test show minibuffer or not."
(or current-input-method
- (string-match-p "^eval-*" (symbol-name this-command))))
+ (cl-some
+ (lambda (rule)
+ (cond ((functionp rule)
+ (funcall rule))
+ ((and rule (stringp rule))
+ (string-match-p rule (symbol-name this-command)))
+ ((symbolp rule)
+ (symbol-value rule))
+ (t nil)))
+ vertico-posframe-show-minibuffer-rules)))
(defun vertico-posframe-last-window ()
"Get the last actived window before active minibuffer."