1
0
Fork 0

Add prescient

This commit is contained in:
Tom Willemse 2020-02-24 23:11:41 -08:00
parent 1acb64f9c8
commit cc8de9b58e
4 changed files with 63 additions and 4 deletions

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2019.0904.210401 ;; Version: 2020.0224.231120
;; Package-Requires: (company company-posframe diminish) ;; Package-Requires: (company oni-prescient company-posframe diminish company-prescient)
;; This program is free software; you can redistribute it and/or modify ;; 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 ;; it under the terms of the GNU General Public License as published by
@ -29,6 +29,7 @@
(require 'company) (require 'company)
(require 'company-dabbrev) (require 'company-dabbrev)
(require 'company-posframe) (require 'company-posframe)
(require 'company-prescient)
(require 'diminish) (require 'diminish)
(defun oni-company--enable-posframe (_) (defun oni-company--enable-posframe (_)
@ -49,6 +50,8 @@
(add-hook 'company-completion-started-hook 'oni-company--enable-posframe) (add-hook 'company-completion-started-hook 'oni-company--enable-posframe)
(company-prescient-mode)
(diminish 'company-mode) (diminish 'company-mode)
(diminish 'company-posframe-mode) (diminish 'company-posframe-mode)

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2019.0918.110642 ;; Version: 2020.0224.231056
;; Package-Requires: (ivy ivy-hydra diminish ivy-posframe) ;; Package-Requires: (ivy oni-prescient ivy-hydra diminish ivy-posframe ivy-prescient)
;; This program is free software; you can redistribute it and/or modify ;; 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 ;; it under the terms of the GNU General Public License as published by
@ -29,6 +29,7 @@
(require 'ivy) (require 'ivy)
(require 'ivy-hydra) (require 'ivy-hydra)
(require 'ivy-posframe) (require 'ivy-posframe)
(require 'ivy-prescient)
(defun oni-ivy--disable (orig-fun &rest args) (defun oni-ivy--disable (orig-fun &rest args)
"Disable ivy while running ORIG-FUN with ARGS." "Disable ivy while running ORIG-FUN with ARGS."
@ -53,6 +54,7 @@
(add-hook 'emacs-startup-hook 'ivy-mode) (add-hook 'emacs-startup-hook 'ivy-mode)
(ivy-posframe-mode) (ivy-posframe-mode)
(ivy-prescient-mode)
(diminish 'ivy-posframe-mode) (diminish 'ivy-posframe-mode)
(diminish 'ivy-mode) (diminish 'ivy-mode)

43
oni-prescient.el Normal file
View file

@ -0,0 +1,43 @@
;;; oni-prescient.el --- Configuration for prescient -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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 <https://www.gnu.org/licenses/>.
;;; 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

View file

@ -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" ]
}