~breatheoutbreathein/chordpro-mode.el

Major mode for ChordPro lead sheet file format
Meta: Update makem submodule
Fix: Add defgroup
Meta: Install makem as a git submodule

clone

read-only
https://git.sr.ht/~breatheoutbreathein/chordpro-mode.el
read/write
git@git.sr.ht:~breatheoutbreathein/chordpro-mode.el

You can also use your local clone with git send-email.

#ChordPro mode

#Introduction

Emacs major mode for editing files in the ChordPro format.

#Installation

Clone this repository, then manually install chordpro-mode with M-x package-install-file.

#Usage

Files with the .cho extension will automatically be opened with chordpro-mode.

#Editing

chordpro-mode.el adds functionality for normalizing (formatting) chords correctly so that the ChordPro command line program can read them. This means inserting brackets, trimming leading and trailing whitespace, and capitalizing chords.

  • ] : Close and normalize chord at point.
  • C-c i : Insert a normalized chord at point.
  • C-c w : Kill the chord at point.
  • C-c z : Kill the next chord after point.
  • C-c r : Replace the chord at point with another normalized chord.
  • C-c c : Copy the chord at point
  • C-c x : Copy the next chord
  • C-M-n : Move chord at point forward PREFIX chars.
  • C-M-p : Move chord at point backward PREFIX chars
  • C-c m : Insert a comment directive
  • C-c e : Insert an enviroment directive, e.g. bridge, chorus, grid, tab, or verse.
  • C-c t : Insert a title directive
  • C-c s : Insert a subtitle directive
  • C-c C-c : Export ChordPro file to PDF

#Generate ChordPro files

Certain websites, such as Ultimate Guitar provide tabs with lyrics and chords in a format that the chordpro program can convert into ChordPro files:

        D        G      D

Swing low, sweet chariot,

                       A7

Comin' for to carry me home.

       D7        G      D

Swing low, sweet chariot,

               A7       D

Comin' for to carry me home.

To replace the text above to ChordPro format, select the region and run chordpro-a2crd with a prefix argument C-u, which deletes empty lines in the region before attempting conversion:

Swing lo[D]w, sweet [G]chariot[D],
Comin' for to carry me [A7]home.
Swing l[D7]ow, sweet [G]chariot[D],
Comin' for to c[A7]arry me h[D]ome.

You can then edit this buffer and save it to a .cho file before exporting it to PDF.

#Export to PDF

If the chordpro command is in your $PATH (installation instructions), M-x chordpro-export will export the current ChordPro buffer to PDF. The ChordPro buffer must be visiting a file on disk in order for this function to work.

#Live export

This hook runs chordpro-export each time you save the buffer:

(add-hook 'after-save-hook #'chordpro-export nil t)

You can get a live preview of the exported PDF if you run an PDF viewer like Zathura which automatically re-renders the document when the underlying file changes:

demo.png

#Customization

  • chordpro-environment-directives

    You can change if you want to insert environment directives besides bridge, chorus, grid, tab, or verse.

#Acknowledgements

  • Howard Ding for writing the original version of chordpro-mode.el
  • Johan Vromans for writing chordpro and for feedback on chordpro-mode.el

#Changelog

#2.3.0-pre

Nothing yet...

#2.2.0

  • Add chordpro-insert-environment-directive command and chordpro-environment-directives customization option
  • Remove chordpro-insert-chorus (superceded by chordpro-insert-environment-directive)

#2.1.0

  • Add chordpro-a2crd function
  • Add chordpro-close-chord function for easy editing
  • Bind chordpro-export to C-c C-c
  • Handle errors in chordpro-export
  • Rename chordpro-transpose-* to chordpro-move-* for clarity

#2.0

  • Forked in 2023
  • Add chordpro-export function
  • Remove broken mouse keybindings
  • Use thingatpt for chords
  • Clean up obsolete code
  • Add .cho to auto-mode-alist

#1.0

  • Initial version created by Howard Ding in 2014