[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hyphen after LaTeX fragments
From: |
Ihor Radchenko |
Subject: |
Re: Hyphen after LaTeX fragments |
Date: |
Wed, 22 Mar 2023 12:36:45 +0000 |
Yuchen Guo <yuchen@apvc.uk> writes:
> If it is deprecated in Org mode, maybe we can print a warning message in
> echo area?
Not in echo area, but we can add a linter.
>From 129e3aa03229fd2e5dd6ea9bf627e4d95a061744 Mon Sep 17 00:00:00 2001
Message-Id:
<129e3aa03229fd2e5dd6ea9bf627e4d95a061744.1679488572.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
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
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: Hyphen after LaTeX fragments, (continued)
- Re: Hyphen after LaTeX fragments, Dominik Schrempf, 2023/03/14
- Re: Hyphen after LaTeX fragments, Max Nikulin, 2023/03/14
- Hyphen after LaTeX fragments, Yuchen Guo, 2023/03/14
- Re: Hyphen after LaTeX fragments, iemacs, 2023/03/19
- Re: Hyphen after LaTeX fragments, Rudolf Adamkovič, 2023/03/21
- Re: Hyphen after LaTeX fragments, Dominik Schrempf, 2023/03/21
- Re: Hyphen after LaTeX fragments, Ihor Radchenko, 2023/03/22
- Re: Hyphen after LaTeX fragments, Dominik Schrempf, 2023/03/22
- Re: Hyphen after LaTeX fragments, Ihor Radchenko, 2023/03/22
- Re: Hyphen after LaTeX fragments, Yuchen Guo, 2023/03/21
- Re: Hyphen after LaTeX fragments,
Ihor Radchenko <=
Hyphen after LaTeX fragments, Yuchen Guo, 2023/03/14