emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Tom Alexander" <tom@fizz.buzz>
To: emacs-orgmode@gnu.org
Subject: Export snippet matching without closing "@@"
Date: Mon, 14 Aug 2023 13:30:23 -0400	[thread overview]
Message-ID: <fb61ea28-f004-4c25-adf7-69fc55683ed4@app.fastmail.com> (raw)

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


             reply	other threads:[~2023-08-14 17:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 17:30 Tom Alexander [this message]
2023-08-15  8:40 ` Export snippet matching without closing "@@" Ihor Radchenko
2023-08-16  3:17   ` Tom Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb61ea28-f004-4c25-adf7-69fc55683ed4@app.fastmail.com \
    --to=tom@fizz.buzz \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).