1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

org-lint: Add checker for $...$ LaTeX fragments

* lisp/org-lint.el (org-lint-LaTeX-$): New checker warning about
semi-obsolete $...$ LaTeX fragment syntax.

Link: https://orgmode.org/list/86ileukojk.fsf@lan
This commit is contained in:
Ihor Radchenko 2023-03-22 13:35:22 +01:00
parent ab85c1b958
commit cfe5e01e14
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -1251,6 +1251,14 @@ Use \"export %s\" instead"
(format "Bullet counter \"%s\" is not the same with item position %d. Consider adding manual [@%d] counter."
bullet (car (last true-number)) bullet-number))))))))
(defun org-lint-LaTeX-$ (ast)
"Report semi-obsolete $...$ LaTeX fragments."
(org-element-map ast 'latex-fragment
(lambda (fragment)
(and (string-match-p "^[$][^$]" (org-element-property :value fragment))
(list (org-element-property :begin fragment)
"Potentially confusing LaTeX fragment format. Prefer using more reliable \\(...\\)")))))
;;; Checkers declaration
@ -1479,6 +1487,11 @@ Use \"export %s\" instead"
#'org-lint-item-number
:categories '(plain-list))
(org-lint-add-checker 'LaTeX-$
"Report potentially confusing $...$ LaTeX markup."
#'org-lint-LaTeX-$
:categories '(markup))
(provide 'org-lint)
;; Local variables: