emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: "Fraga, Eric" <e.fraga@ucl.ac.uk>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: The Org mode in the Org Git does not export
Date: Fri, 07 Oct 2022 16:18:30 +0200	[thread overview]
Message-ID: <m235bzpvih.fsf@me.com> (raw)
In-Reply-To: <87zge8j5iu.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Ihor Radchenko <yantar92@gmail.com> writes:

> I do not see how it is related.  Do you see the error with your config
> or with clean Emacs?

Good point.  Just with my config.  Ignoring for now!

> Oops. Another side-effect of `buffer-file-name'. Fixed now.

Thank you!

>> (2) no corruption happens to the original file after export.
>
> Done.

Superb!

>> (1) re-opening the file after export always re-opens it, and
>
> I am not sure how to test this part.

How about the attached patch?

It mirrors the manual steps (find-file, export, kill-buffer, find-file),
except it calls just the 'org-export-copy-buffer' procedure instead of
exporting to HTML.  The test fails without your fix and passes with it.

Rudy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-a-regression-test-for-org-export-copy-buffer.patch --]
[-- Type: text/x-patch, Size: 2039 bytes --]

From 8bc0f1e807df653634e77e5e5fc543a2e82191c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Fri, 7 Oct 2022 16:04:28 +0200
Subject: [PATCH] Add a regression test for 'org-export-copy-buffer'

* testing/lisp/test-ox.el (test-org-export/org-export-copy-buffer):
Make sure that 'find-file' after 'org-export-copy-buffer' re-opens the
original file instead of the copy buffer.
---
 testing/lisp/test-ox.el | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 90a9eb3aa..60bf04316 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -63,20 +63,31 @@ variable, and communication channel under `info'."
 
 (ert-deftest test-org-export/org-export-copy-buffer ()
   "Test `org-export-copy-buffer' specifications."
-  ;; The buffer copy must not cause overwriting the original file
-  ;; buffer under any circumstances.
+  ;; The copy must not overwrite the original file.
   (org-test-with-temp-text-in-file
       "* Heading"
     (let ((file (buffer-file-name)))
       (with-current-buffer (org-export-copy-buffer)
-        (insert "This must not go into actual file.")
+        (insert "This must not go into the original file.")
         (save-buffer)
         (should
          (equal
           "* Heading"
           (with-temp-buffer
             (insert-file-contents file)
-            (buffer-string))))))))
+            (buffer-string)))))))
+  ;; The copy must not show when re-opening the original file.
+  (org-test-with-temp-text-in-file
+      "* Heading"
+    (let ((file (buffer-file-name)))
+      (with-current-buffer (org-export-copy-buffer)
+        (insert "This must not show as the original file.")
+        (save-buffer))
+      (should
+       (equal "* Heading"
+              (with-temp-buffer
+                (find-file file)
+                (buffer-string)))))))
 
 (ert-deftest test-org-export/bind-keyword ()
   "Test reading #+BIND: keywords."
-- 
2.37.3


[-- Attachment #3: Type: text/plain, Size: 214 bytes --]

-- 
"Chop your own wood and it will warm you twice."
-- Henry Ford; Francis Kinloch, 1819; Henry David Thoreau, 1854

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

  reply	other threads:[~2022-10-07 15:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 16:40 The Org mode in the Org Git does not export Rudolf Adamkovič
2022-09-25 17:06 ` Fraga, Eric
2022-09-27 22:19   ` Rudolf Adamkovič
2022-09-28  3:06     ` Ihor Radchenko
2022-09-28 12:45       ` Rudolf Adamkovič
2022-09-28 12:55         ` Rudolf Adamkovič
2022-09-28 13:24           ` Ihor Radchenko
2022-09-28 15:49           ` Max Nikulin
2022-09-28 13:14         ` Ihor Radchenko
2022-09-28 15:56           ` Rudolf Adamkovič
2022-09-28 17:29             ` Rudolf Adamkovič
2022-09-29  2:30               ` Ihor Radchenko
2022-09-29 13:37                 ` Rudolf Adamkovič
2022-09-29 13:56                   ` Ihor Radchenko
2022-09-30 12:01                     ` Rudolf Adamkovič
2022-10-01  3:02                       ` Ihor Radchenko
2022-10-01 18:04                         ` Rudolf Adamkovič
2022-10-07  5:31                           ` Ihor Radchenko
2022-10-07  9:10                             ` Rudolf Adamkovič
2022-10-07 10:24                               ` Ihor Radchenko
2022-10-07 14:18                                 ` Rudolf Adamkovič [this message]
2022-10-09  6:36                                   ` Ihor Radchenko
2022-10-09 15:29                                     ` Rudolf Adamkovič
2022-10-10 10:15                                       ` Ihor Radchenko
2022-10-10 22:08                                         ` Rudolf Adamkovič
2022-09-26  4:39 ` Ihor Radchenko
2022-09-27 22:30   ` Rudolf Adamkovič

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=m235bzpvih.fsf@me.com \
    --to=salutis@me.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /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).