From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Add new keyword :coding for #+include directive Date: Mon, 23 Apr 2018 12:27:45 +0200 Message-ID: <87zi1uqkta.fsf@nicolasgoaziou.fr> References: <87tvsbx72g.fsf@killashandra.ballybran.fr> <87in8qyh3t.fsf@killashandra.ballybran.fr> <874lkakz58.fsf@nicolasgoaziou.fr> <87muy0b4kw.fsf@killashandra.ballybran.fr> <87in8lh3xk.fsf@killashandra.ballybran.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAYhN-0005Xq-Ie for emacs-orgmode@gnu.org; Mon, 23 Apr 2018 06:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAYhK-0003hJ-Cs for emacs-orgmode@gnu.org; Mon, 23 Apr 2018 06:27:53 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:36525) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAYhJ-0003fO-VI for emacs-orgmode@gnu.org; Mon, 23 Apr 2018 06:27:50 -0400 In-Reply-To: <87in8lh3xk.fsf@killashandra.ballybran.fr> ("Pierre =?utf-8?Q?T=C3=A9choueyres=22's?= message of "Sat, 21 Apr 2018 01:08:07 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Pierre =?utf-8?Q?T=C3=A9choueyres?= Cc: org-mode Hello, pierre.techoueyres@free.fr (Pierre T=C3=A9choueyres) writes: > I did my homework : found a fix for a) and rebased previous patch on > master. Thank you. Some comments follow. > * 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 : > #+include: "./myfile" :coding cp850-dos > when your org-file is encoded in utf-8 for example. Nitpick: Org file > ** New features > +*** New keyword for ~#+include:~ directive > +Add ~:coding "codign-system"~ keyword to allow include of files from =3D~:coding coding-system=3D > +different codign system than the main org-file. Org file. > +For example: > +#+begin_example > +,#+INCLUDE: "myfile.cmd" src cmd :coding cp850-dos > +#+end_example Note that we are freezing Org 9.2 right now. This will go into master once 9.2 is out. > + (coding > + (intern (or (and (string-match > + ":coding +\\<\\([a-z0-9\\-]+\\)\\>" value) > + (prog1 (match-string 1 value) > + (setq value (replace-match "" nil nil value)))) > + (symbol-name coding-system-for-read)))) (coding (or (and (string-match ":coding +\\([a-z0-9\\-]+\\)" value) (prog1 (intern (match-string 1 value)) (setq value (replace-match "" nil nil value)= ))) coding-system-for-read)) In Lisp, symbol constituents are all words plus $&*+-_<> We might want to update the regexp accordingly. > +Subject: [PATCH] Correctly convert encoding of included files > + > +* lisp/ox.el (org-export--prepare-file-contents): convert temporary > + buffer encoding to org buffer's encoding. Org buffer's encoding. Could you send an updated patch? Regards, --=20 Nicolas Goaziou 0x80A93738