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#66317: Project mode-line Date: Tue, 3 Oct 2023 19:24:52 +0300 Message-ID: <2b5ee12c-2272-8129-8025-97fb00243d95@gutov.dev> References: <86jzs4ntxb.fsf@mail.linkov.net> 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="17234"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: 66317@debbugs.gnu.org To: Eshel Yaron , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 03 18:26:13 2023 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 1qniDs-00044k-9P for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Oct 2023 18:26:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qniDU-0003G0-7p; Tue, 03 Oct 2023 12:25:48 -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 1qniDR-0003FT-Ua for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 12:25:46 -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 1qniDR-0003Lr-M7 for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 12:25:45 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qniDi-0006wS-Hr for bug-gnu-emacs@gnu.org; Tue, 03 Oct 2023 12:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Oct 2023 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66317 X-GNU-PR-Package: emacs Original-Received: via spool by 66317-submit@debbugs.gnu.org id=B66317.169635032126629 (code B ref 66317); Tue, 03 Oct 2023 16:26:02 +0000 Original-Received: (at 66317) by debbugs.gnu.org; 3 Oct 2023 16:25:21 +0000 Original-Received: from localhost ([127.0.0.1]:40606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qniD2-0006vQ-KT for submit@debbugs.gnu.org; Tue, 03 Oct 2023 12:25:21 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53269) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qniCz-0006v8-Ue for 66317@debbugs.gnu.org; Tue, 03 Oct 2023 12:25:19 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 293E05C02A1; Tue, 3 Oct 2023 12:24:55 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 03 Oct 2023 12:24:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1696350295; x=1696436695; bh=j2fPAok6aSK94uzBoctXqzVLjTPiRNfdUIj tyOFR0Nc=; b=KvDx2pNktPf5UtI/EmFEW+Gc5M1/waEDA0Lfux+kK6J/U2W/1lP 2iE80vdihxdLOB6/YQilO2YfqYlCZHcCY6GJ3zJiBskIDwTZMPkYNR584VKzv/Q5 GiX+0n/m9eU4dqlBm2bGlw/ACP4gayqDlH8/Wc2a7URBXH1fBDtd90Bwlz2vjOg4 kcrWTiZNcO9GKMiQ5oG/MRgNRSZhsqLiJlpISAFxxCDLbIHUVCwArLxnM0yuxqrj 5rp+zFje1T3U8LCVjF9+fqDzcbKA4VV3hJPgpyaPBaD9aYAJ4TfcrkhHbKAatAaH c7WdUQirQUTehKoEHBBGWIo6Syur1kbGzJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1696350295; x=1696436695; bh=j2fPAok6aSK94uzBoctXqzVLjTPiRNfdUIj tyOFR0Nc=; b=ljVpTALv55r2/pQP5MxKDahF3tJBmQO05c3iZd7t4mCKO6wh1Jh 8dc/NLELGBKBTBGkS8L20lCwqHEjczqeS9OirZxfUbTE2Q7rrJ0Gbr4F6ef5EOim XUHRJ4KhkMZ8oo1ipakmNEObqcXyUOj9ccM3dSylBrNdbw3WJdLUu74ccjF0k2Ig 7YL8BZDqvxCO3AiXJynfcZggTHBeA9g5GkX9uo05Ak/8ez3mNQ0buOCONaYGNj1K 30xQkGGGD+WUPci7utNhdMzf3GCgVMZE1tTXpOYq6BeOuqEvpFqWU3wvxBVWoKzd eTJ/nEdJBScpVqPCHwZgPSvGpG09Dok7eqQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfeejgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Oct 2023 12:24:53 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:271715 Archived-At: On 03/10/2023 11:07, Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Hi, > > Juri Linkov writes: > >> Here is the implementation of the mode-line project indicator prepended >> before the vc indicator with the project menu discussed in bug#63469: >> >> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el >> index 2e6ae89a443..8798feb2c56 100644 >> --- a/lisp/progmodes/project.el >> +++ b/lisp/progmodes/project.el >> @@ -2010,5 +2102,20 @@ project-uniquify-dirname-transform >> (file-relative-name dirname root)))) >> dirname)) >> >> +;;; Project mode-line >> + >> +(let ((form '(:eval (when-let (project (project-current)) >> + (concat " " >> + (propertize >> + (project-name project) >> + 'mouse-face 'mode-line-highlight >> + 'local-map >> + (make-mode-line-mouse-map >> + 'down-mouse-1 >> + `(menu-item "Project" >> + ,menu-bar-project-menu)))))))) >> + (when-let (pos (seq-position mode-line-format '(vc-mode vc-mode))) >> + (cl-pushnew form (nthcdr pos mode-line-format)))) >> + >> (provide 'project) >> ;;; project.el ends here > This looks nice (I actually have something similar in my > `mode-line-format` already), but I think that modifying > `mode-line-format` when project.el is loaded is a bit problematic. > Perhaps a better alternative would be to define a variable that holds > this mode-line construct, along with an autoloaded function that people > can call from their init files to actually add this construct to > `mode-line-format`. WDYT? I also think this would be a more conservative choice (keeping the runtime cost of using project.el to zero by default). - A public defvar with the mode-line spec for the project element (which could be used by alternative mode-lines as well). - Either a public function, or a defcustom (nil by default) where the setter does the same thing. The latter seems a bit user-friendlier.