emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/mct b16f582 37/70: Make completion metadata functions w


From: ELPA Syncer
Subject: [elpa] externals/mct b16f582 37/70: Make completion metadata functions work everywhere
Date: Thu, 11 Nov 2021 03:57:47 -0500 (EST)

branch: externals/mct
commit b16f5822789e7e3a3575ee182250594ddcc4ea8a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Make completion metadata functions work everywhere
---
 mct.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/mct.el b/mct.el
index 0ff6c30..d92f813 100644
--- a/mct.el
+++ b/mct.el
@@ -157,28 +157,29 @@ NOTE that setting this option with `setq' requires a 
restart of
   :type '(choice (const horizontal) (const vertical) (const one-column))
   :group 'mct)
 
-;;;; Basic helper functions
+;;;; Completion metadata
 
-;; Copied from icomplete.el
 (defun mct--field-beg ()
   "Determine beginning of completion."
-  (if (window-minibuffer-p)
-      (minibuffer-prompt-end)
+  (if-let ((window (active-minibuffer-window)))
+      (with-current-buffer (window-buffer window)
+        (minibuffer-prompt-end))
     (nth 0 completion-in-region--data)))
 
-;; Copied from icomplete.el
 (defun mct--field-end ()
   "Determine end of completion."
-  (if (window-minibuffer-p)
-      (point-max)
+  (if-let ((window (active-minibuffer-window)))
+      (with-current-buffer (window-buffer window)
+        (point-max))
     (nth 1 completion-in-region--data)))
 
-;; Copied from icomplete.el
 (defun mct--completion-category ()
   "Return completion category."
-  (let* ((beg (mct--field-beg))
-         (md (when (window-minibuffer-p) (completion--field-metadata beg))))
-    (alist-get 'category (cdr md))))
+  (when-let ((window (active-minibuffer-window)))
+    (with-current-buffer (window-buffer window)
+      (let* ((beg (mct--field-beg))
+             (md (completion--field-metadata beg)))
+        (alist-get 'category (cdr md))))))
 
 ;;;; Basics of intersection between minibuffer and Completions' buffer
 



reply via email to

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