Clean up my/bibtex-in-entry-p

This commit is contained in:
Alexander Rosenberg 2025-02-08 17:33:34 -08:00
parent 641aa325dc
commit 427b70f347
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

19
init.el
View File

@ -1623,21 +1623,10 @@ COMMAND and COMINT are like `compile'."
When EXCLUDE-BRACES is non-nil, don't count the first and last brace of the When EXCLUDE-BRACES is non-nil, don't count the first and last brace of the
entry as in the entry. That is, if the point is on the first { or last } of the entry as in the entry. That is, if the point is on the first { or last } of the
entry, return nil." entry, return nil."
(save-excursion (cl-destructuring-bind (depth &rest r) (syntax-ppss)
(when (and exclude-braces (eq ?\} (char-after))) (if (zerop depth)
(forward-char)) (and (not exclude-braces) (eql (char-after) ?\{))
;; go to top level and check if the character at point is { (or (not exclude-braces) (not (eql (char-after) ?\}))))))
(let ((start-pos (point))
(last-valid (point)))
(condition-case nil
(while t
(backward-up-list 1 t t)
(setq last-valid (point)))
(error
(and
(eq ?\{ (char-after last-valid))
(or (not exclude-braces)
(not (= start-pos last-valid)))))))))
(defvar my/bibtex-indent-width 4 (defvar my/bibtex-indent-width 4
"Width to indent for `my/bibtex-calculate-indentation'.") "Width to indent for `my/bibtex-calculate-indentation'.")
(defun my/bibtex-calculate-indentation () (defun my/bibtex-calculate-indentation ()