diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 7d784ef3b1b..e0c282a54e5 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -3260,8 +3260,7 @@ read-char-by-name (affixation-function . ,#'mule--ucs-names-affixation) (group-function - . ,(when completions-group - #'mule--ucs-names-group)) + . ,#'mule--ucs-names-group) (category . unicode-name)) (complete-with-action action (ucs-names) string pred))))) (char diff --git a/lisp/imenu.el b/lisp/imenu.el index 8f1b1f22a67..6efa2d55966 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -770,11 +776,12 @@ imenu--completion-buffer ,(lambda (s) (get-text-property 0 'imenu-section s)))) ,@(when (eq imenu-flatten 'group) - `(:group-function - ,(lambda (s transform) - (if transform s - (get-text-property - 0 'imenu-section s))))))) + `( :group-p t + :group-function + ,(lambda (s transform) + (if transform s + (get-text-property + 0 'imenu-section s))))))) (unless imenu-eager-completion-buffer (minibuffer-completion-help))) (setq name (completing-read prompt diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e8e0f169197..1269bab0d40 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1231,6 +1231,10 @@ completion-category-overrides (const :tag "Historical sorting" minibuffer-sort-by-history) (function :tag "Custom function"))) + (cons :tag "Use Groups" + (const :tag "Enable groups." + group-p) + (boolean)) (cons :tag "Completion Groups" (const :tag "Select one value from the menu." group-function) @@ -1809,7 +1813,8 @@ completion-all-sorted-completions minibuffer-completion-table minibuffer-completion-predicate)) (sort-fun (completion-metadata-get all-md 'cycle-sort-function)) - (group-fun (completion-metadata-get all-md 'group-function))) + (group-fun (completion-metadata-get all-md 'group-function)) + (group-p (completion-metadata-get all-md 'group-p))) (when last (setcdr last nil) @@ -1821,7 +1826,7 @@ completion-all-sorted-completions (cond (sort-fun (setq all (funcall sort-fun all))) - ((and completions-group group-fun) + ((and (or completions-group group-p) group-fun) ;; TODO: experiment with re-grouping here. Might be slow ;; if the group-fun (given by the table and out of our ;; control) is slow and/or allocates too much. @@ -2610,7 +2615,9 @@ minibuffer-completion-help (ann-fun (completion-metadata-get all-md 'annotation-function)) (aff-fun (completion-metadata-get all-md 'affixation-function)) (sort-fun (completion-metadata-get all-md 'display-sort-function)) - (group-fun (completion-metadata-get all-md 'group-function)) + (group-p (completion-metadata-get all-md 'group-p)) + (group-fun (when (or completions-group group-p) + (completion-metadata-get all-md 'group-function))) (mainbuf (current-buffer)) ;; If the *Completions* buffer is shown in a new ;; window, mark it as softly-dedicated, so bury-buffer in diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 2ea5e36fa88..07b8ec83cf9 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -791,8 +791,7 @@ icomplete--augment by `group-function''s second \"transformation\" protocol." (let* ((aff-fun (completion-metadata-get md 'affixation-function)) (ann-fun (completion-metadata-get md 'annotation-function)) - (grp-fun (and completions-group - (completion-metadata-get md 'group-function))) + (grp-fun (completion-metadata-get md 'group-function)) (annotated (cond (aff-fun (funcall aff-fun prospects))