-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
indent-region
is indenting date line.
#58
Comments
I’ve never tried |
The current version being used is 2023-10-01.834 (according to package-list). This was installed when I first installed Emacs 29.1 (I had performed a complete ground-up configuration of the config file, using the version in melpa). For the time being, I'm using the following function to do the cleanup:
I use this in order to make everything consistent between Emacs entries and Cone entries. |
This looks like a bug in the function (defun hledger-indent-region-function (start end)
"Indent region (START END) according to `hledger-mode'.
We need a separate function because we do different stuff while
interactively editing an entry."
(save-excursion
(goto-char start)
(while (< (point) end)
(beginning-of-line)
(cond
((hledger-cur-has-datep) (indent-line-to 0))
((hledger-cur-starts-with-semicolp) (indent-line-to hledger-comments-column))
((hledger-cur-has-accp) (indent-line-to tab-width)))
(forward-line 1))))
(defun hledger-cur-has-datep ()
"Return true if current line has only date."
(hledger-cur-line-matchesp hledger-date-only-regex))
(defvar hledger-date-only-regex "^\\s-*[0-9]\\{4\\}[-/][0-9]\\{2\\}[-/][0-9]\\{2\\}\\s-*$"
"Regular expression for a line with date only.") We need to adjust the regexp used to match the first line of an entry when executing |
Understood. The main purpose I use indent-region for is that I use the "Cone" app on my phone to add entries. It spaces things differently, where the accounts are closer to the margin (3 spaces) and there's a hefty amount of space between the account name and the monetary value. I was using the indent-region to fix the margin-spacing for the accounts so that it better-fits with the normal spacing used in Emacs. |
I'll soon look into it and make a change to fix it. A PR is always welcome :) |
I'm not sure if this is specific to Emacs 29.1, or if it's just coincidental with the new version release, but it seems like
indent-region
is now causing the date line to indent as well as the account lines.The text was updated successfully, but these errors were encountered: