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

ledger-sort-buffer does not respect balance transactions

Open deusmax opened this issue 8 years ago • 1 comments

The sorting operation performed by the functions:

  • ledger-sort-buffer
  • ledger-mode-clean-buffer
  • ledger-sort-region

break the balance assignment statements (sec. 5.10 in the ledger3 manual).

The sorting action is not safe and can affect the integrity of the ledger file without any warning(s) to the user. Afterwards, it may be very difficult to correct.

To avoid the above, you may want to consider:

  1. ledger-sort-buffer, be removed from the ledger-mode, until a work around or enhancement is available.
  2. ledger-mode-clean-buffer, only perform the whitespace cleaning part, not the sorting.
  3. ledger-sort-region can be OK, if the user is careful enough. Perhaps it would be good practice that ledger-sort-region issues a warning to the user before proceeding with the sort operation.

deusmax avatar Jul 20 '17 15:07 deusmax

Yes. The sort function can only handle dated transactions. I am open to code submissions that can fix this but have no plans to address this. I attempted to some time ago and the effort was going to be to high.

On Thu, Jul 20, 2017 at 10:15 deusmax [email protected] wrote:

The sorting operation performed by the functions:

  • ledger-sort-buffer
  • ledger-mode-clean-buffer
  • ledger-sort-region

break the balance assignment statements (sec. 5.10 in the ledger3 manual).

The sorting action is not safe and can affect the integrity of the ledger file without any warning(s) to the user. Afterwards, it may be very difficult to correct.

To avoid the above, you may want to consider:

  1. ledger-sort-buffer, be removed from the ledger-mode, until a work around or enhancement is available.
  2. ledger-mode-clean-buffer, only perform the whitespace cleaning part, not the sorting.
  3. ledger-sort-region can be OK, if the user is careful enough. Perhaps it would be good practice that ledger-sort-region issues a warning to the user before proceeding with the sort operation.

— 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/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1rLNwiFcPtsiyhcmd0MVRMa5hjEohtks5sP28cgaJpZM4OeQb3 .

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

enderw88 avatar Jul 20 '17 15:07 enderw88