branch: externals/ivy
commit 0d0230dbc960362359460651fa95e22af5ce760e
Author: Basil L. Contovounesios <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>

    * ivy.el (ivy--completing-fname-p): Refactor.
    
    Use completion-metadata and completion-metadata-get.
---
 ivy.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index aa25ad7ce5..cba2296430 100644
--- a/ivy.el
+++ b/ivy.el
@@ -988,10 +988,11 @@ Is is a cons cell, related to 
`tramp-get-completion-function'."
   :type '(alist :key-type symbol :value-type function))
 
 (defun ivy--completing-fname-p ()
-  (let ((meta (ignore-errors
-                (funcall (ivy-state-collection ivy-last) ivy-text nil 
'metadata))))
-    (and (consp meta)
-         (eq 'file (cdr (assoc 'category meta))))))
+  (let* ((table (ivy-state-collection ivy-last))
+         (md (condition-case nil
+                 (completion-metadata ivy-text table nil)
+               (error '(metadata)))))
+    (eq (ivy--metadata-get md 'category) 'file)))
 
 (defun ivy-alt-done (&optional arg)
   "Exit the minibuffer with the selected candidate.

Reply via email to