Scerj <jnickoloff-Re5JQ...@public.gmane.org> writes:
> When I try to reconcile my checking account with Emacs and the ledger-
> mode I get an error at the bottom of emacs which reads:
>
> save-excursion: Wrong type argument: number-or-marker-p, nil
I too have recently rebuilt Ledger and am seeing a similar problem with
reconcile mode.
> Any ideas on what could be causing this?
Maybe a possible partial explanation but no fix.
In my case it errors out in the function ledger-do-reconcile at the point
it is trying to goto the line number in the ledger file for a particular
transaction. The uncleared transactions are in a list structure that I
think _should_ look something like:
((/dev/stdin 1890 (19667 18688 0) nil "John Lewis"
(1897 "Liabilities:premier" "£-159.00" nil))...
The file line numbers are the second item in the detail of each
transction which are dug out with an (nth 1 call and passed to
goto-line. What I see being passed through to goto-line is actually
/dev/stdin, which, not being a file position causes the error.
The transaction list is built by a call out to ledger with the emacs
option that returns a stream suitable for the lisp reader to swallow up.
In my case that stream looks like:
((""/dev/stdin"" 1890 (19667 18688 0) nil "John Lewis"
(1897 "Liabilities:premier" "£-159.00" nil))...
with those odd looking doubled quotes. I am guessing but it looks
like the reader is seeing an empty string as the first item in the list
and therefore /dev/stdin, rather than the line number, as the second.
This isn't a lisp issue. I am getting those doubled quotes on the
command line as well. If they are the source of the problem then I'm
sorry but I have no idea where they are coming from.
For what it is worth I am building with boost 1.46.1
Phil
> In my case it errors out in the function ledger-do-reconcile at the point
> it is trying to goto the line number in the ledger file for a particular
> transaction. The uncleared transactions are in a list structure that I
> think _should_ look something like:
>
> ((/dev/stdin 1890 (19667 18688 0) nil "John Lewis"
> (1897 "Liabilities:premier" "£-159.00" nil))...
>
> The file line numbers are the second item in the detail of each
> transction which are dug out with an (nth 1 call and passed to
> goto-line. What I see being passed through to goto-line is actually
> /dev/stdin, which, not being a file position causes the error.
>
> The transaction list is built by a call out to ledger with the emacs
> option that returns a stream suitable for the lisp reader to swallow up.
> In my case that stream looks like:
>
> ((""/dev/stdin"" 1890 (19667 18688 0) nil "John Lewis"
> (1897 "Liabilities:premier" "£-159.00" nil))...
>
> with those odd looking doubled quotes. I am guessing but it looks
> like the reader is seeing an empty string as the first item in the list
> and therefore /dev/stdin, rather than the line number, as the second.
>
I can confirm this issue.
> This isn't a lisp issue. I am getting those doubled quotes on the
> command line as well. If they are the source of the problem then I'm
> sorry but I have no idea where they are coming from.
My emergency workaround (for the past several weeks) has been to use
some elisp to remove the double quotes:
--8<---------------cut here---------------start------------->8---
diff --git a/ledger/ledger.el b/ledger/ledger.el
index 8e4de27..20a4370 100644
--- a/ledger/ledger.el
+++ b/ledger/ledger.el
@@ -583,6 +583,9 @@ dropped."
(ledger-run-ledger buf "--uncleared" "emacs" account)))
(when (= 0 exit-code)
(goto-char (point-min))
+ (while (re-search-forward "\"\"" nil t)
+ (replace-match "\""))
+ (goto-char (point-min))
(unless (eobp)
(unless (looking-at "(")
(error (buffer-string)))
--8<---------------cut here---------------end--------------->8---
Obviously, this is not a long-term solution. :)
Best,
Matt