reddit / emacs

How can I prevent ox from unindenting lines?

Titikomba · 2022-09-28 10:39
Hi all, Here is an illustration. Consider the following file `hamlet.org`: Prince Hamlet of Denmark is the son of the recently deceased King Hamlet, and nephew of King Claudius, his father’s brother and successor. Claudius hastily married King Hamlet’s widow, Gertrude, Hamlet’s mother, and took the throne for himself. Denmark has a long-standing feud with neighbouring Norway, in which King Hamlet slew King Fortinbras of Norway in a battle some years ago. Although Denmark defeated Norway and the Norwegian throne fell to King Fortinbras’s infirm brother, Denmark fears that an invasion led by the dead Norwegian king’s son, Prince Fortinbras, is imminent. On a cold night on the ramparts of Elsinore, the Danish royal castle, the sentries Bernardo and Marcellus discuss a ghost resembling the late King Hamlet which they have recently seen, and bring Prince Hamlet’s friend Horatio as a witness. and this tiny `org-export-filter-body`'s function: (with-eval-after-load 'ox (defun org-strange-behavior (text backend info) "Print text, as read by the export-filter-body functions." (when (org-export-derived-backend-p backend 'latex) (message text))) (add-to-list 'org-export-filter-body-functions 'org-strange-behavior)) When exporting `hamlet.org` in whatever format, the Message buffer shows this: Prince Hamlet of Denmark is the son of the recently deceased King Hamlet, and nephew of King Claudius, his father’s brother and successor. Claudius hastily married King Hamlet’s widow, Gertrude, Hamlet’s mother, and took the throne for himself. Denmark has a long-standing feud with neighbouring Norway, in which King Hamlet slew King Fortinbras of Norway in a battle some years ago. Although Denmark defeated Norway and the Norwegian throne fell to King Fortinbras’s infirm brother, Denmark fears that an invasion led by the dead Norwegian king’s son, Prince Fortinbras, is imminent. On a cold night on the ramparts of Elsinore, the Danish royal castle, the sentries Bernardo and Marcellus discuss a ghost resembling the late King Hamlet which they have recently seen, and bring Prince Hamlet’s friend Horatio as a witness. My question is thus: how can I prevent ox from unindenting the last line ? I explored ox as much as I could, and did not find anything promising :/. I'm aware of an `org-export-preserve-breaks` variable but it preserves too much things (and causes export to be odd, in my opinion).
dybbuk12 · 2022-09-28 21:45
Have you tried using [verse blocks](https://orgmode.org/manual/Paragraphs.html#index-verse-blocks)? Also you might want to try asking on r/orgmode.
Titikomba · 2022-09-29 05:49
Hi, I'm looking for a global solution, so verse blocks are not an option (the goal after that is to extend the export backend using regexp on tabulation; this is the reason why I want ox to preserve them). I'll duplicate the post on r/orgmode :)
sneakpeekbot · 2022-09-29 05:49
Here's a sneak peek of /r/orgmode using the [top posts](https://np.reddit.com/r/orgmode/top/?sort=top&t=year) of the year! \#1: [What last-minute university assignments do to me](https://i.redd.it/wx3s6l6ee5981.jpg) | [2 comments](https://np.reddit.com/r/orgmode/comments/rttlmz/what_lastminute_university_assignments_do_to_me/) \#2: [Org 9.5 released](https://orgmode.org/Changes.html) | [21 comments](https://np.reddit.com/r/orgmode/comments/py5z2v/org_95_released/) \#3: [Org-mode needs your help](https://np.reddit.com/r/orgmode/comments/q0dsjb/orgmode_needs_your_help/) ---- ^^I'm ^^a ^^bot, ^^beep ^^boop ^^| ^^Downvote ^^to ^^remove ^^| ^^[Contact](https://www.reddit.com/message/compose/?to=sneakpeekbot) ^^| ^^[Info](https://np.reddit.com/r/sneakpeekbot/) ^^| ^^[Opt-out](https://np.reddit.com/r/sneakpeekbot/comments/o8wk1r/blacklist_ix/) ^^| ^^[GitHub](https://github.com/ghnr/sneakpeekbot)