branch: externals/org
commit b0bfc2f492668c91c9fb747f0f3a98de52e9e6b2
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-colview: Fix Emacs <31 compatibility
    
    * lisp/org-compat.el (org-completion-table-with-metadata): Add compat
    function for `completion-table-with-metadata'.
    * lisp/org-colview.el (org-columns--summary-types-completion-function):
    Use it.
---
 lisp/org-colview.el |  2 +-
 lisp/org-compat.el  | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d4aa4acc11..da738c52dc 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -932,7 +932,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column 
format."
 
 (defun org-columns--summary-types-completion-function (string pred flag)
   (let ((completion-table
-         (completion-table-with-metadata
+         (org-completion-table-with-metadata
           (lambda (str pred comp)
             (complete-with-action comp
                                   (delete-dups
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 189b0ac1db..eebb1b7a46 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -100,6 +100,19 @@
 (defvar org-fold-core-style)
 
 
+;;; Emacs < 31 compatibility
+(if (fboundp 'completion-table-with-metadata)
+    (defalias 'org-completion-table-with-metadata 
#'completion-table-with-metadata)
+  (defun org-completion-table-with-metadata (table metadata)
+    "Return new completion TABLE with METADATA.
+METADATA should be an alist of completion metadata.  See
+`completion-metadata' for a list of supported metadata."
+    (lambda (string pred action)
+      (if (eq action 'metadata)
+          `(metadata . ,metadata)
+        (complete-with-action action table string pred)))))
+
+
 ;;; Emacs < 29 compatibility
 
 (if (fboundp 'display-buffer-full-frame)

Reply via email to