From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#70577: [PATCH] New command other-project-prefix Date: Sat, 4 May 2024 05:12:39 +0300 Message-ID: References: <86le501ykg.fsf@mail.linkov.net> <86jzkhe81b.fsf@mail.linkov.net> <208c7a05-6cfe-40c2-af54-187967348686@gutov.dev> <86le4tz88d.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------SR53G2cSRWmqGKgrT2IPY09P" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32134"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 70577@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 04 04:14:09 2024 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 1s34ue-000891-1O for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 May 2024 04:14:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s34uD-0008LB-8o; Fri, 03 May 2024 22:13:41 -0400 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 1s34uB-0008Kw-Ad for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 22:13:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s34uB-0007Sz-2v for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 22:13:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s34uX-0000bu-Mm for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 22:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 May 2024 02:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70577 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70577-submit@debbugs.gnu.org id=B70577.17147887952241 (code B ref 70577); Sat, 04 May 2024 02:14:01 +0000 Original-Received: (at 70577) by debbugs.gnu.org; 4 May 2024 02:13:15 +0000 Original-Received: from localhost ([127.0.0.1]:50520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s34tm-0000a5-N8 for submit@debbugs.gnu.org; Fri, 03 May 2024 22:13:15 -0400 Original-Received: from wfhigh2-smtp.messagingengine.com ([64.147.123.153]:35207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s34tk-0000Zm-Hp for 70577@debbugs.gnu.org; Fri, 03 May 2024 22:13:14 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 425FB180010A; Fri, 3 May 2024 22:12:43 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 03 May 2024 22:12:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1714788762; x=1714875162; bh=BjMMOXFWyg a+mZ02qPlPcV3z2OClmpXtE/UH/nkNqd8=; b=eI3ZtofwYseXkKj99Eyi64ODmW EgQsk3CPUJ7B7EKaI18TlR2kNrwdgm7M7Xk8gJv3UTllCvojioaCCRH8M6FjHSwc /rLXNyVq5mDfHhtDQLvqnhfVG5J3uWV1GFmc4PZZ54VEudBgKoZnELXO8Gl7sP1Z HewPR4zPPioW8V2kyRBJb0pb3oKNveGtKwPsQL5yivOpnlA+ehHkPXmUuol6Q+7C u5UuJaPGRVFKaRQ/4jWe53vyYysSmSFKVvY2iWaEcEDVX8OfPjq1Cv/lQccgmbht Ay78ApMD721CP4aU9oKoE15y9/XGoEPWFP+JZEL7tDEfbHQS7YrdLAZc5W5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1714788762; x=1714875162; bh=BjMMOXFWyga+mZ02qPlPcV3z2OCl mpXtE/UH/nkNqd8=; b=clgUZgEjcWAdmhfRWQ2wdBIt6Gos5b7QROKGf4RmRzDc J6De1IkVSKnmJAt1XAAppcAn/SGiHyHwrDZZGP7J5EXk9r1FA1xdtxwj9u3n+eCs ZtEr306tJr4X8OySkdenyCx4Qtz3WOT87YHi/5N3+du+ggfDTNO5ornoggwrtWtQ KiyJidB6G3qbLRgr4sH/g9cs7idMapaztmbClBjfesicEDHBVS8MP+DoZdaWralr fwiWGALshJXIBSvEMsDxjzJWufCz6OgcNAECvOC1hVypucyX9KUjQYR08YdB91bc rLfH+E98DqSVCVKoUfMLT6mqezb9n1h72aKh9PDI7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddvuddgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptgfkffggfgfuvfevfhfhjgesmhdtreertddvjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeelkeejiedvffdtgeejvdffffelueelkefhtdekjeehuefgteduheegfefhieek jeenucffohhmrghinhepghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 May 2024 22:12:41 -0400 (EDT) Content-Language: en-US In-Reply-To: <86le4tz88d.fsf@mail.linkov.net> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284399 Archived-At: This is a multi-part message in MIME format. --------------SR53G2cSRWmqGKgrT2IPY09P Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/05/2024 09:12, Juri Linkov wrote: >>> Something is wrong here. I bound 'other-project-prefix' to 'C-x p P'. >>> Then typing 'C-x p P C-x d' asked a directory name, then later >>> after selecting a project asked for the directory name again. >> >> Looks like that has to do with the interactive spec. See the attached next >> revision, it seems to behave better. > > Thanks, this works now (except that it can't be debugged because of the > Lisp error: (wrong-type-argument listp ignore)). > > Also 'C-h' is not a problem: 'help-form-show' does nothing > without 'help-form', but with 'help-form' works fine: > > (define-key map (vector help-char) > (lambda () > (interactive) > (let ((help-form "You can use any global keybinding.")) > (help-form-show)))) We would want 'C-h' to show the regular buffer with key bindings, won't we? With similar output to the one that we get after 'C-x p C-h' or 'C-x v C-h'. The output might be weirder because of the composed keymap, but it could still be useful. Also, with which-key-mode, C-h would do its thing. > However, a much bigger problem is that unfortunately many test cases from > https://debbugs.gnu.org/63648#203 are broken. For example, > 'C-x p p C-b' fails the same way as in bug#58784. > 'C-x p p f M-n' fails because it expects to read arguments > in a previous project with an old value of default-directory, etc. Thanks for noticing. Looks like the call to project-prompter can change the value of this-command, and that's why the subsequent check went down the wrong branch. See the attached v3 with the fix. > Maybe this could be fixed by running 'interactive' in a previous project > by using something like: > > (around-fun > (lambda (command &rest _args) > (interactive (lambda (spec) > (let ((default-directory prev-dir)) > (advice-eval-interactive-spec spec)))) I think the command might rather expect to be called in the "new" project. And also while some have interactive specs with significant logic inside, others don't; introducing a difference there could cause more problems. --------------SR53G2cSRWmqGKgrT2IPY09P Content-Type: text/x-patch; charset=UTF-8; name="other-project-prefix-v3.diff" Content-Disposition: attachment; filename="other-project-prefix-v3.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvcHJvZ21vZGVzL3Byb2plY3QuZWwgYi9saXNwL3Byb2dtb2Rl cy9wcm9qZWN0LmVsCmluZGV4IDAwMGEwNTgwNGE4Li4xZWU2ZTU4NDhhMyAxMDA2NDQKLS0t IGEvbGlzcC9wcm9nbW9kZXMvcHJvamVjdC5lbAorKysgYi9saXNwL3Byb2dtb2Rlcy9wcm9q ZWN0LmVsCkBAIC05NTIsNiArOTUyLDQ4IEBAIHByb2plY3Qtb3RoZXItdGFiLWNvbW1hbmQK ICh3aGVuIChib3VuZC1hbmQtdHJ1ZS1wIHRhYi1wcmVmaXgtbWFwKQogICAoZGVmaW5lLWtl eSB0YWItcHJlZml4LW1hcCAicCIgIydwcm9qZWN0LW90aGVyLXRhYi1jb21tYW5kKSkKIAor Ozs7IyMjYXV0b2xvYWQKKyhkZWZ1biBvdGhlci1wcm9qZWN0LXByZWZpeCAoKQorICAiXCJT d2l0Y2hcIiB0byBhbm90aGVyIHByb2plY3QgYmVmb3JlIHJ1bm5pbmcgYW4gRW1hY3MgY29t bWFuZC4KK01ha2VzIHN1cmUgdGhlIG5leHQgY29tbWFuZCBpbnZva2VkIGFza3MgZm9yIHRo ZSBwcm9qZWN0IHRvIHJ1biBpdCBpbi4iCisgIChpbnRlcmFjdGl2ZSkKKyAgKHByZWZpeC1j b21tYW5kLXByZXNlcnZlLXN0YXRlKQorICAobGV0cmVjICgoZGVwdGggKG1pbmlidWZmZXIt ZGVwdGgpKQorICAgICAgICAgICAoZWNob2Z1biAobGFtYmRhICgpICJbc3dpdGNoLXByb2pl Y3RdIikpCisgICAgICAgICAgIChhcm91bmQtZnVuCisgICAgICAgICAgICAobGFtYmRhIChj b21tYW5kICZyZXN0IF9hcmdzKQorICAgICAgICAgICAgICAoaW50ZXJhY3RpdmUpCisgICAg ICAgICAgICAgIChhZHZpY2UtcmVtb3ZlIHRoaXMtY29tbWFuZCBhcm91bmQtZnVuKQorICAg ICAgICAgICAgICAodW5sZXNzIChvciAoZXEgdGhpcy1jb21tYW5kICdvdGhlci1wcm9qZWN0 LXByZWZpeCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKGVxIGxhc3QtY29tbWFuZC1l dmVudCBoZWxwLWNoYXIpKQorICAgICAgICAgICAgICAgIChsZXQqICgodGhpcy1jb21tYW5k LXNhdmVkIHRoaXMtY29tbWFuZCkKKyAgICAgICAgICAgICAgICAgICAgICAgKHJvb3QgKGZ1 bmNhbGwgcHJvamVjdC1wcm9tcHRlcikpKQorICAgICAgICAgICAgICAgICAgKGlmIChvciAo c3RyaW5nLXByZWZpeC1wICJwcm9qZWN0LSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAoc3ltYm9sLW5hbWUgdGhpcy1jb21tYW5kLXNhdmVkKSkKKyAg ICAgICAgICAgICAgICAgICAgICAgICAgKGdldCB0aGlzLWNvbW1hbmQtc2F2ZWQgJ3Byb2pl Y3QtYXdhcmUpKQorICAgICAgICAgICAgICAgICAgICAgIChsZXQgKChwcm9qZWN0LWN1cnJl bnQtZGlyZWN0b3J5LW92ZXJyaWRlIHJvb3QpKQorICAgICAgICAgICAgICAgICAgICAgICAg KGNhbGwtaW50ZXJhY3RpdmVseSBjb21tYW5kKSkKKyAgICAgICAgICAgICAgICAgICAgKGxl dCAoKGRlZmF1bHQtZGlyZWN0b3J5IHJvb3QpKQorICAgICAgICAgICAgICAgICAgICAgIChj YWxsLWludGVyYWN0aXZlbHkgY29tbWFuZCkpKSkpKSkKKyAgICAgICAgICAgKHByZWZ1bgor ICAgICAgICAgICAgKGxhbWJkYSAoKQorICAgICAgICAgICAgICAodW5sZXNzICg+IChtaW5p YnVmZmVyLWRlcHRoKSBkZXB0aCkKKyAgICAgICAgICAgICAgICAocmVtb3ZlLWhvb2sgJ3By ZS1jb21tYW5kLWhvb2sgcHJlZnVuKQorICAgICAgICAgICAgICAgIChyZW1vdmUtaG9vayAn cHJlZml4LWNvbW1hbmQtZWNoby1rZXlzdHJva2VzLWZ1bmN0aW9ucyBlY2hvZnVuKQorICAg ICAgICAgICAgICAgICh3aGVuIChhbmQgdGhpcy1jb21tYW5kIChzeW1ib2xwIHRoaXMtY29t bWFuZCkpCisgICAgICAgICAgICAgICAgICAoYWR2aWNlLWFkZCB0aGlzLWNvbW1hbmQgOmFy b3VuZCBhcm91bmQtZnVuKSkpKSkpCisgICAgKGFkZC1ob29rICdwcmUtY29tbWFuZC1ob29r IHByZWZ1bikKKyAgICAoYWRkLWhvb2sgJ3ByZWZpeC1jb21tYW5kLWVjaG8ta2V5c3Ryb2tl cy1mdW5jdGlvbnMgZWNob2Z1bikKKyAgICAobGV0ICgobWFwIChtYWtlLXNwYXJzZS1rZXlt YXApKSkKKyAgICAgIChzZXQta2V5bWFwLXBhcmVudCBtYXAgcHJvamVjdC1wcmVmaXgtbWFw KQorICAgICAgOzsgRG9lc24ndCB3b3JrIDstKAorICAgICAgOzsgKGRlZmluZS1rZXkgbWFw ICh2ZWN0b3IgaGVscC1jaGFyKQorICAgICAgOzsgICAgICAgICAgICAgKGxhbWJkYSAoKSAo aW50ZXJhY3RpdmUpIChoZWxwLWZvcm0tc2hvdykpKQorICAgICAgKHNldC10cmFuc2llbnQt bWFwIG1hcCkpCisgICAgKG1lc3NhZ2UgKGNvbmNhdCAiVHlwZSAiIChwcm9qZWN0LS1rZXlt YXAtcHJvbXB0KSAiIG9yIGFueSBnbG9iYWwga2V5IikpKSkKKworOzsgKGRlZmluZS1rZXkg cHJvamVjdC1wcmVmaXgtbWFwIChrYmQgIlAiKSAjJ290aGVyLXByb2plY3QtcHJlZml4KQor CiAoZGVjbGFyZS1mdW5jdGlvbiBncmVwLXJlYWQtZmlsZXMgImdyZXAiKQogKGRlY2xhcmUt ZnVuY3Rpb24geHJlZi0tZmluZC1pZ25vcmVzLWFyZ3VtZW50cyAieHJlZiIpCiAK --------------SR53G2cSRWmqGKgrT2IPY09P--