Removed EMACS section from Ledger3

This commit is contained in:
Craig Earls 2013-02-27 21:17:47 -07:00
parent ce01c7e56e
commit 20c00bc3af

View file

@ -1252,7 +1252,6 @@ posting.
* Journal Format::
* Converting from other formats::
* Archiving Previous Years ::
* Using EMACS::
@end menu
@node Most Basic Entry, Starting up, Keeping a Journal, Keeping a Journal
@ -2260,7 +2259,7 @@ easily be parsed into Ledger format using one of those tools. Some of the more
function.
@node Archiving Previous Years , Using EMACS, Converting from other formats, Keeping a Journal
@node Archiving Previous Years , , Converting from other formats, Keeping a Journal
@section Archiving Previous Years
@ -2319,314 +2318,6 @@ any electronic statements received during the year. In the arena of
organization, just keep in mind this maxim: Do whatever keeps you
doing it.
@node Using EMACS, , Archiving Previous Years , Keeping a Journal
@section Using EMACS to Maintain Your Journal
@cindex EMACS
@menu
* Running ledger-mode::
* Working with entries::
* Reconciling accounts::
* Generating Reports::
@end menu
@node Running ledger-mode, Working with entries, Using EMACS, Using EMACS
@subsection Running ledger-mode in EMACS
Journal files are simple free text files easily modified by any text
editor. A special mode for EMACS is included with the source
distribution. This mode provides syntax highlighting, a reconcile mode
and a report mode. This makes it quote possible to use ledger without
ever leaving EMACS.
@cindex EMACS .emacs file
Add the following line to your @file{.emacs} (or equivalent,
@file{~/Aquamacs/Preferences.el} for Aquamacs on Mac OS X)
@smallexample
(load "ldg-new")
@end smallexample
Copy the several lisp files (@file{ldg-*.el}) from the source lisp directory your your
@file{site-lisp} directory, or add the ledger lisp source directory to
your EMACS load path by adding:
@smallexample
(add-to-list 'load-path "~/ledger/lisp")
@end smallexample
@noindent to your @file{.emacs} file.
To trigger ledger mode when you visit a journal file, the first line of
each of your journal files should be:
@smallexample
; -*-ledger-*-
@end smallexample
To enter ledger-mode on a new file, type @command{M-x ledger-mode}.
Once you have loaded a Journal file into EMACS, you have several
commands available to make entering, clearing and reconciling
transactions and producing reports (these are also available from the
menu if you can't remember the key combinations):
@cindex EMACS commands
@table @code
@item C-i or <TAB>
auto complete entry
@item C-c C-a
add a new entry, based on previous entries
@item C-c C-e
toggle cleared status of an entire entry
@item C-c C-c
toggle cleared status of an individual posting
@item C-c C-f
toggle folding mode. When on shows only transactions that meet a given REGEX
@item C-c C-y
set default year for entry mode
@item C-c C-m
set default month for entry mode
@item C-c C-r
reconcile uncleared entries related to an account
@item C-c C-d
delete the current entry
@item C-c C-s
sort all entries in the region.
@item C-c C-o C-r
run a ledger report
@item C-C C-o C-g
go to the ledger report buffer
@item C-c C-o C-e
edit the defined ledger reports
@item C-c C-o C-s
save a report definition based on the current report
@item C-c C-o C-a
rerun a ledger report
@item C-c C-o C-k
kill the ledger report buffer
@end table
@menu
* Working with entries::
* Reconciling accounts::
* Generating Reports::
@end menu
@node Working with entries, Reconciling accounts, Running ledger-mode, Using EMACS
@subsection Working with entries
@menu
* Manual Entry Support::
* Hiding Transactions::
* Automagically Adding new entries::
* Clearing Transactions::
* Calculating Values with EMACS Calc::
@end menu
@node Manual Entry Support, Hiding Transactions, Working with entries, Working with entries
@subsubsection Manual Entry Support
@cindex <TAB> completion
@cindex auto-completion
@cindex misspelled accounts treated as new
In most financial programs, some sort of auto-completion is available to
save typing and improve accuracy. Ledger doesn't leave you hanging,
@code{ledger-mode} provides tab completion on all portions of an entry.
Type a portion of the payee and hit @code{<TAB>}, and @code{ledger-mode} will
suggest a completion. When filling in the account type the first few
letters followed by a @code{<TAB>} and the account will be filled in. For
example typing @code{Ex<TAB>Au<TAB>F<TAB>} would yield
@code{Expenses:Auto:Fuel} if you had previously used that account in
this journal. If there are more than one account with similar starting,
hitting @code{<TAB>} multiple times will iterate through them. This is a good
habit to get in to prevent misspellings of accounts. Remember Ledger
does not validate the names of payees or account so a misspelled account
will be interpreted as a new account by ledger.
@node Hiding Transactions, Automagically Adding new entries, Manual Entry Support, Working with entries
@subsubsection Hiding Transactions
There are several ways to organize Ledger data files. You can use a
master file and @code{include} one file for each real bank or brokerage
account, separate files for major expense categories, a mix of those
ideas, or throw every transaction in to one giant file. The biggest
drawback to uing one file is that it can get confusing finding specific
transactions in the file.
Ledger mode has a special transaction hiding mode that you can use to
hide all transactions except those that meet a regular expression you
provide. By default this command is bound to @code{C-c C-f}. EMACS
will ask for a regular expression, which at its simplest is just text
you want to match. For example, lets say you want to review the
transactions in your checking account named @code{"Assets:Checking"}.
Type @code{C-c C-f}, then type @code{Checking} in the minibuffer. EMACS
will hide all other transactions and highlight the remaining
transactions. You can edit them without fear that your other
transaction have had anything done, they are only hidden from view.
The color used to highlight the xaction can be customized in the EMACS
customization menu. It is called @code{ledger-occur-xact-face}, and can
be changed to alter any charactistic of a font that you want. If you
don't want any highlighting, simply set
@code{ledger-occur-use-face-unfolded} to @code{nil} in the customization
menu.
To clear the highlighting and show all transactions, type @code{C-c C-f}
again.
@node Automagically Adding new entries, Clearing Transactions, Hiding Transactions, Working with entries
@subsubsection Automagically Adding new entries
@cindex new transactions in EMACS
@cindex EMACS, adding new transactions
@code{C-c C-a} will run the @code{ledger entry} command (@pxref{entry
and xact}) from within EMACS. When typed, the mini-buffer will appear
with the current year and month, waiting for you to enter the day and
the payee, and optionally, a commoditized amount. Ledger will generate
a new entry based on the most recent entry for that payee, using the
amount and accounts from that transaction. If you have a new amount
simply type the amount after the payee. For example, if your journal
contains an entry
@smallexample
2011/11/25 Viva Italiano
Expenses:Food $12.45
Expenses:Tips $2.55
Liabilities:MasterCard $-15.00
@end smallexample
@noindent and you type @code{C-c C-a}, the mini-buffer will appear showing the
current year and month. If you complete the mini-buffer entry by typing
@smallexample
Entry: 2011/11/28 viva food 34 tip 7 <enter>
@end smallexample
@noindent EMACS will add the following entry to your journal:
@smallexample
2011/11/30 Viva Italiano
Expenses:Food $34.00
Expenses:Tips $7.00
Liabilities:MasterCard
@end smallexample
@noindent Notice that the entry will appear at the correct place in the journal
ordered by date, not at the bottom of the file. If you need to include
spaces in the payee name, then surrond the name of the payee with double
quotes, otherwise ledger will interpret the second part of the name as
an account.
@node Clearing Transactions, Calculating Values with EMACS Calc, Automagically Adding new entries, Working with entries
@subsubsection Clearing Transactions and Postings
@cindex clearing transactions in EMACS
@cindex EMACS, clear transaction
@code{C-c C-e} will place an asterisk after the date in the current
transaction. The tells ledger the transaction has been cleared through
your bank (or whatever else you want the concept to mean)
@smallexample
2011/11/25 Viva Italiano
Expenses:Food $12.45
Expenses:Tips $2.55
Liabilities:MasterCard $-15.00
@end smallexample
@noindent becomes
@smallexample
2011/11/25 * Viva Italiano
Expenses:Food $12.45
Expenses:Tips $2.55
Liabilities:MasterCard $-15.00
@end smallexample
If, for some reason you need to clear a specific posting in the
transaction you can type @code{C-c C-c} and the posting at point will be
toggled.
@node Calculating Values with EMACS Calc, , Clearing Transactions, Working with entries
@subsubsection Calculating Values with EMACS Calc
EMACS come with a very powerful calculator built in. You can use it to
easily insert calculated amounts directly into your ledger buffer. From
the menu, select @code{Calc on Amount}. Calc will pull the current
amount to the top of the calc stack. Calulate the value as you normally
would with an RPN calculator. When you have the desired value on thetop
of the calc stack, press @code{y}, and calc will insert the value
in place of the previous amount.
@node Reconciling accounts, Generating Reports, Working with entries, Using EMACS
@subsection Reconciling accounts
Enter the reconcile mode using the menu entry, or @code{C-c C-r}. Emacs
will prompt you for an account name, then display a second buffer with
all of the uncleared transactions. The reconcile buffer has several functions:
@table @code
@item SPACE
toggles the cleared status of a transaction, and shows pending balance in the mini-buffer
@item RETURN
moves the cursor to that transaction in the ledger.
@item C-x C-s
to save changes (to the ledger file as well).
@item q
quit the reconcile mode
@item n p
next line or previous line
@item A
add entry
@item D
delete entry
@item t
change target reconciliation amount
@item g
reconcile new account
@item b
show cleared balance in mini-buffer
@item C-l
refresh display
@end table
By default the reconcile mode uses transaction hiding to show only
transaction eligible for your reconcile. The reconcile widow itself will
only show a summary of uncleared transaction while the main buffer will
show all transaction meeting the regex, cleared or not. This behavior
can be disabled by setting @code{ledger-fold-on-reconcile} to nil in the
emacs customization menus.
When you reconcile an account you nromally know the final balance you
are aiming at. When you enter the reconciliation mode ledger will ask
for a target balance. Enter the amount you are aiming for (the default
commodity can be chaged in the customization window). Each time you
toggle a posting to pending, ledger will calculate the new balance of
the account and display the new balance and the difference to make the
target.
@node Generating Reports, , Reconciling accounts, Using EMACS
@subsection Generating Reports
The ledger reports command asks the user to select a report to run then
creates a report buffer containing the results of running the associated
command line. This allows you to run frequently used reports without
retyping the command line, or writing shell scripts for simple one line
commands.
To generate a report, select the @code{Run Reports} menu, or type
@code{C-c C-o C-r}. EMACS will prompt for a report name. If it
recognizes the name it will run the report again. If it is a new name,
or blank it will respond by giving you an example command line to edit.
Hitting return willrun the report and present it in a new buffer.
If you have given it a new name, then @code{s} will save the report for
future use.
In a report buffer, the following keys are available:
@table @code
@item (space)
scroll up
@item e
edit the defined ledger reports
@item s
save a report definition based on the current report
@item q
quit the report (return to ledger buffer)
@item r
redo the report
@item k
kill the report buffer
@end table
@node Transactions , Building Reports, Keeping a Journal, Top
@chapter Transactions