diff --git a/oni-company.el b/oni-company.el index edec938..49f6c5f 100644 --- a/oni-company.el +++ b/oni-company.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210401 -;; Package-Requires: (company company-posframe diminish) +;; Version: 2020.0224.231120 +;; Package-Requires: (company oni-prescient company-posframe diminish company-prescient) ;; 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 @@ -29,6 +29,7 @@ (require 'company) (require 'company-dabbrev) (require 'company-posframe) +(require 'company-prescient) (require 'diminish) (defun oni-company--enable-posframe (_) @@ -49,6 +50,8 @@ (add-hook 'company-completion-started-hook 'oni-company--enable-posframe) +(company-prescient-mode) + (diminish 'company-mode) (diminish 'company-posframe-mode) diff --git a/oni-ivy.el b/oni-ivy.el index 81f6abc..8bf3309 100644 --- a/oni-ivy.el +++ b/oni-ivy.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0918.110642 -;; Package-Requires: (ivy ivy-hydra diminish ivy-posframe) +;; Version: 2020.0224.231056 +;; Package-Requires: (ivy oni-prescient ivy-hydra diminish ivy-posframe ivy-prescient) ;; 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 @@ -29,6 +29,7 @@ (require 'ivy) (require 'ivy-hydra) (require 'ivy-posframe) +(require 'ivy-prescient) (defun oni-ivy--disable (orig-fun &rest args) "Disable ivy while running ORIG-FUN with ARGS." @@ -53,6 +54,7 @@ (add-hook 'emacs-startup-hook 'ivy-mode) (ivy-posframe-mode) +(ivy-prescient-mode) (diminish 'ivy-posframe-mode) (diminish 'ivy-mode) diff --git a/oni-prescient.el b/oni-prescient.el new file mode 100644 index 0000000..bf9aea6 --- /dev/null +++ b/oni-prescient.el @@ -0,0 +1,43 @@ +;;; oni-prescient.el --- Configuration for prescient -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: local +;; Version: 2020.0224.224020 +;; Package-Requires: (prescient oni-data-dir) + +;; 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 . + +;;; Commentary: + +;; Configuration for the ‘prescient’ package. It enables +;; ‘prescient-persist-mode’ and adds an idle timer that calls ‘prescient--save’ +;; so that even when Emacs server crashes, the data is still persisted. + +;;; Code: + +(require 'oni-data-dir) +(require 'prescient) + +(setq prescient-save-file (oni-data-dir-locate "prescient-save.el")) + +(run-with-idle-timer 10 t 'prescient--save) + +(prescient-persist-mode) + +;;;###autoload(with-eval-after-load 'prescient (require 'oni-prescient)) + +(provide 'oni-prescient) +;;; oni-prescient.el ends here diff --git a/test/integration/oni-prescient.bats b/test/integration/oni-prescient.bats new file mode 100644 index 0000000..ed506d8 --- /dev/null +++ b/test/integration/oni-prescient.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +@test "Loading prescient loads oni-prescient" { + run emacs -batch -l package -f package-initialize \ + -l prescient \ + -eval "(prin1 (featurep 'oni-prescient))" + + echo "$output" + + [ "$output" = "t" ] +}