unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Start Emacs with a minimal bash and Emacs lisp mixed script for testing.
Date: Tue, 3 Aug 2021 16:52:14 +0800	[thread overview]
Message-ID: <CAGP6PO+zFpJj4F7YLGHGJuPFFL9=PXDzqqt5eebyYAsH6vhXHg@mail.gmail.com> (raw)

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 the code example given on
<https://github.com/hlissner/doom-emacs/blob/develop/bin/doom>.

Any hints for fixing these problems?

Regards,
HY
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



             reply	other threads:[~2021-08-03  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  8:52 Hongyi Zhao [this message]
2021-08-03 15:55 ` Start Emacs with a minimal bash and Emacs lisp mixed script for testing Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-03 16:08   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-04  0:26     ` Hongyi Zhao
2021-08-04  0:34       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-04  0:56         ` Hongyi Zhao

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='CAGP6PO+zFpJj4F7YLGHGJuPFFL9=PXDzqqt5eebyYAsH6vhXHg@mail.gmail.com' \
    --to=hongyi.zhao@gmail.com \
    --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).