Org-mode mailing list
 help / color / mirror / Atom feed
From: Morgan Willcock <mwillcock@precedence.co.uk>
To: emacs-orgmode@gnu.org
Cc: Morgan Willcock <mwillcock@precedence.co.uk>
Subject: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
Date: Tue, 17 Aug 2021 23:28:01 +0100
Message-ID: <20210817222801.12867-1-mwillcock@precedence.co.uk> (raw)

* 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	other threads:[~2021-08-19 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 22:28 Morgan Willcock [this message]
2021-08-17 23:07 Morgan Willcock
2021-08-31 11:59 ` Timothy
2021-08-31 12:42   ` Morgan Willcock
2021-08-31 12:54     ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210817222801.12867-1-mwillcock@precedence.co.uk \
    --to=mwillcock@precedence.co.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git