ledger-mode icon indicating copy to clipboard operation
ledger-mode copied to clipboard

(ledger-report payee) fails when file only has "include directives"

Open JalapenoGremlin opened this issue 6 years ago • 2 comments

I have a "root" ledger file that contains several include xxx.ledger lines (and no other entries).

When I type C-c C-o C-r (ledger-report) and select payee. I receive the following error message: ledger-report-payee-format-specifier: Wrong type argument: stringp, nil

This is because of the following:

(defun ledger-report-payee-format-specifier ()
  "Substitute a payee name.

   The user is prompted to enter a payee and that is substitued.  If
   point is in an xact, the payee for that xact is used as the
   default."
  ;; It is intended completion should be available on existing
  ;; payees, but the list of possible completions needs to be
  ;; developed to allow this.
  (ledger-read-string-with-default "Payee" (regexp-quote  (ledger-xact-payee))))

The problem is that (ledger-xact-payee) returns nil in such cases.

Would it make sense to change (regexp-quote (ledger-xact-payee)) to (or (regexp-quote (ledger-xact-payee)) "")?

JalapenoGremlin avatar Apr 16 '18 23:04 JalapenoGremlin

Just stumbled upon this. Actually it fails even if you do have transactions in the file but point is not in one.

zhelezov avatar Aug 21 '19 11:08 zhelezov

Yep. It should probably prompt for a payee if there is no xact to parse.

On Wed, Aug 21, 2019 at 4:21 AM Vladimir Zhelezov [email protected] wrote:

Just stumbled upon this. Actually it fails even if you do have transactions in the file but point is not in one.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ledger/ledger-mode/issues/112?email_source=notifications&email_token=AAGWWLBEN443ERJK2GQBYLTQFUQKXA5CNFSM4E25WVTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4ZKR5Q#issuecomment-523413750, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGWWLHYUG2S7DBHI5TDTATQFUQKXANCNFSM4E25WVTA .

-- Craig, Corona De Tucson, AZ [image: missile_flyout] enderw88.wordpress.com

enderw88 avatar Aug 21 '19 12:08 enderw88

@JalapenoGremlin @zhelezov can you confirm this is still an issue for you? Running the latest ledger-mode I don't have this issue. I'm not prompted with a list of payees from a completing-read interface but if I type a valid payee at the Payee: prompt the report is produced as one would expect. If this is no longer an issue for you please consider closing this issue. Thanks.

doolio avatar Jan 04 '24 13:01 doolio

I could not reproduce this, and I believe it was fixed by 4b8b784a9feaa52c4cc207d5e8d7bfc5bf4fce68 (which also fixed #249).

bcc32 avatar Mar 22 '24 04:03 bcc32