From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71823: 31.0.50; project-mode-line and eglot duplicate project-name in mode-line Date: Fri, 28 Jun 2024 17:40:56 +0300 Message-ID: <86wmm9jfk7.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1370"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71823@debbugs.gnu.org To: Spencer Baugh , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 28 16:55:47 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 1sND0s-000Aa4-Rk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Jun 2024 16:55:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNCne-0000ZK-Lx; Fri, 28 Jun 2024 10:42:06 -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 1sNCnb-0000Z0-8v for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:42:03 -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 1sNCna-0007ny-Jf for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNCna-0005To-IJ for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Jun 2024 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71823 X-GNU-PR-Package: emacs Original-Received: via spool by 71823-submit@debbugs.gnu.org id=B71823.171958566920997 (code B ref 71823); Fri, 28 Jun 2024 14:42:02 +0000 Original-Received: (at 71823) by debbugs.gnu.org; 28 Jun 2024 14:41:09 +0000 Original-Received: from localhost ([127.0.0.1]:46045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNCmi-0005Sa-GV for submit@debbugs.gnu.org; Fri, 28 Jun 2024 10:41:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNCmg-0005Rx-6k for 71823@debbugs.gnu.org; Fri, 28 Jun 2024 10:41:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNCmZ-0007gb-Ll; Fri, 28 Jun 2024 10:40:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=mop5kr1AodbRnBID2vvQL+L9rzPCqTiaIhnLYLw+u9A=; b=p+1mQKAQ6Zu3GY8oJwom Eg869JZ6Csb1qcmlRqgiRksAKGpvBsnRGDBvzHwe0dG9z6y/HrYtdAQ2MHr2imLgkPmtMchJ/N6L9 iufe2aa5m1VYnmXQS5Vvo8t4C0IAbPR2pTbIVyjCSwP7T0aaZrOq9+fh/U8bFOzD8jrOgBDr3FQHv l3u5zgMH4sRDce2bGJ/0zgcYFaeewRSZgyBcSXn4w68R08SYr11+esNJUiUkbiO9YFCfSzpDcX4LK UQiY8qgF0ADiwfrvRGtYj1qavKb5YW9IZjhVlQfiHVnsYN8sxaWAXyiIWz0kW0kbtOLBVKzIyyrPx iWpcVftKFGSxMA==; In-Reply-To: (message from Spencer Baugh on Fri, 28 Jun 2024 10:15:45 -0400) 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:288075 Archived-At: > From: Spencer Baugh > Date: Fri, 28 Jun 2024 10:15:45 -0400 > > >From 928101e122725866ee95172730ebff03f4d54d5a Mon Sep 17 00:00:00 2001 > From: Spencer Baugh > Date: Fri, 28 Jun 2024 10:00:10 -0400 > Subject: [PATCH] Skip eglot project-name when project-mode-line=t > > Both the eglot mode line entry and project-mode-line add > project-name to the modeline. When both of them are enabled, > this is unnecessary duplication. > > To fix, add the customization eglot-mode-line-project-name to > allow disabling the project-name in eglot's mode-line entry. > > Furthermore, by default, set this customization so that eglot > will check project-mode-line and omit the project-name if > project-mode-line is non-nil. This allows a user to just set > project-mode-line without having to separately customize eglot. > > * lisp/progmodes/eglot.el (eglot-mode-line-project-name): Add. > (eglot--mode-line-format): Check > eglot-mode-line-project-name. (bug#71823) > --- > lisp/progmodes/eglot.el | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > index df4cbe50dc0..60e68b323f6 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -2237,10 +2237,29 @@ eglot--mode-line-props > keymap ,map help-echo ,(concat prepend blurb) > mouse-face mode-line-highlight)))) > > +(defcustom eglot-mode-line-project-name > + (if (version< "30" emacs-version) > + ;; The project mode-line entry was added to `mode-line-format' in > + ;; Emacs 30; before that, `project-mode-line' has no effect. > + 'unless-project-mode-line > + nil) > + "If non-nil, the eglot mode-line entry may contain `project-name'. > + > +If t, the eglot mode-line entry always contains `project-name'; if nil, > +it never contains `project-name'. > + > +If the symbol `unless-project-mode-line', the eglot mode-line entry only > +contains `project-name' if `project-mode-line' is nil. (This avoids > +showing `project-name' in the modeline twice.)") > + > (defun eglot--mode-line-format () > "Compose Eglot's mode-line." > (let* ((server (eglot-current-server)) > (nick (and server (eglot-project-nickname server))) > + (use-nick (cl-case eglot-mode-line-project-name > + (nil nil) > + (unless-project-mode-line (not (bound-and-true-p project-mode-line))) > + (t t))) > (pending (and server (jsonrpc-continuation-count server))) > (last-error (and server (jsonrpc-last-error server)))) > (append > @@ -2253,9 +2272,9 @@ eglot--mode-line-format > (define-key map [mode-line down-mouse-1] eglot-menu) > map))) > (when nick > - `(":" > + `(,(if use-nick ":" "") > ,(propertize > - nick > + (if use-nick nick ":") > 'face 'eglot-mode-line > 'mouse-face 'mode-line-highlight > 'help-echo (format "Project '%s'\nmouse-1: LSP server control menu" nick) > -- > 2.39.3 Joćo, any comments?