Skip to content

tvirolai/quotient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quotient

https://melpa.org/packages/quotient-badge.svg

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).

./demo.gif

Usage

Quotient exposes two interactive functions:

FunctionDescription
quotient-display-random-excerptDisplay a quote in the minibuffer.
quotient-set-scratch-messageGenerate 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

An example configuration

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

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

About

An Emacs package to generate quotes from corpus files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors