From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh 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 10:15:45 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25462"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 71823@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 28 16:32:37 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 1sNCeA-0005Yn-Kx for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Jun 2024 16:32:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNCOU-0000y0-SS; Fri, 28 Jun 2024 10:16: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 1sNCOR-0000tF-Lv for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:16:05 -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 1sNCOR-0000x0-3g for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:16:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNCOR-0004nt-76 for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 10:16:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Jun 2024 14:16:03 +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.171958415218427 (code B ref 71823); Fri, 28 Jun 2024 14:16:03 +0000 Original-Received: (at 71823) by debbugs.gnu.org; 28 Jun 2024 14:15:52 +0000 Original-Received: from localhost ([127.0.0.1]:46014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNCOG-0004n9-0S for submit@debbugs.gnu.org; Fri, 28 Jun 2024 10:15:52 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:36549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNCOE-0004mu-Nb for 71823@debbugs.gnu.org; Fri, 28 Jun 2024 10:15:51 -0400 In-Reply-To: (Spencer Baugh's message of "Fri, 28 Jun 2024 10:13:03 -0400") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1719584145; bh=20KvRDlWL2SbLBzVJeMmnXKw7QzSfkyt0AFg3h+VT1U=; h=From:To:Subject:In-Reply-To:References:Date; b=UeJNC0RIa7XMGlkdQbn27pm3RXVDLqq1l5bwHZ2veCs7PxkT3S0VnPUkkNGq579OJ s0nRkta+HBupW3A7wZtfr+kFm2KjpWv5qZrLxYOp0r72Brv8b7WWAQ87gXWcMlo5Ph AKhwCms45hwkxjG1SyqHlEln5ufYXItgN5XYzQ3S/Pj766CaNzSMrJbLMrCXEZZgng /8aRs83PfAHJr4VcyPQNXWjHSAWJpC0t2jqJE43epJbQLcVRrithIdNKfN7LpagZe6 3Li694K1AcqhSYndAqtlbnxvIfIX+xxFk3kRQqZY2TxzkEL3tB7BxfF3yZHeOkWhlu uXaf7icvIKGPA== 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:288074 Archived-At: --=-=-= Content-Type: text/plain Patch fixing this: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Skip-eglot-project-name-when-project-mode-line-t.patch >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 --=-=-=--