;;; Install packages
+(unless (eq system-type 'android)
+ (elpaca org-transclusion)
+ (elpaca (sweeprolog
+ :repo "~/checkouts/sweep/"
+ :files ("*.org" "*.texi" "sweep.pl"
+ "sweeprolog-pce-theme.el" "sweeprolog.el"))))
(elpaca avy)
(elpaca (bbdb
:repo "https://git.savannah.nongnu.org/git/bbdb.git"
("mv" "README.texi" "pdf-tools.texi"))))
(elpaca ob-prolog)
-(unless (eq system-type 'android)
- (elpaca org)
- (elpaca org-transclusion)
- (elpaca (sweeprolog
- :repo "~/checkouts/sweep/"
- :files ("*.org" "*.texi" "sweep.pl"
- "sweeprolog-pce-theme.el" "sweeprolog.el"))))
-
(elpaca-wait)
(defvar-keymap esy/elpaca-prefix-map
(add-to-list 'load-path (expand-file-name "lisp/" user-emacs-directory))
(autoload 'some-button "some-button" nil t)
+(autoload 'completions-auto-update-mode "completions-auto-update" nil t)
(unless (eq system-type 'android)
(add-to-list 'load-path "~/checkouts/esy-publish/")
(dolist (key-binding '(("C-p" . minibuffer-previous-completion)
("C-n" . minibuffer-next-completion)
- ("M-j" . minibuffer-force-complete-and-exit)))
+ ("M-j" . minibuffer-force-complete-and-exit)
+ ("SPC" . nil)))
(keymap-set minibuffer-local-completion-map
(car key-binding)
(cdr key-binding)))
show-paren-mode
transient-mark-mode
winner-mode
+ completions-auto-update-mode
))
(funcall mode))
--- /dev/null
+;;; completions-auto-update.el --- Auto-update minibuffer completions -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2023 Eshel Yaron
+
+;; Author: Eshel Yaron <me@eshelyaron.com>
+;; Keywords: convenience
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file defines a minor mode `completions-auto-update-mode' that
+;; updates the *Completions* buffer as you type in the minibuffer.
+
+;;; Code:
+
+(defcustom completions-auto-update-idle-time 0.2
+ "Number of seconds of idle to wait for before updating *Completions*."
+ :group 'minibuffer
+ :type 'number)
+
+(defvar-local completions-auto-update-timer nil)
+
+(defun completions-auto-update ()
+ "Update the *Completions* buffer, if it is visible."
+ (when (get-buffer-window "*Completions*")
+ (if completion-in-region-mode
+ (completion-help-at-point)
+ (minibuffer-completion-help)))
+ (setq completions-auto-update-timer nil))
+
+(defun completions-auto-update-start-timer ()
+ "Start an idle timer for updating *Completions*."
+ (unless (or completions-auto-update-timer
+ (not (get-buffer-window "*Completions*")))
+ (setq completions-auto-update-timer
+ (run-with-idle-timer completions-auto-update-idle-time
+ nil #'completions-auto-update))))
+
+(defun completions-auto-update-setup ()
+ (add-hook 'post-self-insert-hook #'completions-auto-update-start-timer nil t))
+
+(defun completions-auto-update-exit ()
+ (remove-hook 'post-self-insert-hook #'completions-auto-update-start-timer t))
+
+(define-minor-mode completions-auto-update-mode
+ "Update the *Completions* buffer as you type in the minibuffer."
+ :global t :group 'minibuffer
+ (if completions-auto-update-mode
+ (progn
+ (add-hook 'minibuffer-setup-hook #'completions-auto-update-setup)
+ (add-hook 'minibuffer-setup-exit #'completions-auto-update-exit))
+ (remove-hook 'minibuffer-setup-hook #'completions-auto-update-setup)
+ (remove-hook 'minibuffer-setup-exit #'completions-auto-update-exit)))
+
+(provide 'completions-auto-update)
+;;; completions-auto-update.el ends here