Skip to content
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

Monetary Symbol Tab Events interfere with Yasnippet #60

Open
reteov opened this issue Jan 14, 2024 · 1 comment
Open

Monetary Symbol Tab Events interfere with Yasnippet #60

reteov opened this issue Jan 14, 2024 · 1 comment

Comments

@reteov
Copy link

reteov commented Jan 14, 2024

Every time a tab event occurs on a line with an account, the monetary symbol appears at the end (in my case, it's the US dollar sign: "$"). By itself, it's nothing major, and can be convenient. However, when using Yasnippet, every line seems to act as if the tab is pressed. For the main line (with the transaction name and date), this does not seem to be a problem.

Additionally, every account line will cause the monetary symbol to swap (the symbol is added to lines that don't have it, and removed from lines that do have it). Again, no big deal, in the snippet, I just place the symbol on those lines that I do not want the symbol to appear, and all is fine.

However, the problem happens when I have a line that, in the yasnippet, ends with a placeholder and a monetary symbol. When the symbol is removed, it is replaced with nothing, and Yasnippet complains because it can't find the placeholder anymore, because the search regex ends with [:space:], and that space was removed.

I'm thinking that it might be helpful to, when removing a monetary symbol using a tab event, at least put a space in its place, to ensure such regular expressions don't fail.

@reteov
Copy link
Author

reteov commented Jan 14, 2024

I think it might be useful to add a configuration option to toggle the monetary symbol's tab swap, and then make the following lines optional:

(defun hledger-indent-account-line ()
  "Called when the line to indent is an account listing line."
  (cond
   ((hledger-acc-line-has-rupeep) (hledger-delete-rupee-sign)) ; Make optional
   ((hledger-expecting-rupeep) (hledger-insert-rupee))         ; Make optional
   (t (indent-line-to tab-width))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant