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

Reply via email to