From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#41890: 28.0.50; [PATCH]: Add bindings for project.el Date: Wed, 17 Jun 2020 12:51:07 +0200 Message-ID: <87tuzaotic.fsf@warpmail.net> References: <87blljbarq.fsf@thornhill.no> <83pn9z13xq.fsf@gnu.org> <87lfknklj8.fsf@thornhill.no> <83h7vb0w3u.fsf@gnu.org> <87ftaulxzr.fsf@thornhill.no> <87r1ueri7m.fsf@tcd.ie> <87imfqn829.fsf@thornhill.no> <87ftaun7ug.fsf@thornhill.no> <87v9jqfzbv.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="75447"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 17 13:08:11 2020 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 1jlVvO-000JVi-NQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Jun 2020 13:08:11 +0200 Original-Received: from localhost ([::1]:52464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlVvN-0002HI-C2 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Jun 2020 07:08:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlVvG-0002Gb-P3 for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 07:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38990) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlVvG-00063i-FV for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 07:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jlVvG-00026o-9L for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 07:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jun 2020 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41890 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by submit@debbugs.gnu.org id=B.15923920628079 (code B ref -1); Wed, 17 Jun 2020 11:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jun 2020 11:07:42 +0000 Original-Received: from localhost ([127.0.0.1]:50536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlVuv-00026E-Vn for submit@debbugs.gnu.org; Wed, 17 Jun 2020 07:07:42 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlVus-000263-Tc for submit@debbugs.gnu.org; Wed, 17 Jun 2020 07:07:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlVus-0002Dd-Ot for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 07:07:38 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlVuq-0005yq-1A for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 07:07:38 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 73F8A5C00FF for ; Wed, 17 Jun 2020 07:07:34 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 17 Jun 2020 07:07:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h= resent-from:resent-date:resent-to:from:to:subject:references :date:in-reply-to:message-id:mime-version:content-type :resent-message-id; s=fm3; bh=87NQVWBv/+PLl3cpu9gyzfchnCEL8oFwVL //VGr1TiQ=; b=VyuzMP0z9QTE1M+UcXFNwTfWjFEbANhTuQlpRn8Q7zLe6tT6u1 zXjbbXUlCCpBTtJiANDjci/BeU3AiCVCwmCXgsZQ04eo2q8OEffV/L9WM7vIEqZ4 CC4l8O3whr4PZ9EOooZgaiKiEVEHKgw8YeMbVsnOvm1eYoWks4uwK0eUovKefj+2 kP3fgK8VavqqY80NJ+coK04dj7AlJHlWy4u8u1eIYAmsojgUk16MQYYum+yojoeV wmoCOWrac8ZMzPUhJSPyVJJQgb8NVKq/uIpfHz2ntVhtvxsXH9AExk4dB39urKo2 Dl+nZObz+OV94FvbXQE+A3ObkXcvTRrZRnjw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:resent-date:resent-from :resent-message-id:resent-to:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=87NQVWBv/+PLl3cpu 9gyzfchnCEL8oFwVL//VGr1TiQ=; b=ay2tbwJsHx2xPcEDNiNKmntSxb4TOk1qf pBfuX4SNPO3bBxvENBBPSsUojzrr9hVzEC7eAeaTb2cZsAfwKxHjEaAhurzyyoiQ MuvTANU98u+/y42NeVYOLGgusRcRTvtolT94pJTRGgKBZkf7P4tpsnDD2ADQDYH9 NCBP5WqLtJOTh/5/xsXQe7KLmhGMQZm2A6MWztlt+qmR6hhdE50dliiPrhqmPHzt qsBw38xCvFAVvqUT3hzCmBzJwX1sNSMBg61DMEQMVM7M1iXMykkWFysgi3IQ0nj6 oQ2tzMjz0DrAEo88CnxrlMhjc/BxoPtZTzTgs+arggZZaUDnUtOiA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejvddgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpedfrfhhihhl ihhpucfmrddfuceophhhihhlihhpseifrghrphhmrghilhdrnhgvtheqnecuggftrfgrth htvghrnhepveeigefgkeeghfelvdejieehvdfghffftdeivdehjeefveeltdefgeeikeel feeinecukfhppeejledrvdduledrudelledrvdduheenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesfigrrhhpmhgrihhlrdhn vght X-ME-Proxy: Original-Received: from localhost (p4fdbc7d7.dip0.t-ipconnect.de [79.219.199.215]) by mail.messagingengine.com (Postfix) with ESMTPA id F055D3060FE7 for ; Wed, 17 Jun 2020 07:07:33 -0400 (EDT) Resent-From: philip@warpmail.net Resent-Date: 17 Jun 2020 13:07:31 +0200 Resent-To: bug-gnu-emacs@gnu.org X-Draft-From: ("gmane.emacs.bugs" 182051) In-Reply-To: <87v9jqfzbv.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 17 Jun 2020 00:57:56 +0300") X-RMAIL-ATTRIBUTES: -------- Resent-Message-Id: <20200617110733.F055D3060FE7@mailuser.nyi.internal> Received-SPF: pass client-ip=66.111.4.29; envelope-from=philip@warpmail.net; helo=out5-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 07:07:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:182067 Archived-At: --=-=-= Content-Type: text/plain Juri Linkov writes: > I think your choice of keys is better than in project-switch-commands. > Maybe these keys should be copied to project-switch-commands, so it will to be > in sync with project-prefix-map? > > Or is it possible to use project-prefix-map directly in project-switch-commands? > For example, by using set-transient-map? I tried implementig it, and it seems to work. The patch below isn't a full commit, since I changed the structure of project-switch-commands (it's now mapping command to description), but didn't update the docstring. -- Philip K. --=-=-= Content-Type: text/x-diff Content-Disposition: inline diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index c5301dccd3..6cb9811d3d 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -860,12 +879,12 @@ project-prompt-project-dir ;;;###autoload (defvar project-switch-commands - '((?f "Find file" project-find-file) - (?r "Find regexp" project-find-regexp) - (?d "Dired" project-dired) - (?v "VC-Dir" project-vc-dir) - (?s "Shell" project-shell) - (?e "Eshell" project-eshell)) + '((project-find-file "Find file") + (project-find-regexp "Find regexp") + (project-dired "Dired") + (project-vc-dir "VC-Dir") + (project-shell "Shell") + (project-eshell "Eshell")) "Alist mapping keys to project switching menu entries. Used by `project-switch-project' to construct a dispatch menu of commands available upon \"switching\" to another project. @@ -877,9 +896,10 @@ project-switch-commands (defun project--keymap-prompt () "Return a prompt for the project swithing dispatch menu." (mapconcat - (pcase-lambda (`(,key ,label)) + (pcase-lambda (`(,cmd ,label)) (format "[%s] %s" - (propertize (key-description `(,key)) 'face 'bold) + (propertize (key-description (where-is-internal cmd project-prefix-map t)) + 'face 'bold) label)) project-switch-commands " ")) @@ -890,14 +910,10 @@ project-switch-project The available commands are picked from `project-switch-commands' and presented in a dispatch menu." (interactive) - (let ((dir (project-prompt-project-dir)) - (choice nil)) - (while (not choice) - (setq choice (assq (read-event (project--keymap-prompt)) - project-switch-commands))) - (let ((default-directory dir) - (project-current-inhibit-prompt t)) - (call-interactively (nth 2 choice))))) + (let ((default-directory (project-prompt-project-dir)) + (project-current-inhibit-prompt t)) + (message "%s" (project--keymap-prompt)) + (set-transient-map project-prefix-map))) (provide 'project) ;;; project.el ends here --=-=-=--