From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Major mode of orgweb/publish.sh?
Date: Wed, 19 Apr 2023 23:54:42 +0700 [thread overview]
Message-ID: <u1p6cl$83e$1@ciao.gmane.io> (raw)
In-Reply-To: <sdvbkjq6ch8.fsf@fw.net.yu>
On 14/04/2023 16:20, Ruijie Yu wrote:
> Ihor Radchenko writes:
>> Ruijie Yu writes:
>>> Major mode was erronously set to shell-script-mode because of the empty line.
Empty line was added by mistake, see "23.3 Choosing File Modes" in the
Emacs manual:
(info "(emacs) Choosing Modes")
https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
----
When the first line starts with ‘#!’, you usually cannot use the ‘-*-’
feature on the first line, because the system would get confused when
running the interpreter. So Emacs looks for ‘-*-’ on the second line in
such files as well as on the first line. The same is true for man pages
which start with the magic string ‘'\"’ to specify a list of troff
preprocessors.
----
>> The line in question is inline stdin redirect
>> in shell. "#..." is what is fed to exec emacs.
There is no stdin redirection,
":"; exec emacs --script "$0" #...
line instructs shell to stop interpreting this file and to execute emacs
instead, passing file name for this script. This line is valid for both
shell (sequence of "true" and "exec" commands) and elisp (string and
comment). So this is a valid elisp file for emacs.
> I was about to propose changing the shbang line into just
> #!/usr/bin/emacs -x
It would fix path to emacs binary. Currently double trampoline is used.
I see no point in /usr/bin/env since location of shell is considered
fixed. That is why
#!/bin/sh
should work as well. Shell looks up for emacs in the $PATH environment
variable. /usr/bin/env can do it as well, but shebang allows just single
argument. Latest GNU env versions are able to split passed string to
separate argument (-S option), but currently interpreting of script
arguments as emacs options are suppressed by -- before "$@", so they are
passed as `argv' list elements.
#!/usr/bin/env -S emacs --quick --script
should work, but it is less portable since relies on recent GNU env
version and less safe since script options may modify emacs behavior.
next prev parent reply other threads:[~2023-04-19 16:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 7:49 Major mode of orgweb/publish.sh? Ruijie Yu via General discussions about Org-mode.
2023-04-14 8:11 ` Ruijie Yu via General discussions about Org-mode.
2023-04-14 8:15 ` Ruijie Yu via General discussions about Org-mode.
2023-04-14 8:28 ` Ihor Radchenko
2023-04-14 9:20 ` Ruijie Yu via General discussions about Org-mode.
2023-04-19 16:54 ` Max Nikulin [this message]
2023-04-19 9:49 ` Bastien Guerry
2023-04-21 3:09 ` Ruijie Yu via General discussions about Org-mode.
2023-04-14 8:20 ` Ihor Radchenko
2023-04-14 8:19 ` Ruijie Yu via General discussions about Org-mode.
2023-04-14 8:54 ` Ihor Radchenko
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='u1p6cl$83e$1@ciao.gmane.io' \
--to=manikulin@gmail.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).