emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil


From: Morgan Willcock
Subject: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
Date: Wed, 18 Aug 2021 00:07:35 +0100

* lisp/ox-ascii.el (org-ascii--justify-lines): Ensure that
`indent-tabs-mode' is nil when applying indentation to justify lines.
This prevents tab characters from appearing in the export when
`indent-tabs-mode' still has its default value of t.  TINYCHANGE
---
Hi,

I've attached a patch to fix an issue where tab characters are generated by
the ASCII exporter when `indent-tabs-mode' has its default value of t.

Here is a simple test case which generates tabs with 'emacs -Q':

(with-temp-buffer
  (insert "#+TITLE: My Title\n"
          "#+OPTIONS: author:nil\n"
          "#+OPTIONS: toc:nil\n")
  (org-mode)
  (org-ascii-export-as-ascii)
  (with-current-buffer "*Org ASCII Export*"
    (buffer-string)))

I haven't gone through the FSF copyright assignment process but I'm assuming
this is OK based on the line count.

Thanks,
Morgan

 lisp/ox-ascii.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index d1762d41c..176542661 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -480,6 +480,9 @@ HOW determines the type of justification: it can be `left',
     (insert s)
     (goto-char (point-min))
     (let ((fill-column text-width)
+          ;; Ensure that `indent-tabs-mode' is nil so that indentation
+          ;; will always be achieved using spaces rather than tabs.
+          (indent-tabs-mode nil)
          ;; Disable `adaptive-fill-mode' so it doesn't prevent
          ;; filling lines matching `adaptive-fill-regexp'.
          (adaptive-fill-mode nil))
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]