GitXplorerGitXplorer
s

org-commentary

public
9 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
821ccb994811359c42f4e3d459e0e88849d42b75

Write MELPA section of README

ssmaximov committed 8 years ago
Unverified
54ef5abeede85b1e87d77608f703450ea6f9d865

Add melpa badges

ssmaximov committed 8 years ago
Unverified
de5a63f075fdfc1964cc10bc83e2dc15ff411235

Signal `user-error` instead of `error` on malformed headers

ssmaximov committed 8 years ago
Unverified
11dc29ec022bb3b5c963fbd399301e43059d5630

Fix a typo in a test

ssmaximov committed 8 years ago
Unverified
71a0aa31a17214ba3b0188f7fe5097a216ddb120

Reindent sexprs after renaming the package

ssmaximov committed 8 years ago
Unverified
8666f676f334f9f1e3ae4aa2487fded612da2ad4

Update CHANGELOG

ssmaximov committed 8 years ago

README

The README file for this repository.

#+DRAWERS: NOEXPORT #+OPTIONS: d:(not "NOEXPORT")

  • org-commentary

:NOEXPORT: [[http://melpa.org/#/org-commentary][file:http://melpa.org/packages/org-commentary-badge.svg]] [[http://stable.melpa.org/#/org-commentary][file:http://stable.melpa.org/packages/org-commentary-badge.svg]] [[http://www.gnu.org/licenses/gpl-3.0.txt][https://img.shields.io/badge/license-GPL_3-green.svg]] [[https://travis-ci.org/smaximov/org-commentary][https://travis-ci.org/smaximov/org-commentary.svg?branch=master]] [[https://coveralls.io/github/smaximov/org-commentary?branch=master][https://coveralls.io/repos/github/smaximov/org-commentary/badge.svg?branch=master]] :END:

=org-commentary= — generate or update conventional [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html][library headers]] using Org mode files.

** Why?

If you have a README file with the description of your Emacs Lisp package (which you definetely should have), you may as well want to use that file as the canonical source of the documentation for the package. However, there is another place which needs this documentation: the commentary section of your main library file; you can update it manually, but it's tedious and error prone (not to mention it's a violation of the [[https://en.wikipedia.org/wiki/Don't_repeat_yourself][DRY]] principle).

Org mode has built-in export facilities which can be used to convert Org documents into various formats, including a simple plain text format (=ascii= backend).

This package employs these facilities to generate library headers from Org files automatically; it may be used either from inside of Emacs or from the command line.

** Installation

You can skip this section if you're going to use =org-commentary= as a development dependency of a [[https://github.com/cask/cask][Cask]]-managed project.

*** MELPA

=org-commentary= is available on both MELPA and MELPA Stable. Enable the corresponding repository by adding an entry to =package-archives=:

#+begin_src elisp (require 'package) ;; you can enable MELPA Stable instead: ;; (add-to-list 'package-archives ;; '("melpa-stable" . "https://stable.melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) #+end_src

See the [[https://melpa.org/#/getting-started][documentation]] on more details about setting up MELPA repositories.

To install =org-commentary= use Emacs' package menu at M-x list-packages or run M-x package-install RET org-commentary RET.

** Getting started

/Note/: these steps are written with assumption you're using Cask for project management; otherwise, see [[#not-using-cask][Not using Cask?]] section below for instructions on how to use =org-commentary= CLI without Cask.

  1. [Optional] If you have installed =org-commentary= manually, create a link to =org-commentary=:

    #+begin_src bash $ cask link org-commentary path/to/org-commentary/installation #+end_src

  2. Add =org-commentary= to the development dependencies of your library:

    #+begin_src lisp (development (depends-on "org-commentary")) #+end_src

    Fetch dependencies:

    #+begin_src bash $ cask install #+end_src

  3. Put the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html][library header]] boilerplate in your ELisp file.

  4. Generate /Commentary/ section of the library headers:

    #+begin_src bash $ cask exec org-commentary README.org your-package.el #+end_src

  5. [Optional] Generate /Change Log/ section of the library headers:

    #+begin_src bash $ cask exec org-commentary --section changelog CHANGELOG.org your-package.el #+end_src

  6. Commit.

** Command line interface

=org-commentary= provides an executable script which can be invoked like this:

#+begin_src bash $ cask exec org-commentary [OPTION]... ORG-FILE ELISP-FILE #+end_src

Run cask exec org-commentary --help to see available options.

*** Not using Cask? :PROPERTIES: :CUSTOM_ID: not-using-cask :END:

Provided =org-commentary= is installed via the built-in package manager, you can invoke it from the shell like this:

#+begin_src bash $ emacs -Q --batch --eval '(package-initialize)' -l org-commentary-cli -f
org-commentary -- [OPTION]... ORG-FILE ELISP-FILE #+end_src

For example, to see available options, run

#+begin_src bash $ emacs -Q --batch --eval '(package-initialize)' -l org-commentary-cli -f org-commentary -- --help #+end_src

** API

Use M-x describe-function for details.

  • command org-commentary-update

    Update library headers using the content of an Org document.

  • function org-commentary-export-buffer-as-string.

    Export the Org document opened in the current buffer as a string.

  • function org-commentary-export-file-as-string.

    Export an Org document as a string.

** Customization

The user can set a number of options which affect the exporting process.

Each option can be set in several ways:

  • in-file keyword

    A line which starts with a =#+= followed by a keyword, a colon and then individual words defining a setting. Example:

    #+begin_src org ,#+TITLE: the title of the document #+end_src

  • in-file option

    An option in compact form using the =#+OPTIONS= keyword:

    #+begin_src org ,#+OPTIONS: opt1 opt2 opt3 ... optN #+end_src

    =opt= consists of a short key followed by a value. For example, option =toc:= toggles inclusion of the table of contents; the following setting excludes the table of contens from export:

    #+begin_src org ,#+OPTIONS: toc:nil #+end_src

    Accepted values vary from option to option.

    To specify a rather long list if such options, one can use several =#+OPTIONS= lines.

  • property

    An option specified via the optional property list =EXT-PLIST= passed as the last argument of the public functions (see the API section). For example, to enable export using UTF-8 characters, pass (list :ascii-charset 'utf-8) as the last argument of an export function.

  • variable

    A global variable.

This package also enables setting the options via command line arguments, which are mapped to the corresponding properties.

In-file settings take precedence over keyword properties, which in turn override global variables.

This section gives a brief description of common options; for more details, see the dedicated sections ([[http://orgmode.org/manual/Export-settings.html][Export settings]], [[http://orgmode.org/manual/Publishing-options.html][Publishing options]]) of the Org mode manual.

*** Inclusion of the table of contents (TOC)

The table of content is normally inserted before the first headline of the file.

  • in-file option =toc:=

    If this options is a number, use this number as the depth of the generated TOC. Setting this option to =nil= disables default TOC.

    Synonyms:

    • property =:toc=
    • variable =org-commentary-with-toc=
  • in-file keyword =#+TOC=

    Insert TOC at the current position.

See [[http://orgmode.org/manual/Table-of-contents.html][Table of contents]] for more details.

*** Inclusion of subtrees

  • in-file keyword =#+EXCLUDE_TAGS=

    The tags that exclude a tree from export (the default value is =:noexport:=).

    Alternatives:

    • in-file option =exclude-tags:=
    • property =:exclude-tags=
    • variable =org-export-exclude-tags=
  • in-file keyword =#+INCLUDE_TAGS=

    The tags that select a tree for export (the default value is =:export:=). This setting takes precedence over =#+EXCLUDE_TAGS=.

    Alternatives:

    • in-file option =select-tags:=
    • property =:select-tags=
    • variable =org-export-select-tags=

*** Inclusion of drawers

/Note/: you need to specify custom drawers using the =#+DRAWERS= keyword for Org mode versions prior to 8.3.

  • in-file optons =d:=

    A list of drawers to include. If the first element is the atom =not=, specify drawers to exclude instead.

    Alternatives:

    • property =:with-drawers=
    • variable =org-export-with-drawers=

*** Inclusion of tags

  • in-file option =tags:=

    Toggles inclusion of tags.

    Alternatives:

    • property =:with-tags=
    • variable =org-export-with-tags=

*** Export charset

  • property =:ascii-charset=

    The charset allowed to represent various elements and objects during export (the default value is =ascii=).

    Alternatives:

    • variable =org-ascii-charset=,
    • command-line argument =--charset= (=-c=)

** Contributing :noexport:

*** Prerequisites

You need [[https://github.com/cask/cask][Cask]] installed (see [[http://cask.readthedocs.io/en/latest/guide/installation.html][docs]]).

*** Setup

Clone the repository:

#+begin_src bash $ git clone git@github.com:smaximov/org-commentary.git #+end_src

Install dependencies:

#+begin_src bash $ make dep-install #+end_src

*** Preparing a pull request

Make sure all tests pass:

#+begin_src bash $ make test #+end_src

Update package's commentary header if you have made changes to [[file:README.org][README.org]] (do not edit it by hand!):

#+begin_src bash $ make update-headers #+end_src

Commit final changes and create a pull request, describing briefly what it does.

** Similar projects

** License :noexport:

This program is distributed under the terms of GNU General Public License, version 3 or any later version. See [[file:COPYING][COPYING]] for details.