emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export snippet matching without closing "@@"
@ 2023-08-14 17:30 Tom Alexander
  2023-08-15  8:40 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Alexander @ 2023-08-14 17:30 UTC (permalink / raw)
  To: emacs-orgmode

I suspect this is a regression. I am using this test document:
```
@@latex:



\documentclass[margin,11pt]{res} % default is 10 pt



@@
```

and dumped the AST with M-x eval-expression (message "%s" (pp-to-string (org-element-parse-buffer)))

When using the latest in main (commit b89bc55867d7cb809c379d371d12d409db785154, Org mode version 9.7-pre (release_N/A-N/A-b89bc5 @ /usr/share/emacs/site-lisp/org/)) the "@@latex:" gets parsed as an export snippet despite not having a closing "@@" (because the "@@" is in a different paragraph).

When using the version of org-mode that shipped with emacs 29.1 (Org mode version 9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)) the "@@latex:" gets parsed as plaintext.

The docs seem to show that a "@@" is required as the end of an export snippet based on the pattern "@@BACKEND:VALUE@@": https://orgmode.org/worg/org-syntax.html#Export_Snippets

AST from org-mode in main:
```
(org-data
 (:standard-properties
  [1 71 1 71 0 1 nil nil nil 3 71 org-data nil nil nil nil nil #<buffer *scratch*>]
  :path nil :CATEGORY nil)
 (section
  (:standard-properties
   [1 71 1 71 0 1 nil nil nil 1 71 first-section nil nil #0 nil nil #<buffer *scratch*>])
  (paragraph
   (:standard-properties
    [1 13 1 10 3 1 nil nil nil nil nil top-comment nil nil #1 nil nil #<buffer *scratch*>])
   (export-snippet
    (:standard-properties
     [1 9 nil nil 0 nil nil nil nil nil nil nil nil nil #2 nil nil #<buffer *scratch*>]
     :back-end "latex" :value nil))
   #("\n" 0 1
     (:parent #2)))
  (paragraph
   (:standard-properties
    [13 68 13 65 3 13 nil nil nil nil nil nil nil nil #1 nil nil #<buffer *scratch*>])
   (latex-fragment
    (:standard-properties
     [13 46 nil nil 1 nil nil nil nil nil nil nil nil nil #2 nil nil #<buffer *scratch*>]
     :value "\\documentclass[margin,11pt]{res}"))
   #("% default is 10 pt\n" 0 19
     (:parent #2)))
  (paragraph
   (:standard-properties
    [68 71 68 71 0 68 nil nil nil nil nil nil nil nil #1 nil nil #<buffer *scratch*>])
   #("@@\n" 0 3
     (:parent #2)))))
```

AST from org-mode in emacs 29.1:
```
(org-data
 (:begin 1 :contents-begin 1 :contents-end 71 :end 71 :robust-begin 3 :robust-end 69 :post-blank 0 :post-affiliated 1 :path nil :mode org-data :CATEGORY nil :granularity nil)
 (section
  (:begin 1 :end 71 :contents-begin 1 :contents-end 71 :robust-begin 1 :robust-end 69 :post-blank 0 :post-affiliated 1 :mode first-section :granularity nil :parent #0)
  (paragraph
   (:begin 1 :end 13 :contents-begin 1 :contents-end 10 :post-blank 3 :post-affiliated 1 :mode top-comment :granularity nil :parent #1)
   #("@@latex:\n" 0 9
     (:parent #2)))
  (paragraph
   (:begin 13 :end 68 :contents-begin 13 :contents-end 65 :post-blank 3 :post-affiliated 13 :mode nil :granularity nil :parent #1)
   (latex-fragment
    (:value "\\documentclass[margin,11pt]{res}" :begin 13 :end 46 :post-blank 1 :parent #2))
   #("% default is 10 pt\n" 0 19
     (:parent #2)))
  (paragraph
   (:begin 68 :end 71 :contents-begin 68 :contents-end 71 :post-blank 0 :post-affiliated 68 :mode nil :granularity nil :parent #1)
   #("@@\n" 0 3
     (:parent #2)))))
```

--
Tom Alexander


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export snippet matching without closing "@@"
  2023-08-14 17:30 Export snippet matching without closing "@@" Tom Alexander
@ 2023-08-15  8:40 ` Ihor Radchenko
  2023-08-16  3:17   ` Tom Alexander
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-08-15  8:40 UTC (permalink / raw)
  To: Tom Alexander; +Cc: emacs-orgmode

"Tom Alexander" <tom@fizz.buzz> writes:

> I suspect this is a regression. I am using this test document:
> ```
> @@latex:
> ...
> and dumped the AST with M-x eval-expression (message "%s" (pp-to-string (org-element-parse-buffer)))
>
> When using the latest in main (commit b89bc55867d7cb809c379d371d12d409db785154, Org mode version 9.7-pre (release_N/A-N/A-b89bc5 @ /usr/share/emacs/site-lisp/org/)) the "@@latex:" gets parsed as an export snippet despite not having a closing "@@" (because the "@@" is in a different paragraph).

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e340dde63

-- 
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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export snippet matching without closing "@@"
  2023-08-15  8:40 ` Ihor Radchenko
@ 2023-08-16  3:17   ` Tom Alexander
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Alexander @ 2023-08-16  3:17 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

> Thanks for reporting!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e340dde63

Thanks for fixing!

-- 
Tom Alexander


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-16  3:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 17:30 Export snippet matching without closing "@@" Tom Alexander
2023-08-15  8:40 ` Ihor Radchenko
2023-08-16  3:17   ` Tom Alexander

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).