* [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
@ 2021-08-17 23:07 Morgan Willcock
2021-08-31 11:59 ` Timothy
2021-09-19 13:13 ` Timothy
0 siblings, 2 replies; 8+ messages in thread
From: Morgan Willcock @ 2021-08-17 23:07 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Morgan Willcock
* 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
2021-08-17 23:07 [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil Morgan Willcock
@ 2021-08-31 11:59 ` Timothy
2021-08-31 12:42 ` Morgan Willcock
2021-09-19 13:13 ` Timothy
1 sibling, 1 reply; 8+ messages in thread
From: Timothy @ 2021-08-31 11:59 UTC (permalink / raw)
To: Morgan Willcock; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 754 bytes --]
Hi Morgan,
> 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.
Thanks for finding this bug, fixing it, and sending us it 🙂. I was able to
reproduce your test case with “emacs -Q” (thanks for that, by the way).
As you suspected, with the small number of changed lines, this would be fine to
accept without FSF assignment.
However, your “patch” seems to consist of a diff at the bottom of your email and
a commit message at the top?? It would be preferable if you could provide a
“proper” patch, that way you can get attribution for your help instead of just
someone committing it on your behalf.
All the best,
Timothy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
2021-08-31 11:59 ` Timothy
@ 2021-08-31 12:42 ` Morgan Willcock
2021-08-31 12:54 ` Timothy
0 siblings, 1 reply; 8+ messages in thread
From: Morgan Willcock @ 2021-08-31 12:42 UTC (permalink / raw)
To: Timothy; +Cc: emacs-orgmode
Timothy <tecosaur@gmail.com> writes:
> Hi Morgan,
>
>> 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.
>
> Thanks for finding this bug, fixing it, and sending us it 🙂. I was able to
> reproduce your test case with “emacs -Q” (thanks for that, by the way).
> As you suspected, with the small number of changed lines, this would be fine to
> accept without FSF assignment.
Great! Thank you for taking a look.
> However, your “patch” seems to consist of a diff at the bottom of your email and
> a commit message at the top?? It would be preferable if you could provide a
> “proper” patch, that way you can get attribution for your help instead of just
> someone committing it on your behalf.
I used `git send-email` which is listed as being OK on the website:
"If you have configured git to use send-email, then you can use that."
-- https://orgmode.org/contribute.html
The mail can be applied with `git am` and the commit message will be
correct. I'm also happy to resend as a separate patch if that is the
requirement.
Thanks,
Morgan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
2021-08-17 23:07 [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil Morgan Willcock
2021-08-31 11:59 ` Timothy
@ 2021-09-19 13:13 ` Timothy
2021-09-19 15:30 ` Morgan Willcock
1 sibling, 1 reply; 8+ messages in thread
From: Timothy @ 2021-09-19 13:13 UTC (permalink / raw)
To: Morgan Willcock; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
Hi Morgan,
I’ve just taken a look at your patch (it `git am's just fine), since nobody else
seems to have had the time to look at your patch as of late. There’s one thing
which I now realise completely slipped by me last time — why are tabs bad?
Maybe I’m missing something obvious, but exporting with tabs and viewing/`cat'ing
the file everything looks fine to me in terms of alignment.
Morgan Willcock <mwillcock@precedence.co.uk> writes:
> 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.
All the best,
Timothy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
2021-09-19 13:13 ` Timothy
@ 2021-09-19 15:30 ` Morgan Willcock
2021-09-19 17:02 ` Timothy
0 siblings, 1 reply; 8+ messages in thread
From: Morgan Willcock @ 2021-09-19 15:30 UTC (permalink / raw)
To: Timothy; +Cc: emacs-orgmode
Timothy <tecosaur@gmail.com> writes:
> Hi Morgan,
>
> I’ve just taken a look at your patch (it `git am's just fine), since nobody else
> seems to have had the time to look at your patch as of late. There’s one thing
> which I now realise completely slipped by me last time — why are tabs bad?
> Maybe I’m missing something obvious, but exporting with tabs and viewing/`cat'ing
> the file everything looks fine to me in terms of alignment.
Hi Timothy,
It seems to default to spaces everywhere else. If you export an actual
document through the ascii exporter instead of just a document header
you will get a mix of tabs and spaces. This is how it was brought to my
attention, I was distributing a file that was batch exported and someone
pointed out that the indentation was inconsistent.
If it is handled as an export preference or defaults to the global
indentation preference then that would be fine but I don't believe
either of those are the case.
Thanks for continuing to look,
Morgan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
2021-09-19 15:30 ` Morgan Willcock
@ 2021-09-19 17:02 ` Timothy
0 siblings, 0 replies; 8+ messages in thread
From: Timothy @ 2021-09-19 17:02 UTC (permalink / raw)
To: Morgan Willcock; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
Hi Morgan,
Thanks for clarifying this. That makes sense to me, and so I’ve just pushed your
patch as 3a77e59 🙂, with a slightly tweaked commit message. Thanks for going to
the effort of pinpointing and fixing this issue, and your patience in seeing
this accepted.
Morgan Willcock <mwillcock@precedence.co.uk> writes:
> It seems to default to spaces everywhere else. If you export an actual
> document through the ascii exporter instead of just a document header
> you will get a mix of tabs and spaces. This is how it was brought to my
> attention, I was distributing a file that was batch exported and someone
> pointed out that the indentation was inconsistent.
>
> If it is handled as an export preference or defaults to the global
> indentation preference then that would be fine but I don’t believe
> either of those are the case.
>
> Thanks for continuing to look,
> Morgan
All the best,
Timothy
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
@ 2021-08-17 22:28 Morgan Willcock
0 siblings, 0 replies; 8+ messages in thread
From: Morgan Willcock @ 2021-08-17 22:28 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Morgan Willcock
* 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-09-19 17:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-17 23:07 [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil Morgan Willcock
2021-08-31 11:59 ` Timothy
2021-08-31 12:42 ` Morgan Willcock
2021-08-31 12:54 ` Timothy
2021-09-19 13:13 ` Timothy
2021-09-19 15:30 ` Morgan Willcock
2021-09-19 17:02 ` Timothy
-- strict thread matches above, loose matches on Subject: below --
2021-08-17 22:28 Morgan Willcock
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).