[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org ce5e8ecbb8 4/4: Prioritize underline over subscript
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org ce5e8ecbb8 4/4: Prioritize underline over subscript inside parenthesis |
Date: |
Mon, 1 Apr 2024 09:58:27 -0400 (EDT) |
branch: externals/org
commit ce5e8ecbb81ec24cc9f62d15ce56ccae5aedaf11
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@posteo.net>
Prioritize underline over subscript inside parenthesis
* lisp/org-element.el (org-element--object-lex): Prioritise underline
parser over subscript. `org-element-underline-parser' is more strict
compared to `org-element-subscript-parser'.
* testing/lisp/test-org-element.el (test-org-element/underline-parser):
Add test.
* etc/ORG-NEWS (Underline syntax now takes priority over subscript
when both are applicable): Announce the breaking change.
Reported-by: Juan Manuel MacĂas <maciaschain@posteo.net>
Link: https://list.orgmode.org/87v8z52eom.fsf@posteo.net/T/#t
---
etc/ORG-NEWS | 11 +++++++++++
lisp/org-element.el | 8 ++++----
testing/lisp/test-org-element.el | 11 ++++++++++-
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b713471455..a3015d9fca 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,17 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
* Version 9.7 (not released yet)
** Important announcements and breaking changes
+*** Underline syntax now takes priority over subscript when both are applicable
+
+Previously, Org mode interpreted =(_text_)= as subscript.
+Now, the interpretation is changed to underline.
+
+=(_text_)= matches both subscript and underline markup. The
+interpretation is changed to keep consistency with other emphasis like
+=(*bold*)=.
+
+Most of the users should not be affected by this change - it only applies when
character immediately preceding =_= is one of =-=, =(=, ='=, and ={=.
+
*** ~org-latex-to-mathml-convert-command~ and
~org-latex-to-html-convert-command~ may need to be adjusted
Previously, =%i= placeholders in the
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 5857bc63ae..f4eec1695b 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5258,10 +5258,10 @@ to an appropriate container (e.g., a paragraph)."
(pcase (char-after)
(?^ (and (memq 'superscript restriction)
(org-element-superscript-parser)))
- (?_ (or (and (memq 'subscript restriction)
- (org-element-subscript-parser))
- (and (memq 'underline restriction)
- (org-element-underline-parser))))
+ (?_ (or (and (memq 'underline restriction)
+ (org-element-underline-parser))
+ (and (memq 'subscript restriction)
+ (org-element-subscript-parser))))
(?* (and (memq 'bold restriction)
(org-element-bold-parser)))
(?/ (and (memq 'italic restriction)
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index e309ed97fc..c49dc80d17 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -3306,7 +3306,16 @@ Outside list"
(= 2
(org-test-with-temp-text "__test__"
(length
- (org-element-map (org-element-parse-buffer) 'underline 'identity))))))
+ (org-element-map (org-element-parse-buffer) 'underline 'identity)))))
+ ;; Starting after non-blank
+ (should
+ (eq 'underline
+ (org-test-with-temp-text "(_under<point>line_)"
+ (org-element-type (org-element-context)))))
+ (should-not
+ (eq 'underline
+ (org-test-with-temp-text "x_under<point>line_)"
+ (org-element-type (org-element-context))))))
;;;; Verbatim