Allow minibuffer completion on previous input

This commit is contained in:
Gerard Vermeulen 2021-12-11 12:43:59 +01:00
parent 80dbda2308
commit eb65da7d71
1 changed files with 24 additions and 0 deletions

View File

@ -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