Skip to content

Nyx102/worldend2.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

worldend2.el – Emacs interface for WorldEnd2 Formatting

Introduction

This tool helps with the creation of PDFs and EPUBs for WorldEnd2: What Do You Do at the End of the World? Could We Meet Again Once More? (or WorldEnd2 / Suka Moka for short) by providing a simple interactive user interface for generating and viewing volumes.

The main repository containing the volume text and Python tools responsible for the backend functionality is here.

Dependencies

This package depends on virtualenvwrapper and Transient.

Usage

Since this is not on MELPA, you need to clone this to a local directory (i.e. ~/.config/emacs/site-lisp/worldend2/ or ~/.config/doom/lisp/worldend2/).

You also need a Python virtual environment in ~/.virtualenvs/worldend2-formatting (customized by worldend2-venv-name).

Once you have that done, you just need to load and set a keybinding for worldend2-transient-menu:

Doom Emacs

(load! "lisp/worldend2/worldend2")

(map! :leader
      :desc "Launch WorldEnd2 menu"
      :n "W" #'worldend2-transient-menu)

Vanilla Emacs

(require 'worldend2)

(global-set-key (kbd "C-c w") #'worldend2-transient-menu)

Configuration

There are a few variables that you can set, which are summarized in the following table:

NOTE: I have added zero-width spaces to the values in the Default column so that GitHub can display the code correctly.

VariableDefaultDescription
worldend2-git-repo​"​~/worldend2-formatting"​Path to the git repository
worldend2-venv-name​"worldend2-formatting"​Name of the virtual environment
worldend2-default-pdf-view-method​'emacs​Default method for viewing the generated PDF
worldend2-default-epub-view-method​'emacs​Default method for viewing the generated EPUB
worldend2-pdf-generation-extra-args​""​Extra arguments for PDF generation
worldend2-epub-generation-extra-args​""​Extra arguments for EPUB generation

Every variable except for worldend2-git-repo and worldend2-venv-name can be overridden at runtime using the Transient menu, by passing the value in when calling the function, or by pressing the universal argument (C-u) when calling interactively.

There are 4 functions that you can use if you don’t want to use the Transient menu (worldend2-transient-menu):

FunctionDescription
worldend2-generate-pdfGenerate the PDF for the specified volume number with optional extra arguments. If called with the universal argument (C-u), it prompts for both volume number and extra arguments.
worldend2-generate-epubGenerate the PDF for the specified volume number with optional extra arguments. If called with the universal argument (C-u), it prompts for both volume number and extra arguments.
worldend2-goto-directoryGo to the directory of the WorldEnd2 git repository.
worldend2-activate-venvActivate the Python virtual environment for the WorldEnd2 git repository.
worldend2-deactivate-venvDeactivate the Python virtual environment for the WorldEnd2 git repository.
worldend2-view-pdfView the PDF for the specified volume number with optional PDF viewer. If called with the universal argument (C-u), it prompts for both volume number and the PDF viewer.
worldend2-view-epubView the EPUB for the specified volume number with optional EPUB viewer. If called with the universal argument (C-u), it prompts for both volume number and the EPUB viewer.

Example Configuration

Doom Emacs

(load! "lisp/worldend2/worldend2")
(setq worldend2-git-repo (expand-file-name "~/worldend2-formatting"))
(setq worldend2-venv-name "worldend2-formatting")
(setq worldend2-default-pdf-view-method "zathura") ; Default is 'emacs
(setq worldend2-default-epub-view-method "ebook-viewer") ; Default is 'emacs

(map! :leader
      :desc "Launch WorldEnd2 menu"
      :n "W" #'worldend2-transient-menu)

Vanilla Emacs

(require 'worldend)
(setq worldend2-git-repo (expand-file-name "~/worldend2-formatting"))
(setq worldend2-venv-name "worldend2-formatting")
(setq worldend2-default-pdf-view-method "zathura") ; Default is 'emacs
(setq worldend2-default-epub-view-method "ebook-viewer") ; Default is 'emacs

(global-set-key (kbd "C-c w") #'worldend2-transient-menu)

License

GNU GPLv3