help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Start Emacs with a minimal bash and Emacs lisp mixed script for testing.


From: Hongyi Zhao
Subject: Start Emacs with a minimal bash and Emacs lisp mixed script for testing.
Date: Tue, 3 Aug 2021 16:52:14 +0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]