diff options
author | 4ourbit <4ourbit@gmail.com> | 2013-12-31 02:12:52 +0100 |
---|---|---|
committer | 4ourbit <4ourbit@gmail.com> | 2013-12-31 03:16:57 +0100 |
commit | 383f17f1146b700f3c152129cf8733c80bc79286 (patch) | |
tree | 8510a45721bd9de1348eda306b60a912ec5b2f11 /lisp/ledger-mode.el | |
parent | c00e4eb8c69c5e55a3283cf692df2146c6bc8d9f (diff) | |
download | ledger-383f17f1146b700f3c152129cf8733c80bc79286.tar.gz ledger-383f17f1146b700f3c152129cf8733c80bc79286.tar.bz2 ledger-383f17f1146b700f3c152129cf8733c80bc79286.zip |
Context-aware pcomplete rules.
Provide completions based on information retrieved with 'ledger-context-at-point'.
To support step-by-step completion of transactions some more patterns were added
to 'ledger-line-config'. The actual completion rules mostly reuse some of the
convenient input commands that are buried in ledger-mode. Using the standard
pcomplete termination string (" ") to allow a "context switch" at the end of each
completion step.
Diffstat (limited to 'lisp/ledger-mode.el')
-rw-r--r-- | lisp/ledger-mode.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el index 28856bd4..209f970e 100644 --- a/lisp/ledger-mode.el +++ b/lisp/ledger-mode.el @@ -145,6 +145,11 @@ Can indent, complete or align depending on context." (defvar ledger-mode-abbrev-table) +(defvar ledger-date-string-today + (format-time-string (or + (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format))) + (defun ledger-remove-effective-date () "Removes the effective date from a transaction or posting." (interactive) @@ -153,7 +158,7 @@ Can indent, complete or align depending on context." (save-restriction (narrow-to-region (point-at-bol) (point-at-eol)) (beginning-of-line) - (cond ((eq 'xact context) + (cond ((eq 'pmnt-transaction context) (re-search-forward ledger-iso-date-regexp) (when (= (char-after) ?=) (let ((eq-pos (point))) @@ -187,7 +192,7 @@ With a prefix argument, remove the effective date. " (save-restriction (narrow-to-region (point-at-bol) (point-at-eol)) (cond - ((eq 'xact context) + ((eq 'pmnt-transaction context) (beginning-of-line) (re-search-forward ledger-iso-date-regexp) (when (= (char-after) ?=) @@ -320,7 +325,6 @@ With a prefix argument, remove the effective date. " '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) |