WIP: Texinfo.

This commit is contained in:
David Keegan 2013-11-03 10:17:49 +00:00
parent d35d626b75
commit 66346df88e

View file

@ -6,8 +6,9 @@
@c %**end of header @c %**end of header
@syncodeindex fn cp @syncodeindex fn cp
@syncodeindex vr cp
@syncodeindex ky cp @syncodeindex ky cp
@syncodeindex pg cp
@syncodeindex vr cp
@c Before release, run C-u C-c C-u C-a @c Before release, run C-u C-c C-u C-a
@c (texinfo-all-menus-update with a prefix arg). This @c (texinfo-all-menus-update with a prefix arg). This
@ -66,6 +67,12 @@ Foundation GNU Free Documentation Licence.
@top Ledger Recurring Transactions @top Ledger Recurring Transactions
@end ifnottex @end ifnottex
An add-on to ledger-mode which appends recurring
transactions to the current ledger file, usually on entry to
ledger-mode. Recurring transactions are configured in a
separate file which conforms to ledger file format and
resides in the same directory as the ledger file.
@menu @menu
* Introduction:: * Introduction::
* Configuration File:: * Configuration File::
@ -86,56 +93,77 @@ Foundation GNU Free Documentation Licence.
@node Overview @node Overview
@section Overview @section Overview
An add-on to ledger-mode, this package appends recurring @cindex recurring transactions
transactions to the current ledger file, usually on entry @cindex transactions, recurring
to @code{ledger-mode}. @pindex ledger
Recurring transactions are accounting transactions that
repeat at regular intervals such as paychecks, standing
orders, and pension contributions. This emacs package
appends recurring transactions to a ledger file, the input
file for John Wiegley's ledger program. @xref{Top,,
Overview, ledger3, Ledger: Command-Line Accounting}.
@findex @code{ledger-mode}
An add-on to emacs ledger-mode, the package appends
recurring transactions to the current ledger file, usually
on entry to @code{ledger-mode}. @xref{Top,,Overview,
ledger-mode, Ledger Mode}.
@cindex configuration file
Recurring transactions are configured in a separate file Recurring transactions are configured in a separate file
which conforms to ledger file format, and resides in the which conforms to ledger file format, and resides in the
same directory as the ledger file. same directory as the ledger file. @xref{Configuration File}.
@node Getting Started @node Getting Started
@section Getting Started @section Getting Started
To append recurring transactions on entry to ledger-mode, @findex @code{dklrt-AppendRecurringMaybe}
add this line to your emacs profile: To append recurring transactions automatically on entry to
@code{ledger-mode}, add this line to your emacs profile:
@lisp @lisp
(add-hook 'ledger-mode-hook 'dklrt-AppendRecurringMaybe) (add-hook 'ledger-mode-hook 'dklrt-AppendRecurringMaybe)
@end lisp @end lisp
To bind @kbd{\C-cr} to dklrt-AppendRecurring while in ledger-mode To bind @kbd{\C-cr} to @code{dklrt-AppendRecurringMaybe} while in
only, add this line to your emacs profile (optional): @code{ledger-mode} only, add this line to your emacs profile
(optional):
@findex @code{dklrt-SetCcKeys}
@lisp @lisp
(add-hook 'ledger-mode-hook 'dklrt-SetCcKeys) (add-hook 'ledger-mode-hook 'dklrt-SetCcKeys)
@end lisp @end lisp
@vindex @code{dklrt-SortAfterAppend}
If you want to have recurring transactions positioned by date in If you want to have recurring transactions positioned by date in
the ledger file, add this line to your emacs profile (optional): the ledger file, add this line to your emacs profile (optional):
(setq dklrt-SortAfterAppend t) (setq dklrt-SortAfterAppend t)
Note that as this causes the ledger buffer to be sorted, it Note that as this causes the whole ledger buffer to be
may, as a side-effect, change the positions of non-recurring sorted after transactions are appended, it affects the
transactions. positions of all transactions.
@node Known Issues @node Known Issues
@section Known Issues @section Known Issues
@cindex issues
@cindex limitations
@enumerate @enumerate
@item @item
In the configuration file, transaction dates must be In the configuration file, a transaction date must be
expressed in ISO format, eg ``YYYY-MM-DD'' or expressed in ISO format, eg ``YYYY-MM-DD'' or
``YYYY/MM/DD'', and this format is preserved when the ``YYYY/MM/DD''. This format is preserved when the
transaction is appended to the ledger file. This is transaction is appended to the ledger file. It is compatible
compatible with ledger's default date format, and should with ledger's default date format, and should work with
work with ledger-mode. @code{ledger-mode}.
Problems can be expected if --input-date-format has been Problems can be expected if --input-date-format has been
configured with a non-ISO format in the ledger init file configured with a non-ISO format in the ledger init file
(.ledgerrc) or on the ledger command line. (.ledgerrc) or on the ledger command line.
@xref{Configuration File}.
@vindex @code{dklrt-PythonProgram}
@item @item
Depends on some python code which is included in the package Depends on some python code which is included in the package
(and requires that python is installed on the system). The (and requires that python is installed on the system). The
@ -146,11 +174,14 @@ python program is customisable via variable
@node History @node History
@section History @section History
This package was written between 2011-06-08 and 2011-08-17. This package was developed between 2011-06-08 and 2011-08-17.
@node Configuration File @node Configuration File
@chapter Configuration File @chapter Configuration File
@cindex configuration file
@cindex file, configuration
@vindex @code{dklrt-RecurringConfigFileSuffix}
Recurring transactions for a particular ledger file are Recurring transactions for a particular ledger file are
configured in a separate file. The configuration file is in configured in a separate file. The configuration file is in
the same directory as the ledger file, and its filename is the same directory as the ledger file, and its filename is
@ -188,51 +219,58 @@ ledger file format. For example:
@end verbatim @end verbatim
@end smallformat @end smallformat
Each transaction is considered to begin with a transaction Each transaction date is followed by a repetition period
date at the beginning of a line, and includes the remainder in the position normally occupied by a ledger transaction
of the line and all subsequent lines up to but excluding the code.
next transaction date.
The date is followed by a repetition interval in the A transaction is considered to begin with a transaction date
position normally occupied by a ledger transaction code. at the beginning of a line, and includes the remainder of
the line and all subsequent lines up to but excluding the
The transaction date in the configuration file controls when next transaction date. The transaction date in the
the transaction becomes due for appending to the ledger file, configuration file controls when the transaction becomes due
and is the actual transaction date once appended. for appending to the ledger file, and is the actual
transaction date once appended.
@node Date and Period @node Date and Period
@section Date and Period @section Date and Period
@cindex transaction date
@cindex date, transaction
The transaction date must be in ISO format: ``YYYY-MM-DD'' The transaction date must be in ISO format: ``YYYY-MM-DD''
or ``YYYY/MM/DD''. It occurs at the beginning of a line and or ``YYYY/MM/DD''. It occurs at the beginning of a line and
marks the start of a transaction (and the end of the marks the start of a transaction (and the end of the
previous transaction, if any). previous transaction, if any).
@cindex repetition period
@cindex repetition interval
@cindex period, repetition
@cindex interval, repetition
A parenthesised transaction repetition period must follow A parenthesised transaction repetition period must follow
the date in the position where a ledger transaction ``code'' the date in the position where a ledger transaction ``code''
would normally occur. It is surrounded by whitespace and is would normally occur. It is surrounded by whitespace and is
in the following format: in the following format:
@cindex time interval
@verbatim @verbatim
(<Digits><Unit>) (<Count><Unit>)
@end verbatim @end verbatim
Where: Where:
@table @code @table @code
@item Digits @item Count
An unsigned decimal integer period count. An unsigned decimal integer.
@item Unit @item Unit
A single character from the following: y (year), m (month) w A single character from the following: y (year), m (month) w
(week), d (day), specifying the period unit and following (week), d (day), specifying the period unit and following
immediately after the integer without intervening space. immediately after the Count integer without intervening
space.
@end table @end table
@node Restrictions @node Restrictions
@section Restrictions @section Restrictions
@cindex restrictions, configuration file
The recurring transactions configuration file must not The recurring transactions configuration file must not
contain any of the following ledger constructs: contain any of the following ledger constructs:
@ -253,6 +291,7 @@ Period transaction (starts with ``~'').
Command directive. Command directive.
@end enumerate @end enumerate
@cindex restrictions, transaction date/payee line
In addition the following restrictions apply to the the In addition the following restrictions apply to the the
initial (date/payee) line of each transaction: initial (date/payee) line of each transaction:
@ -263,18 +302,21 @@ date suffix (of the form ``=YYYY-MM-DD'').
@item @item
A transaction state/clear flag (immediately after the date) A transaction state/clear flag (immediately after the date)
is @emph{NOT} permitted. is @emph{not} permitted.
@end enumerate @end enumerate
@node Operations @node Operations
@chapter Operations @chapter Operations
@findex @code{dklrt-AppendRecurringMaybe}
The main entry point is function The main entry point is function
@code{dklrt-AppendRecurringMaybe}. This is normally @code{dklrt-AppendRecurringMaybe}. This is normally
configured to run automatically on entry to configured to run automatically on entry to
@code{ledger-mode}. It can also be bound to a key @code{ledger-mode}. It can also be bound to a key
(@kbd{\C-cr} is suggested). (@kbd{\C-cr} is suggested).
@cindex append pre-conditions
@cindex pre-conditions, append
Function @code{dklrt-AppendRecurringMaybe} does nothing Function @code{dklrt-AppendRecurringMaybe} does nothing
unless all the following conditions are met: unless all the following conditions are met:
@ -290,7 +332,7 @@ The current buffer is unmodified.
The file associated with the current buffer exists. The file associated with the current buffer exists.
@item @item
The current file is NOT a recurring transaction config file The current file is @emph{not} a recurring transaction config file
(ie does not have suffix @file{.rec}). (ie does not have suffix @file{.rec}).
@item @item
@ -302,27 +344,34 @@ ledger file (same directory and basename, but with suffix
If all the conditions are met, recurring transactions are If all the conditions are met, recurring transactions are
read from the config file and their dates are compared with read from the config file and their dates are compared with
the current date. the current date.
If the transaction is considered @cindex appended transaction
``due'', the transaction is appended to the ledger file. The @cindex transaction, appended
append includes the full transaction text as it appears in If a transaction is considered ``due'', it is appended to
the configuration file, except that the repetition interval the ledger file. The append includes the full transaction
(including enclosing parentheses) is removed. text as it appears in the configuration file, except that
the repetition period (including enclosing parentheses) is
removed.
Once a recurring transaction has been appended to the ledger Once a recurring transaction has been appended to the ledger
file its transaction date in the configuration file is file, the transaction date is shifted forward by the
shifted forward by the repetition interval to date of the repetition period to the date of the next append and written
next append. back to the configuration file. @xref{Configuration File}.
By default a recurring transaction becomes due up to one day @cindex append due time
before its actual transaction date. This is customisable via @cindex due time, append
variable @code{dklrt-AppendBefore}. @vindex @code{dklrt-AppendBefore}
By default, a recurring transaction becomes due up to one
day before its current transaction date. This is
customisable via variable @code{dklrt-AppendBefore}.
The ledger file can optionally be sorted after recurring @cindex sort transactions
transactions are appended so transactions remain ordered by @vindex @code{dklrt-SortAfterAppend}
date. This behaviour is customisable via variable After recurring transactions have been appended, the ledger
@code{dklrt-SortAfterAppend} file can optionally be sorted to keep transactions ordered
by date. This behaviour is customisable via variable
@code{dklrt-SortAfterAppend}.
@node Index @node Index
@chapter Index @chapter Index