From c1ad3fff9bda5935651f26e460907a77d1b3d003 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Sat, 14 Dec 2019 15:17:11 +0100
Subject: [PATCH] * gnu/packages/emascs.scm (emacs)[patches]: Fix odt export.
ox-odt copyes the file /share/emacs/26.3/etc/org/OrgOdtStyles.xml under
/tmp/odt-*/styles.xml and tries to modify it. Since files in the guix store
are read-only, it will fail. This patch fixes the export by adjusting
permissions during the export.
---
gnu/packages/emacs.scm | 1 +
.../patches/emacs-fix-odt-export.patch | 25 +++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 gnu/packages/patches/emacs-fix-odt-export.patch
@@ -80,6 +80,7 @@
"119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
+ "emacs-fix-odt-export.patch"
"emacs-source-date-epoch.patch"))
(modules '((guix build utils)))
(snippet
new file mode 100644
@@ -0,0 +1,25 @@
+Files inside the guix store are read only. "styles.xml" is copied from the
+store (/share/emacs/26.3/etc/org/OrgOdtStyles.xml), so it's read only too.
+ox-odt needs this file, so if it's not writable it will fail. This patch
+adjust the permissions.
+
+---
+ lisp/org/ox-odt.el | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
+index f9c4a93cc8..61988ffcc4 100644
+--- a/lisp/org/ox-odt.el
++++ b/lisp/org/ox-odt.el
+@@ -1384,6 +1384,8 @@ original parsed data. INFO is a plist holding export options."
+ ;; create a manifest entry for styles.xml
+ (org-odt-create-manifest-file-entry "text/xml" "styles.xml")
+
++ ;; guix store files are ro. This file need to be modified, make it rw
++ (set-file-modes (concat org-odt-zip-dir "styles.xml") #o600)
+ ;; FIXME: Who is opening an empty styles.xml before this point?
+ (with-current-buffer
+ (find-file-noselect (concat org-odt-zip-dir "styles.xml") t)
+--
+2.24.0
+
--
2.24.0