diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-12-23 11:45:38 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-12-23 11:45:38 +0100 |
| commit | 80b41c67ab75eb57aa0fb527842f9d3d82002544 (patch) | |
| tree | d54738b8a49c24f553b8e89094c8846e9f7dab93 | |
| parent | 029d1a6595031a3b7c767652a2ba7907b5b84504 (diff) | |
cape--properties-table: Fix condition
| -rw-r--r-- | cape.el | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -278,16 +278,19 @@ NAME is the name of the Capf, BEG and END are the input markers." "Create completion TABLE with properties. CATEGORY is the optional completion category. SORT should be nil to disable sorting." - (if (or (not table) (and (not category) sort)) - table - (let ((metadata `(metadata - ,@(and category `((category . ,category))) - ,@(and (not sort) '((display-sort-function . identity) - (cycle-sort-function . identity)))))) - (lambda (str pred action) - (if (eq action 'metadata) - metadata - (complete-with-action action table str pred)))))) + ;; The metadata will be overridden if the category is non-nil, if the table is + ;; a function table or if sorting should be disabled for a non-nil + ;; non-function table. + (if (or category (functionp table) (and (not sort) table)) + (let ((metadata `(metadata + ,@(and category `((category . ,category))) + ,@(and (not sort) '((display-sort-function . identity) + (cycle-sort-function . identity)))))) + (lambda (str pred action) + (if (eq action 'metadata) + metadata + (complete-with-action action table str pred)))) + table)) (defun cape--dynamic-table (beg end fun) "Create dynamic completion table from FUN with caching. |
