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#57752: 28.1.91; emacsclient-mail.desktop doesn't work for me Date: Fri, 16 Sep 2022 10:21:56 -0700 Message-ID: <4712c3c2-dfca-c6a4-2840-13d20cffb7b8@gmail.com> References: <87r10gcum8.fsf@cassou.me> <87bkrj31r0.fsf@gnus.org> <87y1unxv15.fsf@cassou.me> <83leqn4cji.fsf@gnu.org> <87v8prxtox.fsf@cassou.me> <878rmjy78x.fsf@gnus.org> <87bkrfiqbg.fsf@gmail.com> <878rmjqysp.fsf@cassou.me> <84acc36e7e9328ef2f76@heytings.org> <87zgezpebo.fsf@cassou.me> <84acc36e7e47f3fe9562@heytings.org> <7069638a-21b3-9777-215c-3ce4ec18ca37@froglet.home.mavit.org.uk> <84acc36e7e2d900b70c0@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39993"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Damien Cassou , Robert Pluim , 57752@debbugs.gnu.org, git@mavit.org.uk, Lars Ingebrigtsen , Eli Zaretskii To: Gregory Heytings , Peter Oliver Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 16 19:24:49 2022 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 1oZF57-000AIL-MU for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 19:24:49 +0200 Original-Received: from localhost ([::1]:44224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZF56-0007Tc-Qk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 13:24:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZF3O-00061g-VK for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 13:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oZF3O-0006Wq-Mm for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 13:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oZF3O-0005Qv-IR for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 13:23:02 -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, 16 Sep 2022 17:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57752 X-GNU-PR-Package: emacs Original-Received: via spool by 57752-submit@debbugs.gnu.org id=B57752.166334892620803 (code B ref 57752); Fri, 16 Sep 2022 17:23:02 +0000 Original-Received: (at 57752) by debbugs.gnu.org; 16 Sep 2022 17:22:06 +0000 Original-Received: from localhost ([127.0.0.1]:44190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZF2U-0005PS-7v for submit@debbugs.gnu.org; Fri, 16 Sep 2022 13:22:06 -0400 Original-Received: from mail-pg1-f171.google.com ([209.85.215.171]:34343) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZF2S-0005Oy-2N for 57752@debbugs.gnu.org; Fri, 16 Sep 2022 13:22:04 -0400 Original-Received: by mail-pg1-f171.google.com with SMTP id i19so17680453pgi.1 for <57752@debbugs.gnu.org>; Fri, 16 Sep 2022 10:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :date:message-id:from:references:cc:to:subject:from:to:cc:subject :date; bh=eWAXwlpaOzuxjhJLb2uMgN9M+fSiZpxBPYiAzF85EZ0=; b=fbUT4aQgSb2MVFlDtwTfArD13vH8YxzskVnpugVJebQpB0OjZWYiE36BkgKecPdDvA XtQKGzYJQF5EI5HtWYRqOo3Jvf02vveSK/0gsl4TYLP4e8/FNiMla79ooqpnX6VqpCCh j51ADBdxHo0YanyCgyTgc+Q4G/KFTMegh6RG1xP3bY49Q8Iln5o9eaFLXQeta40EPu3/ fYHXwvfyAmWR/BCLywwnBvCjrsFInfLt3K094O79PTBrZUcPWj4GUo6BXlDzHwwZ8p/H 9gXW/UtbWfh871DOksMfw5DyjW30d4zJKrHOcU4U41D0pAinh4Tw5Nhbz4CgMNGiFtYa L9PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :date:message-id:from:references:cc:to:subject:x-gm-message-state :from:to:cc:subject:date; bh=eWAXwlpaOzuxjhJLb2uMgN9M+fSiZpxBPYiAzF85EZ0=; b=vCaZFvKXqUnlpD/pvDEn2/iJvmtZZPK1JXIypiQM92V8O3LxZv8av9L1/XSUpn/sFu ojDoajWm/R9W83jJ9RKvZkK4jJQAYkgSv1Z0sj+7jy07PMIGyIilffqshhotW+T55WZs j4/v8UnHkVOrXgWHy4xGNi0GtLeMoAiARzSug4fxa6jSJ+V5r8T2qD3msXJvalYJS6K+ qpKY55T9t7NtKtZKvKmZaQfjYUBO8L/DPvGEqYz28hOLU61XU2qFyILyGtv64q3fCqg6 rUZ9pluVR1W3Btdk7FXqyg6Mzv4LWFlnVQtR/DZwLtCMBpT3B1beGVgvw23/SHwtxjEr Ycwg== X-Gm-Message-State: ACrzQf1rY7w5uTcC+uDkMO14oSlRgVVI7R9/NXs3rBHIf0AgIkZUPQNg vTlFYjQ7RqTxPHFcTAChmBM= X-Google-Smtp-Source: AMsMyM6LkU3ZM0eVmzSsT3CoR5VL2Q0C80GJCMk/jhbUf3pchDM3nLie5HbzULcTnqlK0fHwfePrNg== X-Received: by 2002:a63:d50f:0:b0:439:cc64:78a9 with SMTP id c15-20020a63d50f000000b00439cc6478a9mr1229368pgg.160.1663348917126; Fri, 16 Sep 2022 10:21:57 -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 17-20020a17090a035100b002001c9bf22esm1759034pjf.8.2022.09.16.10.21.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Sep 2022 10:21:56 -0700 (PDT) In-Reply-To: <84acc36e7e2d900b70c0@heytings.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:242791 Archived-At: On 9/16/2022 9:42 AM, Gregory Heytings wrote: >>> And why is the above easier / better than >>> >>> emacsclient --eval '(progn (fun1 arg1 arg2) (fun2 arg3))' >> >> Because, with this, you have to correctly format the arguments with >> appropriate quoting into a lisp program, rather than just passing them >> straight in.  If the arguments are input from something else, this is >> harder than it appears.  Bad quoting is a common source of bugs >> (things like SQL injection, for example). >> > > If that's the intended use case, IMO instead of adding two --function > and --function-arg arguments it would be much clearer to add a --setq > parameter: > > emacsclient --setq arg1 ... --setq arg2 ... --setq arg3 ... --eval > '(progn (fun1 arg1 arg2) (fun2 arg3))' I'm not convinced that '--function-arg' is necessary, but I do think that adding '--function' to emacsclient would be the best solution of the ones presented so far. That would allow both of the following in .desktop files: emacsclient --function my-function-taking-one-url %u emacsclient --function my-function-taking-many-urls %U (Likewise for %f/%F, which expands to one/many file names.) '--setq' has the disadvantage that you'd need some way to prepend *each* URL/filename with it in the %U/%F cases. The functions above would need to be able to consume command-line arguments (like 'message-mailto' does), but that's not a big deal. We could even add an 'apply-from-command-line' function that adapts any existing function to do this: emacsclient --function apply-from-command-line func arg1 arg2 'apply-from-command-line' could look at the arity of 'func' and consume the appropriate number of command-line arguments. Adding '--function' to emacsclient also has the advantage that it's already available for emacs, so it's not really an all-new feature so much as it is just adding a new place you can use it from. The semantics of '--function' are already set, and should work just fine for the cases described in this bug.