all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: GNU Emacs Help <help-gnu-emacs@gnu.org>
Subject: Is there some more elegant read from STDIN?
Date: Fri, 12 Jul 2019 20:33:45 +0200	[thread overview]
Message-ID: <20190712183345.GI2967@protected.rcdrun.com> (raw)

I would like t oknow if there is any more elegant
read from STDIN on comman line, like when using
--script ?

References:

https://joelmccracken.github.io/entries/reading-writing-data-in-emacs-batch-via-stdin-stdout/

https://github.com/clarkgrubb/hyperpolyglot/issues/107#issuecomment-510984788

Working example:

#!/usr/local/bin/emacs --script

(defun org-stding-to-html-body-only ()
  "Reads org text body from STDIN and export full only body HTML"
  (let ((org-document-content "")
        this-read)
    (while (setq this-read (ignore-errors
                             (read-from-minibuffer "")))
      (setq org-document-content (concat org-document-content "\n" this-read)))

    (with-temp-buffer
      (org-mode)
      (insert org-document-content)
      (org-html-export-as-html nil nil nil t)
      (princ (buffer-string)))))

(org-stding-to-html-body-only)

Is there some better way to accept stdin then this
one?

Jean



                 reply	other threads:[~2019-07-12 18:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=20190712183345.GI2967@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.