From 5200ea1fed3f13f429615baa0f196f512ca47fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20T=C3=A9choueyres?= Date: Mon, 16 Apr 2018 21:20:17 +0200 Subject: [PATCH] Add new keyword :coding for #+include directive * lisp/ox.el (org-export-expand-include-keyword): Add new keyword `:coding' for specify the file encoding whith the `#+include:' directive. This allow to use somting like : when your org-file is encoded in utf-8. --- etc/ORG-NEWS | 10 ++++- lisp/ox.el | 117 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 71 insertions(+), 56 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 013c7b139..7a526d737 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -108,6 +108,14 @@ You can use =ob-scala.el= as packaged in scala-mode, available from the MELPA repository. ** New features +*** New keyword for ~#+include:~ directive +Add ~:coding "codign-system"~ keyword to allow include of files from +different codign system than the main org-file. +For example: +#+begin_example +,#+INCLUDE: "myfile.cmd" src cmd :coding "cp850-dos" +#+end_example + *** iCalendar export uses inheritance for TIMEZONE and LOCATION properties Both these properties can be inherited during iCalendar export, depending on the value of ~org-use-property-inheritance~. @@ -514,7 +522,7 @@ want to take over maintenance of this compatibility, please contact our mailing list. *** New syntax for export blocks - + Export blocks are explicitly marked as such at the syntax level to disambiguate their parsing from special blocks. The new syntax is diff --git a/lisp/ox.el b/lisp/ox.el index ea7d1dc81..9423ae090 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3326,6 +3326,12 @@ storing and resolving footnotes. It is created automatically." value) (prog1 (match-string 1 value) (setq value (replace-match "" nil nil value))))) + (coding + (intern (or (and (string-match + ":coding +\"\\([^\"]+\\)\"" value) + (prog1 (match-string 1 value) + (setq value (replace-match "" nil nil value)))) + (symbol-name buffer-file-coding-system)))) (env (cond ((string-match "\\" value) 'literal) ((string-match "\\