From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [feature proposal] Export in foreign buffers - ASCII (ox-ascii) Date: Wed, 24 Oct 2018 09:04:57 +0200 Message-ID: <87mur3ygdi.fsf@nicolasgoaziou.fr> References: <8422BCDC-5B51-417D-B8DF-9D47BE2896FB@condition-alpha.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFDE1-0004WD-6M for emacs-orgmode@gnu.org; Wed, 24 Oct 2018 03:05:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFDDx-0005sn-Mf for emacs-orgmode@gnu.org; Wed, 24 Oct 2018 03:05:04 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:59039) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFDDx-0005ql-Fh for emacs-orgmode@gnu.org; Wed, 24 Oct 2018 03:05:01 -0400 In-Reply-To: <8422BCDC-5B51-417D-B8DF-9D47BE2896FB@condition-alpha.com> (Alexander Adolf's message of "Mon, 22 Oct 2018 21:22:36 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Alexander Adolf Cc: emacs-orgmode@gnu.org Hello, Alexander Adolf 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