emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Something like #+BIND but for the destination buffer
@ 2016-12-31 14:17 Jonas Bernoulli
  2016-12-31 14:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Jonas Bernoulli @ 2016-12-31 14:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1980 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-01-14 22:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-31 14:17 Something like #+BIND but for the destination buffer Jonas Bernoulli
2016-12-31 14:40 ` Nicolas Goaziou
2017-01-03 13:52   ` Jonas Bernoulli
2017-01-03 13:59     ` Kaushal Modi
2017-01-03 14:43       ` Thomas S. Dye
2017-01-03 14:59       ` Nick Dokos
2017-01-03 15:53   ` Jonas Bernoulli
2017-01-03 17:00     ` Charles C. Berry
2017-01-14 13:42       ` Jonas Bernoulli
2017-01-14 14:46         ` Nicolas Goaziou
2017-01-14 17:47           ` Jonas Bernoulli
2017-01-14 17:52             ` Nicolas Goaziou
2017-01-14 19:50               ` Jonas Bernoulli
2017-01-14 22:11               ` Jonas Bernoulli
2017-01-14 22:20                 ` Jonas Bernoulli
2017-01-14 21:48   ` Jonas Bernoulli

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).