Doc string cleanup.

This commit is contained in:
Craig Earls 2014-12-01 20:07:46 -07:00
parent 438aaf251c
commit 66d2e4fecd
5 changed files with 36 additions and 28 deletions

View file

@ -36,7 +36,7 @@
:group 'ledger) :group 'ledger)
(defcustom ledger-mode-should-check-version t (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 :type 'boolean
:group 'ledger-exec) :group 'ledger-exec)
@ -53,6 +53,7 @@
(setq buffer-read-only t))) (setq buffer-read-only t)))
(defun ledger-exec-success-p (ledger-output-buffer) (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 (with-current-buffer ledger-output-buffer
(goto-char (point-min)) (goto-char (point-min))
(if (and (> (buffer-size) 1) (looking-at (regexp-quote "While"))) (if (and (> (buffer-size) 1) (looking-at (regexp-quote "While")))

View file

@ -26,16 +26,17 @@
;; states ;; states
;;; Code:
(provide 'ledger-fontify) (provide 'ledger-fontify)
(defcustom ledger-fontify-xact-state-overrides nil (defcustom ledger-fontify-xact-state-overrides nil
"If t the overall xact state (cleard, pending, nil) will "If t the highlight entire xact with state."
control the font of the entire transaction, not just the payee
line."
:type 'boolean :type 'boolean
:group 'ledger) :group 'ledger)
(defun ledger-fontify-buffer-part (&optional beg end len) (defun ledger-fontify-buffer-part (&optional beg end len)
"Fontify buffer from BEG to END, length LEN."
(save-excursion (save-excursion
(unless beg (setq beg (point-min))) (unless beg (setq beg (point-min)))
(unless end (setq end (point-max))) (unless end (setq end (point-max)))
@ -49,7 +50,7 @@
(ledger-navigate-next-xact-or-directive)))) (ledger-navigate-next-xact-or-directive))))
(defun ledger-fontify-xact-at (position) (defun ledger-fontify-xact-at (position)
(interactive "d") "Fontify the xact at POS."
(save-excursion (save-excursion
(goto-char position) (goto-char position)
(let ((extents (ledger-navigate-find-element-extents position)) (let ((extents (ledger-navigate-find-element-extents position))
@ -62,8 +63,7 @@
(ledger-fontify-xact-by-line extents))))) (ledger-fontify-xact-by-line extents)))))
(defun ledger-fontify-xact-by-line (extents) (defun ledger-fontify-xact-by-line (extents)
"do line-by-line detailed fontification of xact" "Do line-by-line detailed fontification of xact in EXTENTS."
(interactive)
(save-excursion (save-excursion
(ledger-fontify-xact-start (car extents)) (ledger-fontify-xact-start (car extents))
(while (< (point) (cadr extents)) (while (< (point) (cadr extents))
@ -96,6 +96,7 @@ Fontify the first line of an xact"
(match-end 4)) 'ledger-font-comment-face))) (match-end 4)) 'ledger-font-comment-face)))
(defun ledger-fontify-posting (pos) (defun ledger-fontify-posting (pos)
"FOntify the posting at POS."
(let* ((state nil) (let* ((state nil)
(end-of-line-comment nil) (end-of-line-comment nil)
(end (progn (end-of-line) (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-fontify-set-face (list (- start 1) (point)) ;; subtract 1 from start because we passed the semi-colon
'ledger-font-comment-face)))))) 'ledger-font-comment-face))))))
(defun ledger-fontify-directive-at (position) (defun ledger-fontify-directive-at (pos)
(let ((extents (ledger-navigate-find-element-extents position)) "Fontify the directive at POS."
(let ((extents (ledger-navigate-find-element-extents pos))
(face 'ledger-font-default-face)) (face 'ledger-font-default-face))
(cond ((looking-at "=") (cond ((looking-at "=")
(setq face 'ledger-font-auto-xact-face)) (setq face 'ledger-font-auto-xact-face))
@ -190,6 +192,7 @@ Fontify the first line of an xact"
(ledger-fontify-set-face extents face))) (ledger-fontify-set-face extents face)))
(defun 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)) (put-text-property (car extents) (cadr extents) 'face face))
;;; ledger-fontify.el ends here ;;; ledger-fontify.el ends here

View file

@ -70,8 +70,6 @@
"Default face for pending (!) payees" "Default face for pending (!) payees"
:group 'ledger-faces) :group 'ledger-faces)
(defface ledger-font-xact-highlight-face (defface ledger-font-xact-highlight-face
`((t :inherit ledger-occur-xact-face)) `((t :inherit ledger-occur-xact-face))
"Default face for transaction under point" "Default face for transaction under point"

View file

@ -24,8 +24,10 @@
(require 'ledger-regex) (require 'ledger-regex)
;;; Code:
(defcustom ledger-init-file-name "~/.ledgerrc" (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) :group 'ledger-exec)
(defvar ledger-environment-alist nil) (defvar ledger-environment-alist nil)
@ -33,6 +35,7 @@
(defvar ledger-default-date-format "%Y/%m/%d") (defvar ledger-default-date-format "%Y/%m/%d")
(defun ledger-init-parse-initialization (buffer) (defun ledger-init-parse-initialization (buffer)
"Parse the .ledgerrc file in BUFFER."
(with-current-buffer buffer (with-current-buffer buffer
(let (environment-alist) (let (environment-alist)
(goto-char (point-min)) (goto-char (point-min))
@ -53,6 +56,7 @@
environment-alist))) environment-alist)))
(defun ledger-init-load-init-file () (defun ledger-init-load-init-file ()
"Load and parse the .ledgerrc file."
(interactive) (interactive)
(let ((init-base-name (file-name-nondirectory ledger-init-file-name))) (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 (if (get-buffer init-base-name) ;; init file already loaded, parse it and leave it

View file

@ -231,22 +231,24 @@ Return the number of uncleared xacts found."
(defun ledger-reconcile-visit (&optional come-back) (defun ledger-reconcile-visit (&optional come-back)
"Recenter ledger buffer on transaction and COME-BACK if non-nil." "Recenter ledger buffer on transaction and COME-BACK if non-nil."
(interactive) (interactive)
(progn (beginning-of-line)
(beginning-of-line) (let* ((where (get-text-property (1+ (point)) 'where))
(let* ((where (get-text-property (1+ (point)) 'where)) (target-buffer (if where
(target-buffer (if where (ledger-reconcile-get-buffer where)
(ledger-reconcile-get-buffer where) nil))
nil)) (cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name)))
(cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name)))) (cur-frame (selected-frame)))
(when target-buffer (when target-buffer
(switch-to-buffer-other-window target-buffer) (switch-to-buffer-other-window target-buffer)
(ledger-navigate-to-line (cdr where)) (ledger-navigate-to-line (cdr where))
(forward-char) (forward-char)
(recenter) (recenter)
(ledger-highlight-xact-under-point) (ledger-highlight-xact-under-point)
(forward-char -1) (forward-char -1)
(if (and come-back cur-win) (when (and come-back cur-win)
(select-window cur-win)))))) (select-frame-set-input-focus cur-frame)
(select-window cur-win)
(get-buffer)))))
(defun ledger-reconcile-save () (defun ledger-reconcile-save ()