From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Alexander Adolf <alexander.adolf@condition-alpha.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [feature proposal] Export in foreign buffers - ASCII (ox-ascii)
Date: Wed, 24 Oct 2018 09:04:57 +0200 [thread overview]
Message-ID: <87mur3ygdi.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <8422BCDC-5B51-417D-B8DF-9D47BE2896FB@condition-alpha.com> (Alexander Adolf's message of "Mon, 22 Oct 2018 21:22:36 +0200")
Hello,
Alexander Adolf <alexander.adolf@condition-alpha.com> writes:
> I was missing convert-region functions in the ox-ascii export back-end
> as are provided by the HTML, LaTeX, Texinfo, and MarkDown back-ends [1],
> and hence crafted my own (copied below) to go into my init file. My use
> case is composing emails using notmuch-message-mode.
>
> [1] https://orgmode.org/manual/Export-in-foreign-buffers.html
>
> I though this feature might be useful to others, too, and would likely
> also seem a low hanging fruit to implement? ;-))
It looks like an omission, indeed.
> (defun org-ascii-convert-region-to-ascii ()
> "Assume the current region has org-mode syntax, and convert it to plain ASCII.
> This can be used in any buffer. For example, you could write an
> itemized list in org-mode syntax in a Mail buffer and then use
> this command to convert it."
> (interactive)
> (let ((my/org-ascii-charset org-ascii-charset))
> (setq org-ascii-charset 'ascii)
> (org-export-replace-region-by 'ascii)
> (setq org-ascii-charset my/org-ascii-charset)))
I see you are not including Latin1 export. Is there any reason to
implement pure ASCII export? Wouldn't UTF-8 be sufficient?
More generally, I wonder if, in 2018, it still makes sense to provide
ASCII-only and Latin1 export.
> (defun org-ascii-convert-region-to-utf8 ()
> "Assume the current region has org-mode syntax, and convert it to UTF-8.
Org syntax
> This can be used in any buffer. For example, you could write an
> itemized list in org-mode syntax in a Mail buffer and then use
in Org syntax in a mail buffer
Anyway, I don't think the example is useful.
> this command to convert it."
> (interactive)
> (let ((my/org-ascii-charset org-ascii-charset))
> (setq org-ascii-charset 'utf-8)
> (org-export-replace-region-by 'ascii)
> (setq org-ascii-charset my/org-ascii-charset)))
I think
(let ((org-ascii-charset 'utf-8))
(org-export-replace-region-by 'ascii))
would be simpler.
The manual needs to be updated, too.
Thank you.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2018-10-24 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-22 19:22 [feature proposal] Export in foreign buffers - ASCII (ox-ascii) Alexander Adolf
2018-10-24 7:04 ` Nicolas Goaziou [this message]
2018-10-24 17:03 ` Alexander Adolf
2018-10-25 14:56 ` Nicolas Goaziou
2018-10-25 15:07 ` Alexander Adolf
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://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mur3ygdi.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=alexander.adolf@condition-alpha.com \
--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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).