Quotient is a small package that generates random quotes (excepts) from a corpus file and sets them on the top of the scratch buffer, as the eshell banner or just displays them in the minibuffer.
The corpus file can be any plain text file you like: think song lyrics, poetry, literature, screenplays, Wikipedia dump, etc. Quotient will quote it by taking random excerpts from it and displaying them inside Emacs. The content does not need to be structured in any particular way: Quotient takes a random sample of rows (blank lines are ignored) with the length you can define (see below).
Quotient exposes two interactive functions:
| Function | Description |
|---|---|
quotient-display-random-excerpt | Display a quote in the minibuffer. |
quotient-set-scratch-message | Generate a new quote and set it to the scratch buffer. |
There is also quotient-generate-excerpt which generates and returns a quote, in case you want to do this programmatically. It accepts an optional argument for formatting the quote:
'comment: prefix each line with a double semicolon and a space (;;)'eshell: add two line breaks at the end to make some space between a quote and the shell row
Installation using straight.el.
(straight-use-package 'use-package)
(use-package quotient
:ensure t
:straight (quotient :type git :host github :repo "tvirolai/quotient")
:hook ((after-init . (lambda ()
(setq initial-scratch-message (quotient-generate-excerpt 'comment)))))
:bind (("C-c §" . quotient-set-scratch-message)) ;; Manually reset the scratch message
:custom
(quotient-corpus "~/Desktop/corpus.txt")
(quotient-excerpt-length 4)) ;; The default, only needs to be set if you want something else.
(use-package eshell
:after quotient
:init
(setq eshell-banner-message (quotient-generate-excerpt 'eshell)))Installation from MELPA works the same way.
(use-package quotient
:ensure t
:hook ((after-init . (lambda ()
(setq initial-scratch-message (quotient-generate-excerpt 'comment)))))
:bind (("C-c §" . quotient-set-scratch-message)) ;; Manually reset the scratch message
:custom
(quotient-corpus "~/Desktop/corpus.txt"))
(use-package eshell
:after quotient
:init
(setq eshell-banner-message (quotient-generate-excerpt 'eshell)))