From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Start Emacs with a minimal bash and Emacs lisp mixed script for testing. Date: Tue, 3 Aug 2021 16:52:14 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14267"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 03 10:52:51 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAqAN-0003VU-K6 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 03 Aug 2021 10:52:51 +0200 Original-Received: from localhost ([::1]:41922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAqAL-0003s8-Qi for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 03 Aug 2021 04:52:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAqA2-0003ql-8K for help-gnu-emacs@gnu.org; Tue, 03 Aug 2021 04:52:30 -0400 Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:40753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAqA0-0002G6-IG for help-gnu-emacs@gnu.org; Tue, 03 Aug 2021 04:52:29 -0400 Original-Received: by mail-lf1-x131.google.com with SMTP id h14so38495777lfv.7 for ; Tue, 03 Aug 2021 01:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=w3r1uo6uIHzSAB97kyda/gPvPuKns337Gco6mnSl05c=; b=Anhpj7rYae/TqOBfhi5HIcrT6u2M1/nxor2NSlvr9tFSMUnhcY3b3ffG7SY+kaJnLR wbiS5iTk00gKt6wxe11562CZuC/JNuLXjwYCwazD1/mKtvD9IWaSs9xC52dzpoUSo6x6 IKk5FnNlflyHFVXn8z6NUivDa9Twgzqjodjpu8YNnxib2992LJCGlU4zW5owL/xNGswR j+B2dN9H3cyz5vQ88jCZ3dDiID18tV96SNS0X5dObXoliTe22ds6HsLvpgu/Pih1S2aY 9I9C25DPjC3azt5WNHQuoTciJMFhlN3kYQpwepmsv9vD8ydr1FVaIGJTSThweT+b8VBr NsrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=w3r1uo6uIHzSAB97kyda/gPvPuKns337Gco6mnSl05c=; b=WpsEtV6Ln3a44+WYPqpkUoyBNnBCfinbg7F1i2PtMISQtmCDJi1KHDI9A0yYc5wT9j Vv7vJGiBTOZ9aEBZ6ZosdTWwpStUx4NlW6pXZ8Lh7d4Jp6l7MNPzh+VSlEoWVJpUNal9 ethYJlwDfD1/5+sjIe2HE+w7DAC1ooqM/aj9AR2JpJ9VVuG+v0D7QwVLOIJ+oSuT+Elm U+HWLqqUf7GA3/TICIAOAxMj2cawkWOTZftKJL6DPddlBbI89eIEG+VenBF8WT2tT5w/ Q9uuAVthuuiB1pDrF68HToEJ5R9Pl/B45/TfRfT996sh+AvqyOz4kRnuJSOEGoteH5Io FgEA== X-Gm-Message-State: AOAM5305nr11IidODx9s4z23Q3d7bplCZBw2bFhS2j1BInb1GINhs+1d KNnU0CnbforpztUbhRioW/n6asVGwHkDMPHI/Xyb9VE2VUog86VQ+dw= X-Google-Smtp-Source: ABdhPJwovaIYqbO6HpLOtlhrY9R2y4u7UugvCFfvFCyunkzDyMsuOsPh37YiEaXpRQUrbHPJr3G9n6zBEttsjn5SBEg= X-Received: by 2002:a19:fc13:: with SMTP id a19mr15933382lfi.466.1627980745740; Tue, 03 Aug 2021 01:52:25 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132338 Archived-At: 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 . Any hints for fixing these problems? Regards, HY -- Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province