           (forward-line 1))))))
 
 (defun ledger-dump-variable (var)
-  (insert (format "%s: %S\n" (symbol-name var) (eval var))))
+  (if var
+   (insert (format "%s: %S\n" (symbol-name var) (eval var)))))
 
 (defun ledger-mode-dump-variables ()
   (interactive)

  (ledger-dump-variable 'ledger-occur-history)
  (ledger-dump-variable 'ledger-occur-last-match)
  (insert "ldg-post:\n")
  (ledger-dump-variable 'ledger-post-auto-adjust-amounts)
  (ledger-dump-variable 'ledger-post-amount-alignment-column)
  (ledger-dump-variable 'ledger-post-use-iswitchb)
  (ledger-dump-variable 'ledger-post-use-ido)
  (insert "ldg-reconcile:\n")
  (ledger-dump-variable 'ledger-recon-buffer-name)
  (ledger-dump-variable 'ledger-fold-on-reconcile)

  (insert "Emacs: " (version) "\n")
  (insert "System Configuration: "system-configuration "\n")
  (insert "ldg-commodities:\n")
  (ledger-dump-variable 'ledger-reconcile-default-commodity)
  (insert "ldg-exec:\n")
  (ledger-dump-variable 'ledger-works)
