8000 Enforce case-sensitivity on all regexps · Issue #63 · beancount/beancount-mode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Enforce case-sensitivity on all regexps #63

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

Open
loverobean opened this issue Feb 21, 2025 · 0 comments
Open

Enforce case-sensitivity on all regexps #63

loverobean opened this issue Feb 21, 2025 · 0 comments

Comments

@loverobean
Copy link
Contributor

As a long-term follow up to Issue#61, it would be best to go through all regexps in this mode and set case-fold-search nil, or perhaps to define a version of looking-at which will always be case-sensitive regardless of the value of case-fold-search.

(In this particular case, the behavior with case-folding is a little more convenient, because if a user attempts to use a lowercase letter as a flag, he can correct his mistake using beancount-transaction-clear or beancount-transaction-flag, which would not be possible if the regexp match failed.

That said, in general, the code would be more precise if every regexp match were case-sensitive.

(defun beancount-transaction-clear (&optional arg)
  "Clear transaction at point. With a prefix argument set the
transaction as pending."
  (interactive "P")
  (save-excursion
    (save-match-data
      (let ((case-fold-search nil))
      (let ((flag (if arg "!" "*")))
        (beancount-goto-transaction-begin)
        (if (looking-at beancount-transaction-regexp)
            (replace-match flag t t nil 2)))))))
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
0