From eb65da7d715a2767cab0a2ad354ab205868af1ca Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Sat, 11 Dec 2021 12:43:59 +0100 Subject: [PATCH] Allow minibuffer completion on previous input --- README.org | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.org b/README.org index 8005d5b..aafc0a5 100644 --- a/README.org +++ b/README.org @@ -536,6 +536,30 @@ niche than the five packages above. (add-hook hook #'company-mode)))) #+end_src +** Minibuffer history completion + +See [[https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00802.html][Juri Linkov (Emacs Developer mailing list)]] for how to allow completion on +previous input in the minibuffer. + +#+attr_latex: :options bgcolor=LightGoldenrodYellow +#+begin_src emacs-lisp + (defun minibuffer-setup-history-completions () + (unless (or minibuffer-completion-table minibuffer-completion-predicate) + (setq-local minibuffer-completion-table + (symbol-value minibuffer-history-variable)))) + + (add-hook 'minibuffer-setup-hook 'minibuffer-setup-history-completions) + + ;; Adapted from ‘minibuffer-complete’: + (defun my-minibuffer-complete-history () + (interactive) + (completion-in-region (minibuffer--completion-prompt-end) (point-max) + (symbol-value minibuffer-history-variable) + nil)) + + (define-key minibuffer-local-map [C-tab] 'my-minibuffer-complete-history) +#+end_src + * Reading ** EPUB files