summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ledger-exec.el3
-rw-r--r--lisp/ledger-fontify.el19
-rw-r--r--lisp/ledger-fonts.el2
-rw-r--r--lisp/ledger-init.el6
-rw-r--r--lisp/ledger-reconcile.el34
5 files changed, 36 insertions, 28 deletions
diff --git a/lisp/ledger-exec.el b/lisp/ledger-exec.el
index cd5c11a0..1a0c967d 100644
--- a/lisp/ledger-exec.el
+++ b/lisp/ledger-exec.el
@@ -36,7 +36,7 @@
:group 'ledger)
(defcustom ledger-mode-should-check-version t
- "Should Ledger-mode verify that the executable is working"
+ "Should Ledger-mode verify that the executable is working?"
:type 'boolean
:group 'ledger-exec)
@@ -53,6 +53,7 @@
(setq buffer-read-only t)))
(defun ledger-exec-success-p (ledger-output-buffer)
+ "Return t if the ledger output in LEDGER-OUTPUT-BUFFER is successful."
(with-current-buffer ledger-output-buffer
(goto-char (point-min))
(if (and (> (buffer-size) 1) (looking-at (regexp-quote "While")))
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index 7d3c3e21..d5979841 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -26,16 +26,17 @@
;; states
+;;; Code:
+
(provide 'ledger-fontify)
(defcustom ledger-fontify-xact-state-overrides nil
- "If t the overall xact state (cleard, pending, nil) will
- control the font of the entire transaction, not just the payee
- line."
+ "If t the highlight entire xact with state."
:type 'boolean
:group 'ledger)
(defun ledger-fontify-buffer-part (&optional beg end len)
+"Fontify buffer from BEG to END, length LEN."
(save-excursion
(unless beg (setq beg (point-min)))
(unless end (setq end (point-max)))
@@ -49,7 +50,7 @@
(ledger-navigate-next-xact-or-directive))))
(defun ledger-fontify-xact-at (position)
- (interactive "d")
+ "Fontify the xact at POS."
(save-excursion
(goto-char position)
(let ((extents (ledger-navigate-find-element-extents position))
@@ -62,8 +63,7 @@
(ledger-fontify-xact-by-line extents)))))
(defun ledger-fontify-xact-by-line (extents)
- "do line-by-line detailed fontification of xact"
- (interactive)
+ "Do line-by-line detailed fontification of xact in EXTENTS."
(save-excursion
(ledger-fontify-xact-start (car extents))
(while (< (point) (cadr extents))
@@ -96,6 +96,7 @@ Fontify the first line of an xact"
(match-end 4)) 'ledger-font-comment-face)))
(defun ledger-fontify-posting (pos)
+ "FOntify the posting at POS."
(let* ((state nil)
(end-of-line-comment nil)
(end (progn (end-of-line)
@@ -144,8 +145,9 @@ Fontify the first line of an xact"
(ledger-fontify-set-face (list (- start 1) (point)) ;; subtract 1 from start because we passed the semi-colon
'ledger-font-comment-face))))))
-(defun ledger-fontify-directive-at (position)
- (let ((extents (ledger-navigate-find-element-extents position))
+(defun ledger-fontify-directive-at (pos)
+ "Fontify the directive at POS."
+ (let ((extents (ledger-navigate-find-element-extents pos))
(face 'ledger-font-default-face))
(cond ((looking-at "=")
(setq face 'ledger-font-auto-xact-face))
@@ -190,6 +192,7 @@ Fontify the first line of an xact"
(ledger-fontify-set-face extents face)))
(defun ledger-fontify-set-face (extents face)
+ "Set the text in EXTENTS to FACE."
(put-text-property (car extents) (cadr extents) 'face face))
;;; ledger-fontify.el ends here
diff --git a/lisp/ledger-fonts.el b/lisp/ledger-fonts.el
index 99927315..3accff9b 100644
--- a/lisp/ledger-fonts.el
+++ b/lisp/ledger-fonts.el
@@ -70,8 +70,6 @@
"Default face for pending (!) payees"
:group 'ledger-faces)
-
-
(defface ledger-font-xact-highlight-face
`((t :inherit ledger-occur-xact-face))
"Default face for transaction under point"
diff --git a/lisp/ledger-init.el b/lisp/ledger-init.el
index 491f20cf..9a20ac98 100644
--- a/lisp/ledger-init.el
+++ b/lisp/ledger-init.el
@@ -24,8 +24,10 @@
(require 'ledger-regex)
+;;; Code:
+
(defcustom ledger-init-file-name "~/.ledgerrc"
- "Location of the ledger initialization file. nil if you don't have one"
+ "Location of the ledger initialization file. nil if you don't have one."
:group 'ledger-exec)
(defvar ledger-environment-alist nil)
@@ -33,6 +35,7 @@
(defvar ledger-default-date-format "%Y/%m/%d")
(defun ledger-init-parse-initialization (buffer)
+ "Parse the .ledgerrc file in BUFFER."
(with-current-buffer buffer
(let (environment-alist)
(goto-char (point-min))
@@ -53,6 +56,7 @@
environment-alist)))
(defun ledger-init-load-init-file ()
+ "Load and parse the .ledgerrc 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
diff --git a/lisp/ledger-reconcile.el b/lisp/ledger-reconcile.el
index a8dc1ebd..504a4b5c 100644
--- a/lisp/ledger-reconcile.el
+++ b/lisp/ledger-reconcile.el
@@ -231,22 +231,24 @@ Return the number of uncleared xacts found."
(defun ledger-reconcile-visit (&optional come-back)
"Recenter ledger buffer on transaction and COME-BACK if non-nil."
(interactive)
- (progn
- (beginning-of-line)
- (let* ((where (get-text-property (1+ (point)) 'where))
- (target-buffer (if where
- (ledger-reconcile-get-buffer where)
- nil))
- (cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name))))
- (when target-buffer
- (switch-to-buffer-other-window target-buffer)
- (ledger-navigate-to-line (cdr where))
- (forward-char)
- (recenter)
- (ledger-highlight-xact-under-point)
- (forward-char -1)
- (if (and come-back cur-win)
- (select-window cur-win))))))
+ (beginning-of-line)
+ (let* ((where (get-text-property (1+ (point)) 'where))
+ (target-buffer (if where
+ (ledger-reconcile-get-buffer where)
+ nil))
+ (cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name)))
+ (cur-frame (selected-frame)))
+ (when target-buffer
+ (switch-to-buffer-other-window target-buffer)
+ (ledger-navigate-to-line (cdr where))
+ (forward-char)
+ (recenter)
+ (ledger-highlight-xact-under-point)
+ (forward-char -1)
+ (when (and come-back cur-win)
+ (select-frame-set-input-focus cur-frame)
+ (select-window cur-win)
+ (get-buffer)))))
(defun ledger-reconcile-save ()