diff --git a/init.el b/init.el index 66c6c48..1330b74 100644 --- a/init.el +++ b/init.el @@ -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 entry as in the entry. That is, if the point is on the first { or last } of the entry, return nil." - (save-excursion - (when (and exclude-braces (eq ?\} (char-after))) - (forward-char)) - ;; go to top level and check if the character at point is { - (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))))))))) + (cl-destructuring-bind (depth &rest r) (syntax-ppss) + (if (zerop depth) + (and (not exclude-braces) (eql (char-after) ?\{)) + (or (not exclude-braces) (not (eql (char-after) ?\})))))) (defvar my/bibtex-indent-width 4 "Width to indent for `my/bibtex-calculate-indentation'.") (defun my/bibtex-calculate-indentation ()