From 129e3aa03229fd2e5dd6ea9bf627e4d95a061744 Mon Sep 17 00:00:00 2001 Message-Id: <129e3aa03229fd2e5dd6ea9bf627e4d95a061744.1679488572.git.yantar92@posteo.net> From: Ihor Radchenko Date: Wed, 22 Mar 2023 13:35:22 +0100 Subject: [PATCH] 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 --- lisp/org-lint.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/org-lint.el b/lisp/org-lint.el index 0e2967b6c..8d6d22be7 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -1227,6 +1227,14 @@ (defun org-lint-incomplete-citation (ast) (org-element-property :parent text)) "Possibly incomplete citation markup"))))) +(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 @@ -1450,6 +1458,11 @@ (org-lint-add-checker 'incomplete-citation #'org-lint-incomplete-citation :categories '(cite) :trust 'low) +(org-lint-add-checker 'LaTeX-$ + "Report potentially confusing $...$ LaTeX markup." + #'org-lint-LaTeX-$ + :categories '(markup)) + (provide 'org-lint) ;; Local variables: -- 2.39.1