From f01cf73329cda1cffb9182635a429f7775cb585c Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Fri, 10 Feb 2023 00:07:41 +0100 Subject: Add innermost-minibuffer-p --- compat-28.el | 8 ++++++++ compat-tests.el | 3 +++ compat.texi | 2 -- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/compat-28.el b/compat-28.el index 645f5cb..c845b58 100644 --- a/compat-28.el +++ b/compat-28.el @@ -605,6 +605,14 @@ onwards does." ".#" (file-name-nondirectory filename)) (file-name-directory filename))) +;;;; Defined in minibuf.c + +(compat-defun innermost-minibuffer-p (&optional buffer) ;; + "Return t if BUFFER is the most nested active minibuffer. +No argument or nil as argument means use the current buffer as BUFFER." + (when-let ((win (active-minibuffer-window))) + (eq (window-buffer win) (or buffer (current-buffer))))) + ;;;; Defined in minibuffer.el (compat-defun format-prompt (prompt default &rest format-args) ;; diff --git a/compat-tests.el b/compat-tests.el index ce818c1..e63a041 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -163,6 +163,9 @@ (push x y)) '(3 2 1)))) +(ert-deftest innermost-minibuffer-p () + ) + (ert-deftest minibuffer-history-value () (let ((minibuffer-history-variable 'file-name-history) (file-name-history '("a" "b" "c"))) diff --git a/compat.texi b/compat.texi index 4a84f29..f5d0fb3 100644 --- a/compat.texi +++ b/compat.texi @@ -2224,8 +2224,6 @@ The function @code{split-string-shell-command}. @item The function @code{string-limit}. @item -The function @code{innermost-minibuffer-p}. -@item The function @code{max-mini-window-lines}. @item The function @code{lock-file} and @code{unlock-file}. -- cgit v1.0