From: Jean Louis <bugs@gnu.support>
To: Gottfried <gottfried@posteo.de>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: asciidoctor
Date: Thu, 9 Feb 2023 21:41:13 +0300 [thread overview]
Message-ID: <Y+U+SW2VW7OLBwhs@protected.localdomain> (raw)
In-Reply-To: <7d298e10-22a2-d962-4bf8-d5d71899d30d@posteo.de>
* Gottfried <gottfried@posteo.de> [2023-02-09 19:51]:
> Hi everybody,
>
> I installed asccidoc and asciidoctor
>
> and I was able to open adoc-mode in emacs.
>
> But what are with those messages?
You need not put attention on it. It is not critical. adoc-mode will
work.
Here are some handy functions, I have modified it for you that you get
preview of Asciidoc by using `asciidoctor` implementation (not
asciidoc one). Both are good, but try this one first.
You need to put functions somewhere.
If you are in markdown or asciidoc mode you will get preview with C-c a
(defun string-to-file-force (string file)
"Prints string into file, matters not if file exists. Return FILE as file name."
(with-temp-file file
(insert string))
file)
(defun rcd-command-output-from-input (program input &rest args)
"Return output string from PROGRAM with given INPUT string and optional ARGS."
(let* ((output (with-temp-buffer
(insert input)
(apply #'call-process-region nil nil program t '(t nil) nil args)
(buffer-string))))
output))
(defun rcd-asciidoctor (string &rest args)
"Return HTML by using Asciidoctor markup STRING."
(let ((asciidoctor (executable-find "asciidoctor")))
(apply 'rcd-command-output-from-input "asciidoctor" string "-" args)))
(defun rcd-asciidoctor-preview ()
"Preview asciidoctor"
(interactive)
(let ((asciidoctor (executable-find "asciidoctor")))
(when asciidoctor
(let* ((output (buffer-string))
(output (rcd-asciidoctor output))
(file (string-to-file-force output "asciidoctor-preview.html")))
(browse-url file)))))
(require 'adoc-mode)
(define-key adoc-mode-map (kbd "C-c a") #'rcd-asciidoctor-preview)
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2023-02-09 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 16:50 asciidoctor Gottfried
2023-02-09 17:04 ` asciidoctor Eli Zaretskii
2023-02-09 18:41 ` Jean Louis [this message]
2023-02-10 15:20 ` asciidoctor Gottfried
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+U+SW2VW7OLBwhs@protected.localdomain \
--to=bugs@gnu.support \
--cc=gottfried@posteo.de \
--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.
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).