From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#646: emacsclient with no args to behave like -a Date: Fri, 27 Aug 2021 10:18:07 -0700 Message-ID: References: <4287a62c0808040310m6d817102lb3bdf4982e6451d7@mail.gmail.com> <878s0nr2af.fsf@gnus.org> <87k0k7plq7.fsf@gnus.org> <67399b53-e649-bd25-bdb4-107bfb95c0f6@gmail.com> <87v93rndr1.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22848"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "J. Pablo =?UTF-8?Q?Fern=C3=A1ndez?=" , 646@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 27 19:19:08 2021 Return-path: Envelope-to: geb-bug-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 1mJfVU-0005hv-GV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Aug 2021 19:19:08 +0200 Original-Received: from localhost ([::1]:51220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJfVT-0004Fp-B4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Aug 2021 13:19:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJfVO-0004Fe-3a for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 13:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJfVN-0008Lx-Sk for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 13:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mJfVN-0006Hy-Lo for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2021 13:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Aug 2021 17:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 646 X-GNU-PR-Package: emacs Original-Received: via spool by 646-submit@debbugs.gnu.org id=B646.163008469524118 (code B ref 646); Fri, 27 Aug 2021 17:19:01 +0000 Original-Received: (at 646) by debbugs.gnu.org; 27 Aug 2021 17:18:15 +0000 Original-Received: from localhost ([127.0.0.1]:52883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJfUd-0006Gw-Gp for submit@debbugs.gnu.org; Fri, 27 Aug 2021 13:18:15 -0400 Original-Received: from mail-pg1-f169.google.com ([209.85.215.169]:42990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJfUb-0006Gi-Cy for 646@debbugs.gnu.org; Fri, 27 Aug 2021 13:18:13 -0400 Original-Received: by mail-pg1-f169.google.com with SMTP id q68so6462785pga.9 for <646@debbugs.gnu.org>; Fri, 27 Aug 2021 10:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=g08vJ/jrSlOve4YAAoZBS3Jb28/gzgcNCajdEMZ1O44=; b=OqmbvPc/LfR5MIWg0Vas9ugUYS0M2OcA1xhUJ86jQEetR44c91TH7VY1IzpttRc8XD WOukuQ3w0MId9zmDNaLiPkE4wZ97bXtQR6fSF6kM2TrBnFGn7GkIq1tzlTTF1UQJgDzy iHGd0mLbk67032bVAesSYVnuKrnSFVpferuS62Wa7IhFbgCwJ4sy+HaDEdnsIaS9dJru ugW8PrrrdwUHU1jphybrrUGoGBhUg7v1CIA715zyazsPv7WUPQEl/jXhLEVERZGEG61z v+yZdcUZeO55FlIMk9uP0nRw/5KXfH8mhnCUYfUspoEeDVVqEiOVKy/DZXiZzI2bBzTf rhTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=g08vJ/jrSlOve4YAAoZBS3Jb28/gzgcNCajdEMZ1O44=; b=XwykjuBYTVm5PUKY93+8S+qTBgNOn2hFnhxfj4Yb+cF3ES86kyFMEymj36yDO3i7Ps EbTwILgvUv3uZrUhyhryyK2f9ZL/tsiB6z+aYZJlGENzG0CwJ89jbngucxc/9jS+BIPr bFR1ZUAsg6HWWVieweXb8jhouXDqz5yho8oJd2pMvu1LIn2qC9LNjWndu2m9sdNZEYY8 kjU2HAkQSzbGYXszTfh7kC4kevzM8mwYWKW9tvvfZiQqV7I5bDRykaEmWSRhsMCWGko5 CXyuuqFURZkhclGY2ZjlC6pN+4zs4Go3qsNlj3AfHgYkgx2TBVN3jD3j1Q3fkavBArZz uQFA== X-Gm-Message-State: AOAM531yCKA8pDn1k+sV2j9KZVT1aQ4XalP2KOb1XuCMjkhmE0pwozl2 wJ7mB4UhvlvOODpB5raE5nWGXHLoJQ0= X-Google-Smtp-Source: ABdhPJwSHG5iPY54JZucweUe/ubAXrU/EvQstDcT+mulOLHMb8FCZRSXijUSoTurB276lwacL5UYog== X-Received: by 2002:a65:6a09:: with SMTP id m9mr8659015pgu.269.1630084687486; Fri, 27 Aug 2021 10:18:07 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id g3sm7776662pgj.66.2021.08.27.10.18.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Aug 2021 10:18:06 -0700 (PDT) In-Reply-To: <87v93rndr1.fsf@gnus.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212832 Archived-At: On 8/27/2021 7:50 AM, Lars Ingebrigtsen wrote: > Jim Porter writes: > >> "First, I recommend using the W32 package. W32 has hacked the >> emacsclient in several useful ways. It will start Emacs if it isn't >> already running, it will call "raise-frame" on the Emacs window when >> started, and it permits starting emacsclient without a filename. "[1] > > I think that's how emacsclient works these days -- if you set > ALTERNATE_EDITOR to the empty string. (It starts a new daemon Emacs and > then connects to it.) I tested this on Emacs 28.0.50, and a filename is still required. Otherwise emacsclient errors out as before. [As an aside: the main difference that I see is that with ALTERNATE_EDITOR=emacs, `emacsclient file.txt' opens emacs directly (so there's no emacsclient process hanging around, only emacs). With ALTERNATE_EDITOR as the empty string, `emacsclient file.txt' starts a daemon Emacs (so there are emacsclient and `emacs --daemon' processes running).] That said, you can call `emacsclient -c' to create a new Emacs frame. That works if you wanted to make a desktop shortcut to do something similar to the Emacs+EmacsW32 patched version of emacsclient, but that means it'll always open a new frame, even if you pass it some files. That's not necessarily the behavior people want. No-args support in emacsclient could be nice for scripting or for things like the etc/emacsclient.desktop shortcut. Currently that uses a conditional to decide what to call based on whether it was passed any files (reformatted here for clarity): if [ -n "$*" ]; then exec emacsclient --alternate-editor= --display="$DISPLAY" "$@"; else exec emacsclient --alternate-editor= --create-frame; fi Fixing this issue could simplify that to something like: `emacsclient --alternate-editor= %F'. However, since emacsclient.desktop handles this already (albeit with a somewhat complex incantation), maybe that's enough.