summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-07-02 15:50:32 -0700
committerCraig Earls <enderw88@gmail.com>2013-07-02 15:50:32 -0700
commit0d4641acc2748f5f25a1e6207c4bc5ef86d0cba6 (patch)
tree986c85ff2ff3ef01f8bae6d5b962a36a7f5055a1 /lisp
parentb1edc38e428a36d803bb808d43052b5a7a402e41 (diff)
parent63ba45dbaab04722cd59bf610ae77b8334ca213d (diff)
downloadfork-ledger-0d4641acc2748f5f25a1e6207c4bc5ef86d0cba6.tar.gz
fork-ledger-0d4641acc2748f5f25a1e6207c4bc5ef86d0cba6.tar.bz2
fork-ledger-0d4641acc2748f5f25a1e6207c4bc5ef86d0cba6.zip
Merge branch 'master' into ledger-mode-automatic-transactions
Conflicts: lisp/ledger-init.el lisp/ledger-mode.el lisp/ledger-reconcile.el lisp/ledger-schedule.el
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ldg-mode.el300
-rw-r--r--lisp/ledger-commodities.el (renamed from lisp/ldg-commodities.el)8
-rw-r--r--lisp/ledger-complete.el (renamed from lisp/ldg-complete.el)6
-rw-r--r--lisp/ledger-context.el (renamed from lisp/ldg-context.el)6
-rw-r--r--lisp/ledger-exec.el (renamed from lisp/ldg-exec.el)8
-rw-r--r--lisp/ledger-fonts.el (renamed from lisp/ldg-fonts.el)8
-rw-r--r--lisp/ledger-init.el (renamed from lisp/ldg-init.el)50
-rw-r--r--lisp/ledger-mode.el298
-rw-r--r--lisp/ledger-occur.el (renamed from lisp/ldg-occur.el)6
-rw-r--r--lisp/ledger-post.el (renamed from lisp/ldg-post.el)8
-rw-r--r--lisp/ledger-reconcile.el (renamed from lisp/ldg-reconcile.el)108
-rw-r--r--lisp/ledger-regex.el (renamed from lisp/ldg-regex.el)4
-rw-r--r--lisp/ledger-report.el (renamed from lisp/ldg-report.el)42
-rw-r--r--lisp/ledger-schedule.el (renamed from lisp/ldg-schedule.el)6
-rw-r--r--lisp/ledger-sort.el (renamed from lisp/ldg-sort.el)6
-rw-r--r--lisp/ledger-state.el (renamed from lisp/ldg-state.el)10
-rw-r--r--lisp/ledger-test.el (renamed from lisp/ldg-test.el)4
-rw-r--r--lisp/ledger-texi.el (renamed from lisp/ldg-texi.el)4
-rw-r--r--lisp/ledger-xact.el (renamed from lisp/ldg-xact.el)6
19 files changed, 443 insertions, 445 deletions
diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el
deleted file mode 100644
index d15220e7..00000000
--- a/lisp/ldg-mode.el
+++ /dev/null
@@ -1,300 +0,0 @@
-;;; ldg-mode.el --- Helper code for use with the "ledger" command-line tool
-
-;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
-
-;; This file is not part of GNU Emacs.
-
-;; This is free software; you can redistribute it and/or modify it under
-;; the terms of the GNU General Public License as published by the Free
-;; Software Foundation; either version 2, or (at your option) any later
-;; version.
-;;
-;; This is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-;; for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;; MA 02111-1307, USA.
-
-
-
-;;; Commentary:
-;; Most of the general ledger-mode code is here.
-
-;;; Code:
-
-(require 'ldg-regex)
-(require 'esh-util)
-(require 'esh-arg)
-(require 'ldg-commodities)
-(require 'ldg-complete)
-(require 'ldg-context)
-(require 'ldg-exec)
-(require 'ldg-fonts)
-(require 'ldg-init)
-(require 'ldg-occur)
-(require 'ldg-post)
-(require 'ldg-reconcile)
-(require 'ldg-report)
-(require 'ldg-sort)
-(require 'ldg-state)
-(require 'ldg-test)
-(require 'ldg-texi)
-(require 'ldg-xact)
-(require 'ldg-schedule)
-
-;;; Code:
-
-(defgroup ledger nil
- "Interface to the Ledger command-line accounting program."
- :group 'data)
-
-(defconst ledger-version "3.0"
- "The version of ledger.el currently loaded.")
-
-(defconst ledger-mode-version "3.0.0")
-
-(defun ledger-mode-dump-variable (var)
- (if var
- (insert (format " %s: %S\n" (symbol-name var) (eval var)))))
-
-(defun ledger-mode-dump-group (group)
- "Dump GROUP customizations to current buffer"
- (let ((members (custom-group-members group nil)))
- (dolist (member members)
- (cond ((eq (cadr member) 'custom-group)
- (insert (format "Group %s:\n" (symbol-name (car member))))
- (ledger-mode-dump-group (car member)))
- ((eq (cadr member) 'custom-variable)
- (ledger-mode-dump-variable (car member)))))))
-
-(defun ledger-mode-dump-configuration ()
- "Dump all customizations"
- (find-file "ledger-mode-dump")
- (ledger-mode-dump-group 'ledger))
-
-
-(defsubst ledger-current-year ()
- "The default current year for adding transactions."
- (format-time-string "%Y"))
-(defsubst ledger-current-month ()
- "The default current month for adding transactions."
- (format-time-string "%m"))
-
-(defvar ledger-year (ledger-current-year)
- "Start a ledger session with the current year, but make it customizable to ease retro-entry.")
-
-(defvar ledger-month (ledger-current-month)
- "Start a ledger session with the current month, but make it customizable to ease retro-entry.")
-
-(defun ledger-read-account-with-prompt (prompt)
- (let* ((context (ledger-context-at-point))
- (default (if (and (eq (ledger-context-line-type context) 'acct-transaction)
- (eq (ledger-context-current-field context) 'account))
- (regexp-quote (ledger-context-field-value context 'account))
- nil)))
- (ledger-read-string-with-default prompt default)))
-
-(defun ledger-read-string-with-default (prompt default)
- "Return user supplied string after PROMPT, or DEFAULT."
- (read-string (concat prompt
- (if default
- (concat " (" default "): ")
- ": "))
- nil 'ledger-minibuffer-history default))
-
-(defun ledger-display-balance-at-point ()
- "Display the cleared-or-pending balance.
-And calculate the target-delta of the account being reconciled."
- (interactive)
- (let* ((account (ledger-read-account-with-prompt "Account balance to show"))
- (buffer (current-buffer))
- (balance (with-temp-buffer
- (ledger-exec-ledger buffer (current-buffer) "cleared" account)
- (if (> (buffer-size) 0)
- (buffer-substring-no-properties (point-min) (1- (point-max)))
- (concat account " is empty.")))))
- (when balance
- (message balance))))
-
-(defun ledger-display-ledger-stats ()
- "Display the cleared-or-pending balance.
-And calculate the target-delta of the account being reconciled."
- (interactive)
- (let* ((buffer (current-buffer))
- (balance (with-temp-buffer
- (ledger-exec-ledger buffer (current-buffer) "stats")
- (buffer-substring-no-properties (point-min) (1- (point-max))))))
- (when balance
- (message balance))))
-
-(defun ledger-magic-tab (&optional interactively)
- "Decide what to with with <TAB>.
-Can indent, complete or align depending on context."
- (interactive "p")
- (if (= (point) (line-beginning-position))
- (indent-to ledger-post-account-alignment-column)
- (if (and (> (point) 1)
- (looking-back "\\([^ \t]\\)" 1))
- (ledger-pcomplete interactively)
- (ledger-post-align-postings))))
-
-(defvar ledger-mode-abbrev-table)
-
-(defun ledger-insert-effective-date ()
- (interactive)
- (let ((context (car (ledger-context-at-point)))
- (date-string (format-time-string (cdr (assoc "date-format" ledger-environment-alist)))))
- (cond ((eq 'xact context)
- (beginning-of-line)
- (insert date-string "="))
- ((eq 'acct-transaction context)
- (end-of-line)
- (insert " ; [=" date-string "]")))))
-
-(defun ledger-mode-remove-extra-lines ()
- (goto-char (point-min))
- (while (re-search-forward "\n\n\\(\n\\)+" nil t)
- (replace-match "\n\n")))
-
-(defun ledger-mode-clean-buffer ()
- "indent, remove multiple linfe feeds and sort the buffer"
- (interactive)
- (ledger-sort-buffer)
- (ledger-post-align-postings (point-min) (point-max))
- (ledger-mode-remove-extra-lines))
-
-
-;;;###autoload
-(define-derived-mode ledger-mode text-mode "Ledger"
- "A mode for editing ledger data files."
- (ledger-check-version)
- (ledger-check-schedule-available)
- (ledger-post-setup)
-
- (set (make-local-variable 'comment-start) " ; ")
- (set (make-local-variable 'comment-end) "")
- (set (make-local-variable 'indent-tabs-mode) nil)
-
- (if (boundp 'font-lock-defaults)
- (set (make-local-variable 'font-lock-defaults)
- '(ledger-font-lock-keywords nil t)))
- (setq font-lock-extend-region-functions
- (list #'font-lock-extend-region-wholelines))
- (setq font-lock-multiline nil)
-
- (set (make-local-variable 'pcomplete-parse-arguments-function)
- 'ledger-parse-arguments)
- (set (make-local-variable 'pcomplete-command-completion-function)
- 'ledger-complete-at-point)
- (set (make-local-variable 'pcomplete-termination-string) "")
-
- (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t)
- (add-hook 'before-revert-hook 'ledger-occur-remove-all-overlays nil t)
- (make-variable-buffer-local 'highlight-overlay)
-
- (ledger-init-load-init-file)
-
- (set (make-local-variable 'indent-region-function) 'ledger-post-align-postings)
-
- (let ((map (current-local-map)))
- (define-key map [(control ?c) (control ?a)] 'ledger-add-transaction)
- (define-key map [(control ?c) (control ?b)] 'ledger-post-edit-amount)
- (define-key map [(control ?c) (control ?c)] 'ledger-toggle-current)
- (define-key map [(control ?c) (control ?d)] 'ledger-delete-current-transaction)
- (define-key map [(control ?c) (control ?e)] 'ledger-toggle-current-transaction)
- (define-key map [(control ?c) (control ?f)] 'ledger-occur)
- (define-key map [(control ?c) (control ?k)] 'ledger-copy-transaction-at-point)
- (define-key map [(control ?c) (control ?m)] 'ledger-set-month)
- (define-key map [(control ?c) (control ?r)] 'ledger-reconcile)
- (define-key map [(control ?c) (control ?s)] 'ledger-sort-region)
- (define-key map [(control ?c) (control ?t)] 'ledger-insert-effective-date)
- (define-key map [(control ?c) (control ?u)] 'ledger-schedule-upcoming)
- (define-key map [(control ?c) (control ?y)] 'ledger-set-year)
- (define-key map [(control ?c) (control ?p)] 'ledger-display-balance-at-point)
- (define-key map [(control ?c) (control ?l)] 'ledger-display-ledger-stats)
- (define-key map [(control ?c) (control ?q)] 'ledger-post-align-xact)
-
- (define-key map [tab] 'ledger-magic-tab)
- (define-key map [(control tab)] 'ledger-post-align-xact)
- (define-key map [(control ?i)] 'ledger-magic-tab)
- (define-key map [(control ?c) tab] 'ledger-fully-complete-xact)
- (define-key map [(control ?c) (control ?i)] 'ledger-fully-complete-xact)
-
- (define-key map [(control ?c) (control ?o) (control ?a)] 'ledger-report-redo)
- (define-key map [(control ?c) (control ?o) (control ?e)] 'ledger-report-edit)
- (define-key map [(control ?c) (control ?o) (control ?g)] 'ledger-report-goto)
- (define-key map [(control ?c) (control ?o) (control ?k)] 'ledger-report-kill)
- (define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report)
- (define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save)
-
- (define-key map [(meta ?p)] 'ledger-post-prev-xact)
- (define-key map [(meta ?n)] 'ledger-post-next-xact)
-
- (define-key map [menu-bar] (make-sparse-keymap "ldg-menu"))
- (define-key map [menu-bar ldg-menu] (cons "Ledger" map))
-
- (define-key map [report-kill] '(menu-item "Kill Report" ledger-report-kill :enable ledger-works))
- (define-key map [report-edit] '(menu-item "Edit Report" ledger-report-edit :enable ledger-works))
- (define-key map [report-save] '(menu-item "Save Report" ledger-report-save :enable ledger-works))
- (define-key map [report-rrun] '(menu-item "Re-run Report" ledger-report-redo :enable ledger-works))
- (define-key map [report-goto] '(menu-item "Goto Report" ledger-report-goto :enable ledger-works))
- (define-key map [report-run] '(menu-item "Run Report" ledger-report :enable ledger-works))
- (define-key map [sep5] '(menu-item "--"))
- (define-key map [set-month] '(menu-item "Set Month" ledger-set-month :enable ledger-works))
- (define-key map [set-year] '(menu-item "Set Year" ledger-set-year :enable ledger-works))
- (define-key map [cust] '(menu-item "Customize Ledger Mode" (lambda ()
- (interactive)
- (customize-group 'ledger))))
- (define-key map [sep1] '("--"))
- (define-key map [effective-date] '(menu-item "Set effective date" ledger-insert-effective-date))
- (define-key map [sort-end] '(menu-item "Mark Sort End" ledger-sort-insert-end-mark))
- (define-key map [sort-start] '(menu-item "Mark Sort Beginning" ledger-sort-insert-start-mark))
- (define-key map [sort-buff] '(menu-item "Sort Buffer" ledger-sort-buffer))
- (define-key map [sort-reg] '(menu-item "Sort Region" ledger-sort-region :enable mark-active))
- (define-key map [align-xact] '(menu-item "Align Xact" ledger-post-align-xact))
- (define-key map [align-reg] '(menu-item "Align Region" ledger-post-align-postings :enable mark-active))
- (define-key map [clean-buf] '(menu-item "Clean-up Buffer" ledger-mode-clean-buffer))
- (define-key map [sep2] '(menu-item "--"))
- (define-key map [copy-xact] '(menu-item "Copy Trans at Point" ledger-copy-transaction-at-point))
- (define-key map [toggle-post] '(menu-item "Toggle Current Posting" ledger-toggle-current))
- (define-key map [toggle-xact] '(menu-item "Toggle Current Transaction" ledger-toggle-current-transaction))
- (define-key map [sep4] '(menu-item "--"))
- (define-key map [recon-account] '(menu-item "Reconcile Account" ledger-reconcile :enable ledger-works))
- (define-key map [check-balance] '(menu-item "Check Balance" ledger-display-balance-at-point :enable ledger-works))
- (define-key map [sep6] '(menu-item "--"))
- (define-key map [edit-amount] '(menu-item "Calc on Amount" ledger-post-edit-amount))
- (define-key map [sep] '(menu-item "--"))
- (define-key map [delete-xact] '(menu-item "Delete Transaction" ledger-delete-current-transaction))
- (define-key map [cmp-xact] '(menu-item "Complete Transaction" ledger-fully-complete-xact))
- (define-key map [add-xact] '(menu-item "Add Transaction (ledger xact)" ledger-add-transaction :enable ledger-works))
- (define-key map [generate-scheduled] '(menu-item "Show Upcoming Transactions" ledger-schedule-upcoming :enable ledger-schedule-available))
- (define-key map [sep3] '(menu-item "--"))
- (define-key map [stats] '(menu-item "Ledger Statistics" ledger-display-ledger-stats :enable ledger-works))
- (define-key map [fold-buffer] '(menu-item "Narrow to REGEX" ledger-occur))))
-
-
-
-
-(defun ledger-set-year (newyear)
- "Set ledger's idea of the current year to the prefix argument NEWYEAR."
- (interactive "p")
- (if (= newyear 1)
- (setq ledger-year (read-string "Year: " (ledger-current-year)))
- (setq ledger-year (number-to-string newyear))))
-
-(defun ledger-set-month (newmonth)
- "Set ledger's idea of the current month to the prefix argument NEWMONTH."
- (interactive "p")
- (if (= newmonth 1)
- (setq ledger-month (read-string "Month: " (ledger-current-month)))
- (setq ledger-month (format "%02d" newmonth))))
-
-
-
-(provide 'ledger)
-
-;;; ldg-mode.el ends here
diff --git a/lisp/ldg-commodities.el b/lisp/ledger-commodities.el
index 69bbb46c..758d4f10 100644
--- a/lisp/ldg-commodities.el
+++ b/lisp/ledger-commodities.el
@@ -1,4 +1,4 @@
-;;; ldg-commodities.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-commodities.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -26,7 +26,7 @@
;;; Code:
-(require 'ldg-regex)
+(require 'ledger-regex)
(defcustom ledger-reconcile-default-commodity "$"
"The default commodity for use in target calculations in ledger reconcile."
@@ -144,6 +144,6 @@ longer ones are after the value."
comm
(list (car comm) ledger-reconcile-default-commodity))))))
-(provide 'ldg-commodities)
+(provide 'ledger-commodities)
-;;; ldg-commodities.el ends here
+;;; ledger-commodities.el ends here
diff --git a/lisp/ldg-complete.el b/lisp/ledger-complete.el
index b0472517..516a3a62 100644
--- a/lisp/ldg-complete.el
+++ b/lisp/ledger-complete.el
@@ -1,4 +1,4 @@
-;;; ldg-complete.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-complete.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -252,6 +252,6 @@ ledger-magic-tab would cycle properly"
'(sole shortest))
pcomplete-last-completion-raw))))))
-(provide 'ldg-complete)
+(provide 'ledger-complete)
-;;; ldg-complete.el ends here
+;;; ledger-complete.el ends here
diff --git a/lisp/ldg-context.el b/lisp/ledger-context.el
index 9b1e2725..aafcc5d8 100644
--- a/lisp/ldg-context.el
+++ b/lisp/ledger-context.el
@@ -1,4 +1,4 @@
-;;; ldg-context.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-context.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -206,6 +206,6 @@ specified line, returns nil."
(defun ledger-context-goto-field-end (context-info field-name)
(goto-char (ledger-context-field-end-position context-info field-name)))
-(provide 'ldg-context)
+(provide 'ledger-context)
-;;; ldg-report.el ends here
+;;; ledger-report.el ends here
diff --git a/lisp/ldg-exec.el b/lisp/ledger-exec.el
index f6c3bb54..34757d99 100644
--- a/lisp/ldg-exec.el
+++ b/lisp/ledger-exec.el
@@ -1,4 +1,4 @@
-;;; ldg-exec.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-exec.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -77,7 +77,7 @@
(let ((buffer ledger-buf)
(version-strings '()))
(with-temp-buffer
- (when (ledger-exec-ledger (current-buffer) (current-buffer) "--version")
+ (when (ledger-exec-ledger (current-buffer) (current-buffer) "--version")
(goto-char (point-min))
(delete-horizontal-space)
(setq version-strings (split-string
@@ -96,6 +96,6 @@
(message "Good Ledger Version")
(message "Bad Ledger Version")))
-(provide 'ldg-exec)
+(provide 'ledger-exec)
-;;; ldg-exec.el ends here
+;;; ledger-exec.el ends here
diff --git a/lisp/ldg-fonts.el b/lisp/ledger-fonts.el
index ab0a3317..28f1f98d 100644
--- a/lisp/ldg-fonts.el
+++ b/lisp/ledger-fonts.el
@@ -1,4 +1,4 @@
-;;; ldg-fonts.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-fonts.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -26,7 +26,7 @@
;;; Code:
-(require 'ldg-regex)
+(require 'ledger-regex)
(defgroup ledger-faces nil "Ledger mode highlighting" :group 'ledger)
(defface ledger-font-payee-uncleared-face
@@ -133,6 +133,6 @@
"Expressions to highlight in Ledger mode.")
-(provide 'ldg-fonts)
+(provide 'ledger-fonts)
-;;; ldg-fonts.el ends here
+;;; ledger-fonts.el ends here
diff --git a/lisp/ldg-init.el b/lisp/ledger-init.el
index 8f1160cf..4ceee4f1 100644
--- a/lisp/ldg-init.el
+++ b/lisp/ledger-init.el
@@ -1,4 +1,4 @@
-;;; ldg-init.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-init.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -22,7 +22,7 @@
;;; Commentary:
;; Determine the ledger environment
-(require 'ldg-regex)
+(require 'ledger-regex)
(defcustom ledger-init-file-name "~/.ledgerrc"
"Location of the ledger initialization file. nil if you don't have one"
@@ -35,34 +35,34 @@
(let (environment-alist)
(goto-char (point-min))
(while (re-search-forward ledger-init-string-regex nil t )
- (let ((matchb (match-beginning 0)) ;; save the match data, string-match stamp on it
- (matche (match-end 0)))
- (end-of-line)
- (setq environment-alist
- (append environment-alist
- (list (cons (let ((flag (buffer-substring-no-properties (+ 2 matchb) matche)))
- (if (string-match "[ \t\n\r]+\\'" flag)
- (replace-match "" t t flag)
- flag))
- (let ((value (buffer-substring-no-properties matche (point) )))
- (if (> (length value) 0)
- value
- t))))))))
+ (let ((matchb (match-beginning 0)) ;; save the match data, string-match stamp on it
+ (matche (match-end 0)))
+ (end-of-line)
+ (setq environment-alist
+ (append environment-alist
+ (list (cons (let ((flag (buffer-substring-no-properties (+ 2 matchb) matche)))
+ (if (string-match "[ \t\n\r]+\\'" flag)
+ (replace-match "" t t flag)
+ flag))
+ (let ((value (buffer-substring-no-properties matche (point) )))
+ (if (> (length value) 0)
+ value
+ t))))))))
environment-alist)))
(defun ledger-init-load-init-file ()
(interactive)
(let ((init-base-name (file-name-nondirectory ledger-init-file-name)))
(if (get-buffer init-base-name) ;; init file already loaded, parse it and leave it
- (ledger-init-parse-initialization init-base-name)
- (when (and ledger-init-file-name
- (file-exists-p ledger-init-file-name)
- (file-readable-p ledger-init-file-name))
- (find-file-noselect ledger-init-file-name)
- (setq ledger-environment-alist
- (ledger-init-parse-initialization init-base-name))
- (kill-buffer init-base-name)))))
+ (ledger-init-parse-initialization init-base-name)
+ (when (and ledger-init-file-name
+ (file-exists-p ledger-init-file-name)
+ (file-readable-p ledger-init-file-name))
+ (find-file-noselect ledger-init-file-name)
+ (setq ledger-environment-alist
+ (ledger-init-parse-initialization init-base-name))
+ (kill-buffer init-base-name)))))
-(provide 'ldg-init)
+(provide 'ledger-init)
-;;; ldg-init.el ends here
+;;; ledger-init.el ends here
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
new file mode 100644
index 00000000..b0f61d5d
--- /dev/null
+++ b/lisp/ledger-mode.el
@@ -0,0 +1,298 @@
+;;; ledger-mode.el --- Helper code for use with the "ledger" command-line tool
+
+;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
+
+;; This file is not part of GNU Emacs.
+
+;; This is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+;;
+;; This is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+;; for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;; MA 02111-1307, USA.
+
+
+
+;;; Commentary:
+;; Most of the general ledger-mode code is here.
+
+;;; Code:
+
+(require 'ledger-regex)
+(require 'esh-util)
+(require 'esh-arg)
+(require 'ledger-commodities)
+(require 'ledger-complete)
+(require 'ledger-context)
+(require 'ledger-exec)
+(require 'ledger-fonts)
+(require 'ledger-init)
+(require 'ledger-occur)
+(require 'ledger-post)
+(require 'ledger-reconcile)
+(require 'ledger-report)
+(require 'ledger-sort)
+(require 'ledger-state)
+(require 'ledger-test)
+(require 'ledger-texi)
+(require 'ledger-xact)
+(require 'ledger-schedule)
+
+;;; Code:
+
+(defgroup ledger nil
+ "Interface to the Ledger command-line accounting program."
+ :group 'data)
+
+(defconst ledger-version "3.0"
+ "The version of ledger.el currently loaded.")
+
+(defconst ledger-mode-version "3.0.0")
+
+(defun ledger-mode-dump-variable (var)
+ (if var
+ (insert (format " %s: %S\n" (symbol-name var) (eval var)))))
+
+(defun ledger-mode-dump-group (group)
+ "Dump GROUP customizations to current buffer"
+ (let ((members (custom-group-members group nil)))
+ (dolist (member members)
+ (cond ((eq (cadr member) 'custom-group)
+ (insert (format "Group %s:\n" (symbol-name (car member))))
+ (ledger-mode-dump-group (car member)))
+ ((eq (cadr member) 'custom-variable)
+ (ledger-mode-dump-variable (car member)))))))
+
+(defun ledger-mode-dump-configuration ()
+ "Dump all customizations"
+ (find-file "ledger-mode-dump")
+ (ledger-mode-dump-group 'ledger))
+
+
+(defsubst ledger-current-year ()
+ "The default current year for adding transactions."
+ (format-time-string "%Y"))
+(defsubst ledger-current-month ()
+ "The default current month for adding transactions."
+ (format-time-string "%m"))
+
+(defvar ledger-year (ledger-current-year)
+ "Start a ledger session with the current year, but make it customizable to ease retro-entry.")
+
+(defvar ledger-month (ledger-current-month)
+ "Start a ledger session with the current month, but make it customizable to ease retro-entry.")
+
+(defun ledger-read-account-with-prompt (prompt)
+ (let* ((context (ledger-context-at-point))
+ (default (if (and (eq (ledger-context-line-type context) 'acct-transaction)
+ (eq (ledger-context-current-field context) 'account))
+ (regexp-quote (ledger-context-field-value context 'account))
+ nil)))
+ (ledger-read-string-with-default prompt default)))
+
+(defun ledger-read-string-with-default (prompt default)
+ "Return user supplied string after PROMPT, or DEFAULT."
+ (read-string (concat prompt
+ (if default
+ (concat " (" default "): ")
+ ": "))
+ nil 'ledger-minibuffer-history default))
+
+(defun ledger-display-balance-at-point ()
+ "Display the cleared-or-pending balance.
+And calculate the target-delta of the account being reconciled."
+ (interactive)
+ (let* ((account (ledger-read-account-with-prompt "Account balance to show"))
+ (buffer (current-buffer))
+ (balance (with-temp-buffer
+ (ledger-exec-ledger buffer (current-buffer) "cleared" account)
+ (if (> (buffer-size) 0)
+ (buffer-substring-no-properties (point-min) (1- (point-max)))
+ (concat account " is empty.")))))
+ (when balance
+ (message balance))))
+
+(defun ledger-display-ledger-stats ()
+ "Display the cleared-or-pending balance.
+And calculate the target-delta of the account being reconciled."
+ (interactive)
+ (let* ((buffer (current-buffer))
+ (balance (with-temp-buffer
+ (ledger-exec-ledger buffer (current-buffer) "stats")
+ (buffer-substring-no-properties (point-min) (1- (point-max))))))
+ (when balance
+ (message balance))))
+
+(defun ledger-magic-tab (&optional interactively)
+ "Decide what to with with <TAB>.
+Can indent, complete or align depending on context."
+ (interactive "p")
+ (if (= (point) (line-beginning-position))
+ (indent-to ledger-post-account-alignment-column)
+ (if (and (> (point) 1)
+ (looking-back "\\([^ \t]\\)" 1))
+ (ledger-pcomplete interactively)
+ (ledger-post-align-postings))))
+
+(defvar ledger-mode-abbrev-table)
+
+(defun ledger-insert-effective-date ()
+ (interactive)
+ (let ((context (car (ledger-context-at-point)))
+ (date-string (format-time-string (cdr (assoc "date-format" ledger-environment-alist)))))
+ (cond ((eq 'xact context)
+ (beginning-of-line)
+ (insert date-string "="))
+ ((eq 'acct-transaction context)
+ (end-of-line)
+ (insert " ; [=" date-string "]")))))
+
+(defun ledger-mode-remove-extra-lines ()
+ (goto-char (point-min))
+ (while (re-search-forward "\n\n\\(\n\\)+" nil t)
+ (replace-match "\n\n")))
+
+(defun ledger-mode-clean-buffer ()
+ "indent, remove multiple linfe feeds and sort the buffer"
+ (interactive)
+ (ledger-sort-buffer)
+ (ledger-post-align-postings (point-min) (point-max))
+ (ledger-mode-remove-extra-lines))
+
+
+;;;###autoload
+(define-derived-mode ledger-mode text-mode "Ledger"
+ "A mode for editing ledger data files."
+ (ledger-check-version)
+ (ledger-post-setup)
+
+ (set (make-local-variable 'comment-start) " ; ")
+ (set (make-local-variable 'comment-end) "")
+ (set (make-local-variable 'indent-tabs-mode) nil)
+
+ (if (boundp 'font-lock-defaults)
+ (set (make-local-variable 'font-lock-defaults)
+ '(ledger-font-lock-keywords nil t)))
+ (setq font-lock-extend-region-functions
+ (list #'font-lock-extend-region-wholelines))
+ (setq font-lock-multiline nil)
+
+ (set (make-local-variable 'pcomplete-parse-arguments-function)
+ 'ledger-parse-arguments)
+ (set (make-local-variable 'pcomplete-command-completion-function)
+ 'ledger-complete-at-point)
+ (set (make-local-variable 'pcomplete-termination-string) "")
+
+ (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t)
+ (add-hook 'before-revert-hook 'ledger-occur-remove-all-overlays nil t)
+ (make-variable-buffer-local 'highlight-overlay)
+
+ (ledger-init-load-init-file)
+
+ (set (make-local-variable 'indent-region-function) 'ledger-post-align-postings)
+
+ (let ((map (current-local-map)))
+ (define-key map [(control ?c) (control ?a)] 'ledger-add-transaction)
+ (define-key map [(control ?c) (control ?b)] 'ledger-post-edit-amount)
+ (define-key map [(control ?c) (control ?c)] 'ledger-toggle-current)
+ (define-key map [(control ?c) (control ?d)] 'ledger-delete-current-transaction)
+ (define-key map [(control ?c) (control ?e)] 'ledger-toggle-current-transaction)
+ (define-key map [(control ?c) (control ?f)] 'ledger-occur)
+ (define-key map [(control ?c) (control ?k)] 'ledger-copy-transaction-at-point)
+ (define-key map [(control ?c) (control ?m)] 'ledger-set-month)
+ (define-key map [(control ?c) (control ?r)] 'ledger-reconcile)
+ (define-key map [(control ?c) (control ?s)] 'ledger-sort-region)
+ (define-key map [(control ?c) (control ?t)] 'ledger-insert-effective-date)
+ (define-key map [(control ?c) (control ?u)] 'ledger-schedule-upcoming)
+ (define-key map [(control ?c) (control ?y)] 'ledger-set-year)
+ (define-key map [(control ?c) (control ?p)] 'ledger-display-balance-at-point)
+ (define-key map [(control ?c) (control ?l)] 'ledger-display-ledger-stats)
+ (define-key map [(control ?c) (control ?q)] 'ledger-post-align-xact)
+
+ (define-key map [tab] 'ledger-magic-tab)
+ (define-key map [(control tab)] 'ledger-post-align-xact)
+ (define-key map [(control ?i)] 'ledger-magic-tab)
+ (define-key map [(control ?c) tab] 'ledger-fully-complete-xact)
+ (define-key map [(control ?c) (control ?i)] 'ledger-fully-complete-xact)
+
+ (define-key map [(control ?c) (control ?o) (control ?a)] 'ledger-report-redo)
+ (define-key map [(control ?c) (control ?o) (control ?e)] 'ledger-report-edit)
+ (define-key map [(control ?c) (control ?o) (control ?g)] 'ledger-report-goto)
+ (define-key map [(control ?c) (control ?o) (control ?k)] 'ledger-report-kill)
+ (define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report)
+ (define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save)
+
+ (define-key map [(meta ?p)] 'ledger-post-prev-xact)
+ (define-key map [(meta ?n)] 'ledger-post-next-xact)
+
+ (define-key map [menu-bar] (make-sparse-keymap "ledger-menu"))
+ (define-key map [menu-bar ledger-menu] (cons "Ledger" map))
+
+ (define-key map [report-kill] '(menu-item "Kill Report" ledger-report-kill :enable ledger-works))
+ (define-key map [report-edit] '(menu-item "Edit Report" ledger-report-edit :enable ledger-works))
+ (define-key map [report-save] '(menu-item "Save Report" ledger-report-save :enable ledger-works))
+ (define-key map [report-rrun] '(menu-item "Re-run Report" ledger-report-redo :enable ledger-works))
+ (define-key map [report-goto] '(menu-item "Goto Report" ledger-report-goto :enable ledger-works))
+ (define-key map [report-run] '(menu-item "Run Report" ledger-report :enable ledger-works))
+ (define-key map [sep5] '(menu-item "--"))
+ (define-key map [set-month] '(menu-item "Set Month" ledger-set-month :enable ledger-works))
+ (define-key map [set-year] '(menu-item "Set Year" ledger-set-year :enable ledger-works))
+ (define-key map [cust] '(menu-item "Customize Ledger Mode" (lambda ()
+ (interactive)
+ (customize-group 'ledger))))
+ (define-key map [sep1] '("--"))
+ (define-key map [effective-date] '(menu-item "Set effective date" ledger-insert-effective-date))
+ (define-key map [sort-end] '(menu-item "Mark Sort End" ledger-sort-insert-end-mark))
+ (define-key map [sort-start] '(menu-item "Mark Sort Beginning" ledger-sort-insert-start-mark))
+ (define-key map [sort-buff] '(menu-item "Sort Buffer" ledger-sort-buffer))
+ (define-key map [sort-reg] '(menu-item "Sort Region" ledger-sort-region :enable mark-active))
+ (define-key map [align-xact] '(menu-item "Align Xact" ledger-post-align-xact))
+ (define-key map [align-reg] '(menu-item "Align Region" ledger-post-align-postings :enable mark-active))
+ (define-key map [clean-buf] '(menu-item "Clean-up Buffer" ledger-mode-clean-buffer))
+ (define-key map [sep2] '(menu-item "--"))
+ (define-key map [copy-xact] '(menu-item "Copy Trans at Point" ledger-copy-transaction-at-point))
+ (define-key map [toggle-post] '(menu-item "Toggle Current Posting" ledger-toggle-current))
+ (define-key map [toggle-xact] '(menu-item "Toggle Current Transaction" ledger-toggle-current-transaction))
+ (define-key map [sep4] '(menu-item "--"))
+ (define-key map [recon-account] '(menu-item "Reconcile Account" ledger-reconcile :enable ledger-works))
+ (define-key map [check-balance] '(menu-item "Check Balance" ledger-display-balance-at-point :enable ledger-works))
+ (define-key map [sep6] '(menu-item "--"))
+ (define-key map [edit-amount] '(menu-item "Calc on Amount" ledger-post-edit-amount))
+ (define-key map [sep] '(menu-item "--"))
+ (define-key map [delete-xact] '(menu-item "Delete Transaction" ledger-delete-current-transaction))
+ (define-key map [cmp-xact] '(menu-item "Complete Transaction" ledger-fully-complete-xact))
+ (define-key map [add-xact] '(menu-item "Add Transaction (ledger xact)" ledger-add-transaction :enable ledger-works))
+ (define-key map [sep3] '(menu-item "--"))
+ (define-key map [stats] '(menu-item "Ledger Statistics" ledger-display-ledger-stats :enable ledger-works))
+ (define-key map [fold-buffer] '(menu-item "Narrow to REGEX" ledger-occur))))
+
+
+
+
+(defun ledger-set-year (newyear)
+ "Set ledger's idea of the current year to the prefix argument NEWYEAR."
+ (interactive "p")
+ (if (= newyear 1)
+ (setq ledger-year (read-string "Year: " (ledger-current-year)))
+ (setq ledger-year (number-to-string newyear))))
+
+(defun ledger-set-month (newmonth)
+ "Set ledger's idea of the current month to the prefix argument NEWMONTH."
+ (interactive "p")
+ (if (= newmonth 1)
+ (setq ledger-month (read-string "Month: " (ledger-current-month)))
+ (setq ledger-month (format "%02d" newmonth))))
+
+
+
+(provide 'ledger)
+
+;;; ledger-mode.el ends here
diff --git a/lisp/ldg-occur.el b/lisp/ledger-occur.el
index e655e270..4fd01ddc 100644
--- a/lisp/ldg-occur.el
+++ b/lisp/ledger-occur.el
@@ -1,4 +1,4 @@
-;;; ldg-mode.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-mode.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -187,6 +187,6 @@ Used for coordinating `ledger-occur' with other buffers, like reconcile."
(setq current-end (cadr match))))
(nreverse (push (list current-beginning current-end) points))))
-(provide 'ldg-occur)
+(provide 'ledger-occur)
-;;; ldg-occur.el ends here
+;;; ledger-occur.el ends here
diff --git a/lisp/ldg-post.el b/lisp/ledger-post.el
index 3b9f27d9..cfef9450 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ledger-post.el
@@ -1,4 +1,4 @@
-;;; ldg-post.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-post.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -23,7 +23,7 @@
;;; Commentary:
;; Utility functions for dealing with postings.
-(require 'ldg-regex)
+(require 'ledger-regex)
;;; Code:
@@ -242,8 +242,8 @@ region align the posting on the current line."
-(provide 'ldg-post)
+(provide 'ledger-post)
-;;; ldg-post.el ends here
+;;; ledger-post.el ends here
diff --git a/lisp/ldg-reconcile.el b/lisp/ledger-reconcile.el
index 4b731df0..964a7c23 100644
--- a/lisp/ldg-reconcile.el
+++ b/lisp/ledger-reconcile.el
@@ -1,4 +1,4 @@
-;;; ldg-reconcile.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-reconcile.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -430,56 +430,56 @@ moved and recentered. If they aren't strange things happen."
(ledger-reconcile-refresh)))
(define-derived-mode ledger-reconcile-mode text-mode "Reconcile"
- "A mode for reconciling ledger entries."
- (let ((map (make-sparse-keymap)))
- (define-key map [(control ?m)] 'ledger-reconcile-visit)
- (define-key map [return] 'ledger-reconcile-visit)
- (define-key map [(control ?l)] 'ledger-reconcile-refresh)
- (define-key map [(control ?c) (control ?c)] 'ledger-reconcile-finish)
- (define-key map [? ] 'ledger-reconcile-toggle)
- (define-key map [?a] 'ledger-reconcile-add)
- (define-key map [?d] 'ledger-reconcile-delete)
- (define-key map [?g] 'ledger-reconcile);
- (define-key map [?n] 'next-line)
- (define-key map [?p] 'previous-line)
- (define-key map [?t] 'ledger-reconcile-change-target)
- (define-key map [?s] 'ledger-reconcile-save)
- (define-key map [?q] 'ledger-reconcile-quit)
- (define-key map [?b] 'ledger-display-balance)
-
- (define-key map [(control ?c) (control ?a)] (ledger-reconcile-change-sort-key-and-refresh "(amount)"))
-
- (define-key map [(control ?c) (control ?d)] (ledger-reconcile-change-sort-key-and-refresh "(date)"))
-
- (define-key map [(control ?c) (control ?p)] (ledger-reconcile-change-sort-key-and-refresh "(payee)"))
-
- (define-key map [menu-bar] (make-sparse-keymap "ldg-recon-menu"))
- (define-key map [menu-bar ldg-recon-menu] (cons "Reconcile" map))
- (define-key map [menu-bar ldg-recon-menu qui] '("Quit" . ledger-reconcile-quit))
- (define-key map [menu-bar ldg-recon-menu sep1] '("--"))
- (define-key map [menu-bar ldg-recon-menu pre] '("Previous Entry" . previous-line))
- (define-key map [menu-bar ldg-recon-menu vis] '("Visit Source" . ledger-reconcile-visit))
- (define-key map [menu-bar ldg-recon-menu nex] '("Next Entry" . next-line))
- (define-key map [menu-bar ldg-recon-menu sep2] '("--"))
- (define-key map [menu-bar ldg-recon-menu del] '("Delete Entry" . ledger-reconcile-delete))
- (define-key map [menu-bar ldg-recon-menu add] '("Add Entry" . ledger-reconcile-add))
- (define-key map [menu-bar ldg-recon-menu tog] '("Toggle Entry" . ledger-reconcile-toggle))
- (define-key map [menu-bar ldg-recon-menu sep3] '("--"))
- (define-key map [menu-bar ldg-recon-menu sort-amt] `("Sort by amount" . ,(ledger-reconcile-change-sort-key-and-refresh "(amount)")))
- (define-key map [menu-bar ldg-recon-menu sort-pay] `("Sort by date" . ,(ledger-reconcile-change-sort-key-and-refresh "(date)")))
- (define-key map [menu-bar ldg-recon-menu sort-dat] `("Sort by payee" . ,(ledger-reconcile-change-sort-key-and-refresh "(payee)")))
- (define-key map [menu-bar ldg-recon-menu sep4] '("--"))
- (define-key map [menu-bar ldg-recon-menu bal] '("Show Cleared Balance" . ledger-display-balance))
- (define-key map [menu-bar ldg-recon-menu tgt] '("Change Target Balance" . ledger-reconcile-change-target))
- (define-key map [menu-bar ldg-recon-menu sep5] '("--"))
- (define-key map [menu-bar ldg-recon-menu rna] '("Reconcile New Account" . ledger-reconcile))
- (define-key map [menu-bar ldg-recon-menu sep6] '("--"))
- (define-key map [menu-bar ldg-recon-menu fin] '("Finish" . ledger-reconcile-finish))
- (define-key map [menu-bar ldg-recon-menu ref] '("Refresh" . ledger-reconcile-refresh))
- (define-key map [menu-bar ldg-recon-menu sav] '("Save" . ledger-reconcile-save))
-
- (use-local-map map)))
-
-(provide 'ldg-reconcile)
-
-;;; ldg-reconcile.el ends here
+ "A mode for reconciling ledger entries."
+ (let ((map (make-sparse-keymap)))
+ (define-key map [(control ?m)] 'ledger-reconcile-visit)
+ (define-key map [return] 'ledger-reconcile-visit)
+ (define-key map [(control ?l)] 'ledger-reconcile-refresh)
+ (define-key map [(control ?c) (control ?c)] 'ledger-reconcile-finish)
+ (define-key map [? ] 'ledger-reconcile-toggle)
+ (define-key map [?a] 'ledger-reconcile-add)
+ (define-key map [?d] 'ledger-reconcile-delete)
+ (define-key map [?g] 'ledger-reconcile);
+ (define-key map [?n] 'next-line)
+ (define-key map [?p] 'previous-line)
+ (define-key map [?t] 'ledger-reconcile-change-target)
+ (define-key map [?s] 'ledger-reconcile-save)
+ (define-key map [?q] 'ledger-reconcile-quit)
+ (define-key map [?b] 'ledger-display-balance)
+
+ (define-key map [(control ?c) (control ?a)] (ledger-reconcile-change-sort-key-and-refresh "(amount)"))
+
+ (define-key map [(control ?c) (control ?d)] (ledger-reconcile-change-sort-key-and-refresh "(date)"))
+
+ (define-key map [(control ?c) (control ?p)] (ledger-reconcile-change-sort-key-and-refresh "(payee)"))
+
+ (define-key map [menu-bar] (make-sparse-keymap "ledger-recon-menu"))
+ (define-key map [menu-bar ledger-recon-menu] (cons "Reconcile" map))
+ (define-key map [menu-bar ledger-recon-menu qui] '("Quit" . ledger-reconcile-quit))
+ (define-key map [menu-bar ledger-recon-menu sep1] '("--"))
+ (define-key map [menu-bar ledger-recon-menu pre] '("Previous Entry" . previous-line))
+ (define-key map [menu-bar ledger-recon-menu vis] '("Visit Source" . ledger-reconcile-visit))
+ (define-key map [menu-bar ledger-recon-menu nex] '("Next Entry" . next-line))
+ (define-key map [menu-bar ledger-recon-menu sep2] '("--"))
+ (define-key map [menu-bar ledger-recon-menu del] '("Delete Entry" . ledger-reconcile-delete))
+ (define-key map [menu-bar ledger-recon-menu add] '("Add Entry" . ledger-reconcile-add))
+ (define-key map [menu-bar ledger-recon-menu tog] '("Toggle Entry" . ledger-reconcile-toggle))
+ (define-key map [menu-bar ledger-recon-menu sep3] '("--"))
+ (define-key map [menu-bar ledger-recon-menu sort-amt] `("Sort by amount" . ,(ledger-reconcile-change-sort-key-and-refresh "(amount)")))
+ (define-key map [menu-bar ledger-recon-menu sort-pay] `("Sort by date" . ,(ledger-reconcile-change-sort-key-and-refresh "(date)")))
+ (define-key map [menu-bar ledger-recon-menu sort-dat] `("Sort by payee" . ,(ledger-reconcile-change-sort-key-and-refresh "(payee)")))
+ (define-key map [menu-bar ledger-recon-menu sep4] '("--"))
+ (define-key map [menu-bar ledger-recon-menu bal] '("Show Cleared Balance" . ledger-display-balance))
+ (define-key map [menu-bar ledger-recon-menu tgt] '("Change Target Balance" . ledger-reconcile-change-target))
+ (define-key map [menu-bar ledger-recon-menu sep5] '("--"))
+ (define-key map [menu-bar ledger-recon-menu rna] '("Reconcile New Account" . ledger-reconcile))
+ (define-key map [menu-bar ledger-recon-menu sep6] '("--"))
+ (define-key map [menu-bar ledger-recon-menu fin] '("Finish" . ledger-reconcile-finish))
+ (define-key map [menu-bar ledger-recon-menu ref] '("Refresh" . ledger-reconcile-refresh))
+ (define-key map [menu-bar ledger-recon-menu sav] '("Save" . ledger-reconcile-save))
+
+ (use-local-map map)))
+
+(provide 'ledger-reconcile)
+
+;;; ledger-reconcile.el ends here
diff --git a/lisp/ldg-regex.el b/lisp/ledger-regex.el
index c59937b1..06564a4a 100644
--- a/lisp/ldg-regex.el
+++ b/lisp/ledger-regex.el
@@ -1,4 +1,4 @@
-;;; ldg-regex.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-regex.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -332,4 +332,4 @@
"\\(.*\\)" ;; desc
"\\)"))
-(provide 'ldg-regex)
+(provide 'ledger-regex)
diff --git a/lisp/ldg-report.el b/lisp/ledger-report.el
index 9b16522f..e785bc1b 100644
--- a/lisp/ldg-report.el
+++ b/lisp/ledger-report.el
@@ -1,4 +1,4 @@
-;;; ldg-report.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-report.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -105,22 +105,22 @@ text that should replace the format specifier."
'ledger-report-edit)
(define-key map [return] 'ledger-report-visit-source)
-
- (define-key map [menu-bar] (make-sparse-keymap "ldg-rep"))
- (define-key map [menu-bar ldg-rep] (cons "Reports" map))
-
- (define-key map [menu-bar ldg-rep lrq] '("Quit" . ledger-report-quit))
- (define-key map [menu-bar ldg-rep s2] '("--"))
- (define-key map [menu-bar ldg-rep lrd] '("Scroll Down" . scroll-down))
- (define-key map [menu-bar ldg-rep vis] '("Visit Source" . ledger-report-visit-source))
- (define-key map [menu-bar ldg-rep lru] '("Scroll Up" . scroll-up))
- (define-key map [menu-bar ldg-rep s1] '("--"))
- (define-key map [menu-bar ldg-rep rev] '("Reverse report order" . ledger-report-reverse-lines))
- (define-key map [menu-bar ldg-rep s0] '("--"))
- (define-key map [menu-bar ldg-rep lrk] '("Kill Report" . ledger-report-kill))
- (define-key map [menu-bar ldg-rep lrr] '("Re-run Report" . ledger-report-redo))
- (define-key map [menu-bar ldg-rep lre] '("Edit Report" . ledger-report-edit))
- (define-key map [menu-bar ldg-rep lrs] '("Save Report" . ledger-report-save))
+
+ (define-key map [menu-bar] (make-sparse-keymap "ledger-rep"))
+ (define-key map [menu-bar ledger-rep] (cons "Reports" map))
+
+ (define-key map [menu-bar ledger-rep lrq] '("Quit" . ledger-report-quit))
+ (define-key map [menu-bar ledger-rep s2] '("--"))
+ (define-key map [menu-bar ledger-rep lrd] '("Scroll Down" . scroll-down))
+ (define-key map [menu-bar ledger-rep vis] '("Visit Source" . ledger-report-visit-source))
+ (define-key map [menu-bar ledger-rep lru] '("Scroll Up" . scroll-up))
+ (define-key map [menu-bar ledger-rep s1] '("--"))
+ (define-key map [menu-bar ledger-rep rev] '("Reverse report order" . ledger-report-reverse-lines))
+ (define-key map [menu-bar ledger-rep s0] '("--"))
+ (define-key map [menu-bar ledger-rep lrk] '("Kill Report" . ledger-report-kill))
+ (define-key map [menu-bar ledger-rep lrr] '("Re-run Report" . ledger-report-redo))
+ (define-key map [menu-bar ledger-rep lre] '("Edit Report" . ledger-report-edit))
+ (define-key map [menu-bar ledger-rep lrs] '("Save Report" . ledger-report-save))
(use-local-map map)))
@@ -310,7 +310,7 @@ Optional EDIT the command."
(let ((file (match-string 1))
(line (string-to-number (match-string 2))))
(delete-region (match-beginning 0) (match-end 0))
- (when file
+ (when file
(set-text-properties (line-beginning-position) (line-end-position)
(list 'ledger-source (cons file (save-window-excursion
(save-excursion
@@ -330,7 +330,7 @@ Optional EDIT the command."
(let* ((prop (get-text-property (point) 'ledger-source))
(file (if prop (car prop)))
(line-or-marker (if prop (cdr prop))))
- (when (and file line-or-marker)
+ (when (and file line-or-marker)
(find-file-other-window file)
(widen)
(if (markerp line-or-marker)
@@ -414,6 +414,6 @@ Optional EDIT the command."
(ledger-reports-add ledger-report-name ledger-report-cmd)
(ledger-reports-custom-save)))))))
-(provide 'ldg-report)
+(provide 'ledger-report)
-;;; ldg-report.el ends here
+;;; ledger-report.el ends here
diff --git a/lisp/ldg-schedule.el b/lisp/ledger-schedule.el
index 538e64c0..ce6694d4 100644
--- a/lisp/ldg-schedule.el
+++ b/lisp/ledger-schedule.el
@@ -1,4 +1,4 @@
-;;; ldg-schedule.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-schedule.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2013 Craig Earls (enderw88 at gmail dot com)
@@ -306,6 +306,6 @@ returns true if the date meets the requirements"
(current-buffer)))
-(provide 'ldg-schedule)
+(provide 'ledger-schedule)
-;;; ldg-schedule.el ends here
+;;; ledger-schedule.el ends here
diff --git a/lisp/ldg-sort.el b/lisp/ledger-sort.el
index 5b8d0ae7..206ffb94 100644
--- a/lisp/ldg-sort.el
+++ b/lisp/ledger-sort.el
@@ -1,4 +1,4 @@
-;;; ldg-xact.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-xact.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -121,6 +121,6 @@
sort-end
(point-max)))))
-(provide 'ldg-sort)
+(provide 'ledger-sort)
-;;; ldg-sort.el ends here
+;;; ledger-sort.el ends here
diff --git a/lisp/ldg-state.el b/lisp/ledger-state.el
index 58777631..121e97ca 100644
--- a/lisp/ldg-state.el
+++ b/lisp/ledger-state.el
@@ -1,4 +1,4 @@
-;;; ldg-state.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-state.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -110,7 +110,7 @@ dropped."
;;this excursion toggles the posting status
(save-excursion
(setq inhibit-modification-hooks t)
-
+
(goto-char (line-beginning-position))
(when (looking-at "[ \t]")
(skip-chars-forward " \t")
@@ -228,7 +228,7 @@ dropped."
(eq (ledger-state-from-char (char-after)) 'cleared))
(progn
(delete-char 1)
- (when (and style (eq style 'cleared))
+ (when (and style (eq style 'cleared))
(insert " *")
'cleared))
(if (and style (eq style 'pending))
@@ -239,6 +239,6 @@ dropped."
(insert " * ")
'cleared))))))
-(provide 'ldg-state)
+(provide 'ledger-state)
-;;; ldg-state.el ends here
+;;; ledger-state.el ends here
diff --git a/lisp/ldg-test.el b/lisp/ledger-test.el
index 0c571caa..a275ae7f 100644
--- a/lisp/ldg-test.el
+++ b/lisp/ledger-test.el
@@ -1,4 +1,4 @@
-;;; ldg-test.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-test.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -124,4 +124,4 @@
(async-shell-command (format "\"%s\" %s" command args))
(cd prev-directory)))))))
-(provide 'ldg-test)
+(provide 'ledger-test)
diff --git a/lisp/ldg-texi.el b/lisp/ledger-texi.el
index 84ba34c2..68880550 100644
--- a/lisp/ldg-texi.el
+++ b/lisp/ledger-texi.el
@@ -1,4 +1,4 @@
-;;; ldg-texi.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-texi.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -169,4 +169,4 @@
(ledger-texi-write-test example-name command input output
"../test/manual")))))
-(provide 'ldg-texi)
+(provide 'ledger-texi)
diff --git a/lisp/ldg-xact.el b/lisp/ledger-xact.el
index c79ae2e9..fac040e6 100644
--- a/lisp/ldg-xact.el
+++ b/lisp/ledger-xact.el
@@ -1,4 +1,4 @@
-;;; ldg-xact.el --- Helper code for use with the "ledger" command-line tool
+;;; ledger-xact.el --- Helper code for use with the "ledger" command-line tool
;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org)
@@ -195,6 +195,6 @@ correct chronological place in the buffer."
(end-of-line -1)))))
-(provide 'ldg-xact)
+(provide 'ledger-xact)
-;;; ldg-xact.el ends here
+;;; ledger-xact.el ends here