all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there some more elegant read from STDIN?
@ 2019-07-12 18:33 Jean Louis
  0 siblings, 0 replies; only message in thread
From: Jean Louis @ 2019-07-12 18:33 UTC (permalink / raw)
  To: GNU Emacs Help

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-12 18:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-12 18:33 Is there some more elegant read from STDIN? Jean Louis

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.