From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [RFC] Draft mode Date: Mon, 28 Sep 2015 21:56:56 +0100 Message-ID: <87twqe4607.fsf@gmail.com> References: <87io6w9p7y.fsf@nicolasgoaziou.fr> <87a8s89jp2.fsf@nicolasgoaziou.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]:40892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgfU2-0003Tm-Jn for emacs-orgmode@gnu.org; Mon, 28 Sep 2015 16:57:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgfTx-0001lM-Jc for emacs-orgmode@gnu.org; Mon, 28 Sep 2015 16:57:14 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:33011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgfTx-0001kn-EG for emacs-orgmode@gnu.org; Mon, 28 Sep 2015 16:57:09 -0400 Received: by wiclk2 with SMTP id lk2so123174669wic.0 for ; Mon, 28 Sep 2015 13:57:08 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Charles C. Berry" , Nicolas Goaziou Cc: Org Mode List Hi Nicolas, This looks like a useful addition. 2015ko irailak 27an, "Charles C. Berry"-ek idatzi zuen: >=20 > On Sun, 27 Sep 2015, Nicolas Goaziou wrote: >=20 >> Nicolas Goaziou writes: >>=20 >>> The following patch implements a draft mode for export. When in draft >>> mode, invalid macros and links do not throw an error. It can be toggled >>> with `org-export-as-draft' variable, or using C-d in export dispatch. >>>=20 >>> It introduces a backward incompatible change since it modifies signature >>> from `org-export-as' and alike. >>>=20 >=20 > I don't get it. >=20 > Why not add the `draft' arg to the end of the `&optional' args? Won't tha= t=20 > preserve backward compatibility? >=20 > I maintain derived backends that use the `post-process' arg and are=20 > distributed on github. So now I will need to make them version aware=20 > and/or provide version specific branches so as not to break when used wit= h=20 > older org-mode versions, won't I? This is a very good point. OTOH, if backwards compatibility is going to be broken, wouldn=E2=80=99t it be better to move to a keyword argument syst= em? IOW, the signature of =E2=80=98org-export-as=E2=80=99 and friends would cha= nge from: (backend &optional subtreep visible-only body-only ext-plist) to (using cl-defun): (backend &key subtreep visible-only body-only ext-plist draft) This would allow future changes to the API of this function without breaking backwards compatibility. It would also clean up messy constructs like: (lambda (a s v b d) (if a (org-org-export-to-org t s v b d) (org-open-file (org-org-export-to-org nil s v b d)))) which could become: (lambda (&rest kwargs) (if (plist-get kwargs :async) (apply #'org-org-export-to-org kwargs) (org-open-file (apply #'org-org-export-to-org kwargs)))) and with further simplification the following, which is vastly clearer than the original: (lambda (&rest kwargs) (let ((result (apply #'org-org-export-to-org kwargs))) (unless (plist-get kwargs :async) (org-open-file result)))) Since this stanza recurs in the code for most (all?) backends, there=E2=80= =99s some value that org core can provide to backend authors by making it as simple as possible. With a non-trivial effort, the old calling convention could still be supported (if the argument after =E2=80=98backend=E2=80=99 is not a :keywor= d, then org-export-as knows that the old convention is in use, and it should map the arguments 2 through 5 to the relevant keywords). It could trigger a deprecation warning and be phased out with the next major version (or whenever). On a different note, does this scheme make it possible for a backend to see whether draft mode is enabled? Latex provides a document-level draft option, which enables certain optimizations that speed up compile times (for example, graphics are not read in, but are replaced with a placeholder). It would be nice if ox-latex could emit this in the latex code when draft mode is enabled from the org side. Thanks, --=20 Aaron Ecay