From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonas Bernoulli Subject: Something like #+BIND but for the destination buffer Date: Sat, 31 Dec 2016 15:17:57 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c14280634c460544f4fd56 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNKUF-0000Ld-KP for emacs-orgmode@gnu.org; Sat, 31 Dec 2016 09:18:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNKUE-0004NQ-Ku for emacs-orgmode@gnu.org; Sat, 31 Dec 2016 09:18:19 -0500 Received: from mail-it0-x236.google.com ([2607:f8b0:4001:c0b::236]:36820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNKUE-0004NL-GJ for emacs-orgmode@gnu.org; Sat, 31 Dec 2016 09:18:18 -0500 Received: by mail-it0-x236.google.com with SMTP id 75so227986739ite.1 for ; Sat, 31 Dec 2016 06:18:18 -0800 (PST) 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: emacs-orgmode@gnu.org --001a11c14280634c460544f4fd56 Content-Type: text/plain; charset=UTF-8 I need to ensure that the texinfo exporter generates texi files that use space for indentation even when the global value of indent-tabs-mode is t. If tabs are used, then code blocks end up being intended wrong in the final info file. There are probably other more direct approaches to achieve this, but when I stumbled into #+BIND I thought I had found the mechanism to achieve this. But it turned out that #+BIND allows setting variables in the buffer from which the export happens, not the buffer into which it happens. So I would like to suggest the addition of something like #+BIND-DEST, to allow setting variables in the destination buffer. I could then use something like #+BIND-DEST: indent-tabs-mode nil # Local Variables: # org-export-allow-bind-keywords: t # End: to ensure that indent-tabs-mode is disabled. Currently I am using this (defun ox-texinfo+--disable-indent-tabs-mode (fn backend file-or-buffer &optional async subtreep visible-only body-only ext-plist post-process) (let ((saved-indent-tabs-mode (default-value 'indent-tabs-mode))) (when (equal backend 'texinfo) (setq-default indent-tabs-mode nil)) (unwind-protect (funcall fn backend file-or-buffer async subtreep visible-only body-only ext-plist post-process) (setq-default indent-tabs-mode saved-indent-tabs-mode)))) (advice-add 'org-export-to-file :around 'ox-texinfo+--disable-indent-tabs-mode) (advice-add 'org-export-to-buffer :around 'ox-texinfo+--disable-indent-tabs-mode) Thanks for considering --001a11c14280634c460544f4fd56 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I need to ensure that the texinfo exporter generates texi = files that use space for indentation even when the global value of indent-t= abs-mode is t. If tabs are used, then code blocks end up being intended wro= ng in the final info file.

There are probably other more= direct approaches to achieve this, but when I stumbled into #+BIND I thoug= ht I had found the mechanism to achieve this. But it turned out that #+BIND= allows setting variables in the buffer from which the export happens, not = the buffer into which it happens. So I would like to suggest the addition o= f something like #+BIND-DEST, to allow setting variables in the destination= buffer.

I could then use something like

#+BIND-DEST: indent-tabs-mode nil

=
# Local Variables:
# org-export-allow-bind-keywords: t
=
# End:

to ensure that indent-tabs-mode = is disabled. Currently I am using this

(defun= ox-texinfo+--disable-indent-tabs-mode
=C2=A0 =C2=A0 (fn backend = file-or-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &optional async su= btreep visible-only body-only ext-plist post-process)
=C2=A0 (let= ((saved-indent-tabs-mode (default-value 'indent-tabs-mode)))
=C2=A0 =C2=A0 (when (equal backend 'texinfo)
=C2=A0 =C2=A0 = =C2=A0 (setq-default indent-tabs-mode nil))
=C2=A0 =C2=A0 (unwind= -protect
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (funcall fn backend file-or-= buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0async subtreep visible-only body-only ext-plist post-process)
=C2=A0 =C2=A0 =C2=A0 (setq-default indent-tabs-mode saved-indent-tabs-mo= de))))

(advice-add 'org-export-to-file =C2=A0 = :around 'ox-texinfo+--disable-indent-tabs-mode)
(advice-add &= #39;org-export-to-buffer :around 'ox-texinfo+--disable-indent-tabs-mode= )


Thanks for considering
--001a11c14280634c460544f4fd56--