Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smaximov/org-commentary
Generate and update ELisp library headers using Org mode files
https://github.com/smaximov/org-commentary
Last synced: 2 months ago
JSON representation
Generate and update ELisp library headers using Org mode files
- Host: GitHub
- URL: https://github.com/smaximov/org-commentary
- Owner: smaximov
- License: gpl-3.0
- Created: 2016-07-19T21:15:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-02T06:37:31.000Z (over 8 years ago)
- Last Synced: 2024-08-02T01:26:13.667Z (6 months ago)
- Language: Emacs Lisp
- Homepage:
- Size: 130 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.org
- License: COPYING
Awesome Lists containing this project
README
#+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_srcSee 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.0. [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_src1. Add =org-commentary= to the development dependencies of your library:
#+begin_src lisp
(development
(depends-on "org-commentary"))
#+end_srcFetch dependencies:
#+begin_src bash
$ cask install
#+end_src2. Put the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html][library header]] boilerplate in your ELisp file.
3. Generate /Commentary/ section of the library headers:
#+begin_src bash
$ cask exec org-commentary README.org your-package.el
#+end_src4. [Optional] Generate /Change Log/ section of the library headers:
#+begin_src bash
$ cask exec org-commentary --section changelog CHANGELOG.org your-package.el
#+end_src5. 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_srcRun ~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_srcFor 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_srcAccepted 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 [email protected]:smaximov/org-commentary.git
#+end_srcInstall dependencies:
#+begin_src bash
$ make dep-install
#+end_src*** Preparing a pull request
Make sure all tests pass:
#+begin_src bash
$ make test
#+end_srcUpdate 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_srcCommit final changes and create a pull request, describing briefly what it does.
** Similar projects
- [[https://github.com/cute-jumper/org2elcomment][org2elcomment]] - provides an interactive function to update the commentary
section of an Emacs Lisp file using the contents of an Org file opened in
the current buffer.
- [[https://github.com/mgalgs/make-readme-markdown][make-readme-markdown]] - in contrast to =org-commentary=, this package treats
an Emacs Lisp file as the canonical source of documentation. That file is
used to generate =README= in the Markdown format. The package provides
additional features like auto-detected badges and API documentation of public functions.** 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.