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#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled Date: Wed, 14 Jun 2023 14:58:36 +0300 Message-ID: <83mt12uufn.fsf@gnu.org> References: <87a5x3sa7w.fsf@localhost> <83bkhjweco.fsf@gnu.org> <875y7rs5s5.fsf@localhost> <835y7rwbmb.fsf@gnu.org> <87352vs2g5.fsf@localhost> <83wn07usx7.fsf@gnu.org> <87sfavqhn5.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40419"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64048@debbugs.gnu.org To: Ihor Radchenko , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 14 13:59:37 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 1q9PA1-000AMa-CO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Jun 2023 13:59:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9P9U-0001xp-3Y; Wed, 14 Jun 2023 07:59:04 -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 1q9P9S-0001xI-EN for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 07:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9P9S-0001DK-68 for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 07:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q9P9R-0001kD-RL for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2023 07:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Jun 2023 11:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64048 X-GNU-PR-Package: emacs Original-Received: via spool by 64048-submit@debbugs.gnu.org id=B64048.16867439176675 (code B ref 64048); Wed, 14 Jun 2023 11:59:01 +0000 Original-Received: (at 64048) by debbugs.gnu.org; 14 Jun 2023 11:58:37 +0000 Original-Received: from localhost ([127.0.0.1]:43905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9P92-0001ja-ER for submit@debbugs.gnu.org; Wed, 14 Jun 2023 07:58:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9P8q-0001jF-Ay for 64048@debbugs.gnu.org; Wed, 14 Jun 2023 07:58:35 -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 1q9P8j-00015r-00; Wed, 14 Jun 2023 07:58:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=IMwAJxNtad8lctcYmbI/zRNr/Uq1s0RBitkHBohSNUI=; b=Zajx8EEkoVqZ h/RlSpVjj53rC8jQ+iQseMcrukfxoJX9XBnHK0bgce4pQvyfx5QJGploep7k1vKlSLF0XGbftBhyo qKi9eYG4RrzqyVKjIh4zQ32H17HmMpi59GkN2qxsxb/z98dRB4ZjhZJk2M51Y3wWIoK65i1IUP2rw 57V5BlUO/8Ri1YuVXtiPJp5HR5uaU0gpYltOngBNPonHpzIxAc+YCpNwTmEP3zXqLInX4BTYJ1M4D SQJdAa3+cKLf4pWQlqjpUHZ75+iYM2Y3vAMnG8Pf/W/s2YQPpyd/uU43d1Nealalz4Iog5yJAOMVT r/PE491TjEgOjq/1RFc2Hw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q9P8i-0000LD-F8; Wed, 14 Jun 2023 07:58:16 -0400 In-Reply-To: <87sfavqhn5.fsf@localhost> (message from Ihor Radchenko on Tue, 13 Jun 2023 19:36:14 +0000) 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:263366 Archived-At: > From: Ihor Radchenko > Cc: 64048@debbugs.gnu.org > Date: Tue, 13 Jun 2023 19:36:14 +0000 > > Eli Zaretskii writes: > > > (Btw, I don't think I understand the use of :predicate which you > > proposed: it isn't documented as accepting a function, only nil, t, or > > a list of modes.) > > Hmm. You are right, I did not look far enough into the code. > > Let me correct my initial suggestion: > > (define-globalized-minor-mode global-display-line-numbers-mode > display-line-numbers-mode display-line-numbers--turn-on > :predicate t) This change is probably harmless, but OTOH what does it give you that the current code doesn't? AFAIU, you still cannot customize the modes where line numbers will be off. IOW, :predicate is not a means for user customizations of the modes where the minor mode will be turned on. Or am I missing something? > :predicate defines the default value of > `global-display-line-numbers-modes' variable. It does? Where is this documented? > The above code will not change the existing behaviour, except that > `global-display-line-numbers-modes' will be accounted for, iff > customized by the user. Is this behavior documented anywhere? What I see in the docs (both the doc string and the ELisp manual) is that the argument of :predicate determines _statically_ which modes will activate the minor mode. The variable created by :predicate can be used to query Emacs which modes are those, but cannot be used to change which modes do and which don't. If this is not what happens, we have a major mis-documentation on our hands. > >> I recall multiple occasions when I tried hard to disable a global mode > >> in some buffers, remembered that there is some special variable for it; > >> just to find out that a specific global minor mode does not support it. > > > > The usual way of enabling a mode selectively is to enable the > > non-global variant of the mode in a mode hook. I'm sure you know it. > > The use case I am talking about is enabling minor mode everywhere, > except certain major modes. It is more tricky. > > One can, of course, disable the minor mode selectively in some major > modes from that major mode hooks, but it is surprisingly non-obvious > approach. You can either disable it selectively (which is very obvious to me, FWIW), or you can selectively enable it. Both approaches are not rocket science, IMO.