From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bob Rogers Newsgroups: gmane.emacs.devel Subject: Re: Emacs script options Date: Sat, 18 Nov 2023 21:04:11 -0800 Message-ID: <25945.38731.648751.897766@orion.rgrjr.com> References: <1325582.1700277236@archlinux> <83cyw7o6m3.fsf@gnu.org> <1496758.1700318304@archlinux> <83cyw7m3rr.fsf@gnu.org> <7094.1700336212@archlinux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30060"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Eli Zaretskii To: Sebastian Miele , Greg Minshall Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 19 06:05:16 2023 Return-path: Envelope-to: ged-emacs-devel@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 1r4Zzg-0007aQ-K2 for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Nov 2023 06:05:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4Zyo-0004QG-NG; Sun, 19 Nov 2023 00:04:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4Zym-0004Pw-UP for emacs-devel@gnu.org; Sun, 19 Nov 2023 00:04:21 -0500 Original-Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4Zyj-0008VQ-V8 for emacs-devel@gnu.org; Sun, 19 Nov 2023 00:04:20 -0500 Original-Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6c396ef9a3dso2859414b3a.1 for ; Sat, 18 Nov 2023 21:04:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rgrjr-com.20230601.gappssmtp.com; s=20230601; t=1700370253; x=1700975053; darn=gnu.org; h=references:in-reply-to:subject:cc:to:from:date:message-id :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZqGaI66AUs7fkbCKmjOsMvgGV9paw10v/kn4MnBRDlE=; b=DEgMNg2wH+KccG++Uv1qkxRHf2cXv1bKzvkM8tn9nRw+lkdaBS2jWaRWgzFimEaqCr +do7X4Q9zyeBuNgnz9fl0na/VTfOo276tVJYV+ETQVB7ZYgOV3dRosRihTVnzIMiuBak eg6QqrUeUZNqk967QSa01iSr/GttR6RsLAvDW0jwgOIQ5si1sBvesUyGsi9tEInqrLB6 1/vK2LNmWwob0HHXzOPkAJL3kPbA7bRI02s5YjWip7z9DkVkLVPduzXq69ou0caB4H6J 0j672VH39g1SHOsqHeKi+uoh1qxEBeY7RaQhaZexkBN4GXabzDYvVATZKVrcGcTB/g8x uclg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700370253; x=1700975053; h=references:in-reply-to:subject:cc:to:from:date:message-id :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZqGaI66AUs7fkbCKmjOsMvgGV9paw10v/kn4MnBRDlE=; b=NAubcKEo8P2StLmF/PApKov/Cq9bEswToS80mHs6jpV+Im+2L3XD4A4YQWv5j2cYY6 tct+tZBvhY0nm1L2BkepvFP7YobE+3pztcc7ughvM7akkQmTtpgsU8cW+Q8RCpsbajth JWadmIBLNTctF8SXfzoj7IbH0YZBb3qhrHu6PLYAhjOFs51foytFNuGngWT9xJPswV+Y xxYawxj4I7ZhUe3HK0NL5aeaUzq1m5I/CRTT2p1OzIFfwndX67yde9HYzI8K4atE7FWA +CKDrcbV2DE/7INI8z1JVw65xKlOyNpSvDkxLMorZKJEq4cxKQ0iAsQnInt2kEhhHXjh Lleg== X-Gm-Message-State: AOJu0Yx50f1G2MC81yATv6lWI/gVvNQ0Fm9Zd/2e66QB20cp3nKO0BlQ rYV56CwWRDDsksz0Cm7MM7ScyA== X-Google-Smtp-Source: AGHT+IFYeCT7NoMXBSyRk49ToVvjFa7up/AR97hnO5j7bh5XJqUtITXhyb/Ob/GzjkANXNglOLF3Kw== X-Received: by 2002:a05:6a20:1453:b0:187:caeb:5e1f with SMTP id a19-20020a056a20145300b00187caeb5e1fmr3101692pzi.56.1700370253519; Sat, 18 Nov 2023 21:04:13 -0800 (PST) Original-Received: from orion.rgrjr.com ([2600:1700:7c2c:e000::22]) by smtp.gmail.com with ESMTPSA id z15-20020a170903018f00b001cf54e6b385sm1509846plg.203.2023.11.18.21.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:04:12 -0800 (PST) In-Reply-To: <8734x2zwnc.fsf@whxvd.name>, <7094.1700336212@archlinux> X-Mailer: VM 8.2.0b under 30.0.50 (x86_64-pc-linux-gnu) Received-SPF: none client-ip=2607:f8b0:4864:20::430; envelope-from=rogers@rgrjr.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, NICE_REPLY_A=-1.293, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312941 Archived-At: From: Sebastian Miele Date: Sat, 18 Nov 2023 20:18:00 +0100 > From: Greg Minshall > Date: Fri, 2023-11-17 19:13 -0800 . . . > the below patch to src/emacs.c (**) treats a "-x" (and its "partner" > "-scripteval") like a "--" on the command line, and *seems* to allow > arbitrary options on the command line. for example, with this patch > installed: > > ---- > % ./foo.sh --eval > command-line-args-left (--eval) > ---- On Linux that can be achieved by defining a custom interpreter . . . However, the workaround is not possible on at least some non-Linux systems, because not all systems allow something interpreted as an interpreter in a shebang, see https://en.wikipedia.org/wiki/Shebang_(Unix)#Syntax. A more portable option might be for emacs itself to change its startup behavior if invoked under a special name. For example, if you used an "emacscript" alias, emacs would assume "--batch --load" and defer the rest of its argument processing to the script. That would make life easy on Unix-like systems. And you could just do emacscript script-name.el ... on non-Unix systems. ================ From: Greg Minshall Date: Sat, 18 Nov 2023 11:36:52 -0800 . . . i'd like the users (hah!) to be able to type ---- ./random-script -d --base-dir ${PWD}/foo ---- rather than ---- ./random-script -- -d --base-dir ${PWD}/foo ---- cheers, Greg (truth in advertising: in addition to this *application*, i also -- for this application, really -- wrote some emacs-getopt package that would probably benefit from such a facility.) I am reminded of the emacs-lisp email server I wrote 30 years ago . . . it ran for about 8 years. "emacs --batch" on steroids. ;-} -- Bob