Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It's what you learn after you know it all that counts." -- John Wooden


devel / comp.unix.shell / Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

SubjectAuthor
* Start Emacs with a minimal bash and emacs lisp mix script for testing.hongy...@gmail.com
`* Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.Helmut Waitzmann
 `* Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.hongy...@gmail.com
  `* Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.Javier
   `* Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.hongy...@gmail.com
    `* Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.Javier
     `- Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.hongy...@gmail.com

1
Start Emacs with a minimal bash and emacs lisp mix script for testing.

<ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4216&group=comp.unix.shell#4216

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:62d:: with SMTP id 13mr18806370qkv.18.1627974988092;
Tue, 03 Aug 2021 00:16:28 -0700 (PDT)
X-Received: by 2002:a37:62d2:: with SMTP id w201mr18953013qkb.318.1627974987870;
Tue, 03 Aug 2021 00:16:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 3 Aug 2021 00:16:27 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.96; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.96
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com>
Subject: Start Emacs with a minimal bash and emacs lisp mix script for testing.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 03 Aug 2021 07:16:28 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Tue, 3 Aug 2021 07:16 UTC

On Ubuntu 20.04, I'm using the following minimal bash and emacs lisp mix script to test/debug specific Emacs configurations:
----------- begin --------------
#!/usr/bin/env bash
:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
:; # https://github.com/abo-abo/swiper/issues/2899#issuecomment-889926472
:; # https://github.com/hlissner/doom-emacs/blob/develop/bin/doom
:; emacs -Q --load "$(realpath -e $0)" -- "$@"

;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
[...]
----------- end --------------

I find the above script can start Emacs successfully with the following calling method:

$ bash the-bash-elisp-mix-script

But when quit Emacs with `C-x C-c', the script always complains the following info:

init.the-bash-elisp-mix-script: line 7: syntax error near unexpected token `;;'

OTOH, if I change the Emacs command line in the above script into the following:

:; emacs -Q --script "$(realpath -e $0)" -- "$@"

The script will refuse to start, and the following info will be triggered immediately:

$ bash init.the-bash-elisp-mix-script
init.the-bash-elisp-mix-script: line 7: syntax error near unexpected token `;;'
$

The above idea is based on code example given on <https://github.com/hlissner/doom-emacs/blob/develop/bin/doom>.

Any hints for fixing these problems?

Regards,
HY

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4217&group=comp.unix.shell#4217

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!vXnNXEq6xqB0Jl2AjqcDGQ.user.46.165.242.75.POSTED!not-for-mail
From: nn.throttle@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
Date: Tue, 03 Aug 2021 19:20:49 +0200
Organization: Aioe.org NNTP Server
Message-ID: <8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de>
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Info: gioia.aioe.org; logging-data="36820"; posting-host="vXnNXEq6xqB0Jl2AjqcDGQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Copies-To: nobody
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Cancel-Lock: sha1:hRCiOXDVlSRBmdBhXRzozIv28eY=
 by: Helmut Waitzmann - Tue, 3 Aug 2021 17:20 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com>:

[An 123 characters long line deleted]

Please make use of your return key to avoid overly long lines
(maximum of 78 characters) when posting via the google web.

>----------- begin --------------
>#!/usr/bin/env bash
>:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
>:; # https://github.com/abo-abo/swiper/issues/2899#issuecomment-889926472
>:; # https://github.com/hlissner/doom-emacs/blob/develop/bin/doom
>:; emacs -Q --load "$(realpath -e $0)" -- "$@"
>
>
>;;Bootstrap straight
>(defvar bootstrap-version)

[…]

>----------- end --------------

[Another overly long line deleted]

>
>$ bash the-bash-elisp-mix-script
>
[Another overly long line deleted]

>init.the-bash-elisp-mix-script: line 7: syntax error near
>unexpected token `;;'

[…]

>The above idea is based on code example given on
><https://github.com/hlissner/doom-emacs/blob/develop/bin/doom>.
>
>Any hints for fixing these problems?
>

Yes.  Answer the following question:  What complains about the token
';;' in line 7 and why does it complain?

Your question reveals, that you don't have any clue about the
mechanism of the script, so the real answer should be:  If you don't
understand it, don't run it.

You might try

:; exec emacs -Q --load "$(realpath -e $0)" -- "$@"

rather than

:; emacs -Q --load "$(realpath -e $0)" -- "$@"

in that script and see whether that works for you.

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4218&group=comp.unix.shell#4218

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ad4:566c:: with SMTP id bm12mr24446031qvb.58.1628038411766;
Tue, 03 Aug 2021 17:53:31 -0700 (PDT)
X-Received: by 2002:a37:9bc5:: with SMTP id d188mr5093511qke.225.1628038411571;
Tue, 03 Aug 2021 17:53:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 3 Aug 2021 17:53:31 -0700 (PDT)
In-Reply-To: <8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=103.142.140.223; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.142.140.223
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com> <8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com>
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 04 Aug 2021 00:53:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Wed, 4 Aug 2021 00:53 UTC

On Wednesday, August 4, 2021 at 1:21:32 AM UTC+8, Helmut Waitzmann wrote:
> "hongy...@gmail.com" <hongy...@gmail.com>:
>
> [An 123 characters long line deleted]
>
>
> Please make use of your return key to avoid overly long lines
> (maximum of 78 characters) when posting via the google web.

What about the long URL? Does this break the URL auto recognition by web browser?

> >----------- begin --------------
> >#!/usr/bin/env bash
> >:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
> >:; # https://github.com/abo-abo/swiper/issues/2899#issuecomment-889926472
> >:; # https://github.com/hlissner/doom-emacs/blob/develop/bin/doom
> >:; emacs -Q --load "$(realpath -e $0)" -- "$@"
> >
> >
> >;;Bootstrap straight
> >(defvar bootstrap-version)
> […]
>
> >----------- end --------------
>
> [Another overly long line deleted]
>
> >
> >$ bash the-bash-elisp-mix-script
> >
> [Another overly long line deleted]
> >init.the-bash-elisp-mix-script: line 7: syntax error near
> >unexpected token `;;'
> […]
> >The above idea is based on code example given on
> ><https://github.com/hlissner/doom-emacs/blob/develop/bin/doom>.
> >
> >Any hints for fixing these problems?
> >
> Yes. Answer the following question: What complains about the token
> ';;' in line 7 and why does it complain?

Got it. They are not valid bash command sequences. See the following testings:
$ ;;
bash: syntax error near unexpected token `;;'
$ ;
bash: syntax error near unexpected token `;'
$ :;
$

> Your question reveals, that you don't have any clue about the
> mechanism of the script, so the real answer should be: If you don't
> understand it, don't run it.
>
>
> You might try
>
>
> :; exec emacs -Q --load "$(realpath -e $0)" -- "$@"

Yes, it does the trick, as well as the following one:

:; emacs -Q --load "$(realpath -e $0)" -- "$@"; exit

Another question: how to do the same job with the `--script' option of
Emacs? I've tried with the following command, but failed to start
Emacs:

:; exec emacs -Q --script $(realpath -e $0) -- "$@"
> rather than
> :; emacs -Q --load "$(realpath -e $0)" -- "$@"
> in that script and see whether that works for you.

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4219&group=comp.unix.shell#4219

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.neodome.net!2.eu.feeder.erje.net!feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 04 Aug 2021 06:24:33 -0500
From: invalid@invalid.invalid (Javier)
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
Newsgroups: comp.unix.shell
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com> <8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de> <f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com>
Message-ID: <yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk>
Date: Wed, 04 Aug 2021 06:24:33 -0500
Lines: 29
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-9noe885TkiFsPobfvjwZYiTFe3PEmWA64Qi6HPMIB5R9vR2hJPV1c5KansNlm0im4RvUMYS732Pa0Vy!5ndynHyFZ5xBTDmz8Lve5fjFSn+n2EiHeEzSLapkRSZJ0OaFdhq/+S0g623ximvMH4hlO1PxDzEv!sZdZF31khBbu0q6SGAED3UeF9j22
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2034
 by: Javier - Wed, 4 Aug 2021 11:24 UTC

hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>> Please make use of your return key to avoid overly long lines
>> (maximum of 78 characters) when posting via the google web.
>
> What about the long URL? Does this break the URL auto recognition by
> web browser?

The long URLS you don't need to break, but please break the text
pararagraphs at 72 chars (or at maximum 78).

> Another question: how to do the same job with the `--script' option of
> Emacs? I've tried with the following command, but failed to start
> Emacs:
>
> :; exec emacs -Q --script $(realpath -e $0) -- "$@"
>
>> rather than
>> :; emacs -Q --load "$(realpath -e $0)" -- "$@"
>> in that script and see whether that works for you.

You just use --script it in the shebang line with no bash code

#!/usr/bin/emacs --script
; elisp code here
; ...

But with --script emacs is executed in batch mode and does not enter
interactive mode as your previous example, so it might not be what you
are looking for.

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<7138ff1d-98f7-4ed3-b363-db070beb8075n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4220&group=comp.unix.shell#4220

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:4089:: with SMTP id f9mr25450419qko.441.1628086314859;
Wed, 04 Aug 2021 07:11:54 -0700 (PDT)
X-Received: by 2002:ac8:7a86:: with SMTP id x6mr1340988qtr.284.1628086314655;
Wed, 04 Aug 2021 07:11:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 4 Aug 2021 07:11:54 -0700 (PDT)
In-Reply-To: <yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.239; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.239
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com>
<8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de> <f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com>
<yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7138ff1d-98f7-4ed3-b363-db070beb8075n@googlegroups.com>
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 04 Aug 2021 14:11:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Wed, 4 Aug 2021 14:11 UTC

On Wednesday, August 4, 2021 at 7:24:38 PM UTC+8, Javier wrote:
> hongy...@gmail.com <hongy...@gmail.com> wrote:
> >> Please make use of your return key to avoid overly long lines
> >> (maximum of 78 characters) when posting via the google web.
> >
> > What about the long URL? Does this break the URL auto recognition by
> > web browser?
> The long URLS you don't need to break, but please break the text
> pararagraphs at 72 chars (or at maximum 78).
> > Another question: how to do the same job with the `--script' option of
> > Emacs? I've tried with the following command, but failed to start
> > Emacs:
> >
> > :; exec emacs -Q --script $(realpath -e $0) -- "$@"
> >
> >> rather than
> >> :; emacs -Q --load "$(realpath -e $0)" -- "$@"
> >> in that script and see whether that works for you.
> You just use --script it in the shebang line with no bash code
>
> #!/usr/bin/emacs --script

Based on my tries, the only shebang line can't start Emacs, while the following can

#!/usr/local/bin/emacs -Q --script
or
#!/usr/local/bin/emacs -q --script

But they all will load the already existing configurations.

> ; elisp code here
> ; ...

OTOH, I also tried the following method:

------------------- begin ---------------------------
#!/usr/bin/env bash
emacs -Q --load <(tail -n +4 "$0")
exit

;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
------------------- end ---------------------------

Though the above method can start Emacs, but I'll see the following info in the *Messages* buffer:

For information about GNU Emacs and the GNU system, type C-h C-a.
eval-buffer: Symbol’s function definition is void: straight-use-package


> But with --script emacs is executed in batch mode and does not enter
> interactive mode as your previous example, so it might not be what you
> are looking for.

Thank you for your explanation.

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<Y9Cdna6DhrKjJ5f8nZ2dnUU78cHNnZ2d@brightview.co.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4221&group=comp.unix.shell#4221

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 04 Aug 2021 11:03:10 -0500
From: invalid@invalid.invalid (Javier)
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
Newsgroups: comp.unix.shell
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com> <8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de> <f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com> <yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk> <7138ff1d-98f7-4ed3-b363-db070beb8075n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <Y9Cdna6DhrKjJ5f8nZ2dnUU78cHNnZ2d@brightview.co.uk>
Date: Wed, 04 Aug 2021 11:03:10 -0500
Lines: 30
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-FCXI1b5CCleWwEF8v5Y6rJoE6VigtHa2wLnWMuyEi6fTqg8Pu1wE2E4fko7WqZnvLcxzkr+lOrn0xXU!FGK+w3vrJZIYnLpZeBTchANtj0idXAzxO/oeB+3WGvE+dw9WCqS9kyzZPwJWhvM9Wb/cGi+K8kyg!0hnhlAO/3dt+UZ5w2OX2z/zDrk5v
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2320
 by: Javier - Wed, 4 Aug 2021 16:03 UTC

hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
> On Wednesday, August 4, 2021 at 7:24:38 PM UTC+8, Javier wrote:
>> You just use --script it in the shebang line with no bash code
>>
>> #!/usr/bin/emacs --script
>
> Based on my tries, the only shebang line can't start Emacs

As I told you before '#!/usr/bin/emacs --script' will start emacs in
batch mode. This means that emacs will exectute the elisp code and
exit without asking for anything interactive. You will not see an
emacs window popping up with --script.

> while the following can
>
> #!/usr/local/bin/emacs -Q --script
>
> But they all will load the already existing configurations.

You see an emacs window that loads the existing (~/.emacs I guess)
configuration because neither of the -Q nor --script configurations

You will most likely see a error message in emacs at startup

Unknown option ‘-Q --script’

That's because the shebang line can only send 1 command-line option to
emacs. The shebang line is unable to send two options to emacs (or
any other program for the matter).

Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

<6b0f9056-d102-42f1-a6c7-a394bacd5142n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=4222&group=comp.unix.shell#4222

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:204c:: with SMTP id d12mr2023893qka.417.1628120557837;
Wed, 04 Aug 2021 16:42:37 -0700 (PDT)
X-Received: by 2002:ae9:eb97:: with SMTP id b145mr1983701qkg.111.1628120557665;
Wed, 04 Aug 2021 16:42:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 4 Aug 2021 16:42:37 -0700 (PDT)
In-Reply-To: <Y9Cdna6DhrKjJ5f8nZ2dnUU78cHNnZ2d@brightview.co.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=172.105.229.161; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.105.229.161
References: <ed03caf8-1f5f-4ca7-ad83-042a9035901bn@googlegroups.com>
<8335rqzbpq.fsf@helmutwaitzmann.news.arcor.de> <f2cbc203-b13f-4dab-801c-e2b7f62564aan@googlegroups.com>
<yJOdnZmU-OFs5Zf8nZ2dnUU78TnNnZ2d@brightview.co.uk> <7138ff1d-98f7-4ed3-b363-db070beb8075n@googlegroups.com>
<Y9Cdna6DhrKjJ5f8nZ2dnUU78cHNnZ2d@brightview.co.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6b0f9056-d102-42f1-a6c7-a394bacd5142n@googlegroups.com>
Subject: Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 04 Aug 2021 23:42:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Wed, 4 Aug 2021 23:42 UTC

On Thursday, August 5, 2021 at 12:03:15 AM UTC+8, Javier wrote:
> hongy...@gmail.com <hongy...@gmail.com> wrote:
> > On Wednesday, August 4, 2021 at 7:24:38 PM UTC+8, Javier wrote:
> >> You just use --script it in the shebang line with no bash code
> >>
> >> #!/usr/bin/emacs --script
> >
> > Based on my tries, the only shebang line can't start Emacs
> As I told you before '#!/usr/bin/emacs --script' will start emacs in
> batch mode. This means that emacs will exectute the elisp code and
> exit without asking for anything interactive. You will not see an
> emacs window popping up with --script.
> > while the following can
> >
> > #!/usr/local/bin/emacs -Q --script
> >
> > But they all will load the already existing configurations.
> You see an emacs window that loads the existing (~/.emacs I guess)
> configuration because neither of the -Q nor --script configurations
>
> You will most likely see a error message in emacs at startup
>
> Unknown option ‘-Q --script’

I confirm that the following info is shown in *Messages* buffer:

command-line-1: Unknown option ‘-Q --script’
> That's because the shebang line can only send 1 command-line option to
> emacs. The shebang line is unable to send two options to emacs (or
> any other program for the matter).

Then, what about the following trick, as I've posted:

#!/usr/bin/env bash
emacs -Q --load <(tail -n +4 "$0")
exit

[elisp code comes here]

HY


devel / comp.unix.shell / Re: Start Emacs with a minimal bash and emacs lisp mix script for testing.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor