From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko 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: Tue, 13 Jun 2023 19:36:14 +0000 Message-ID: <87sfavqhn5.fsf@localhost> References: <87a5x3sa7w.fsf@localhost> <83bkhjweco.fsf@gnu.org> <875y7rs5s5.fsf@localhost> <835y7rwbmb.fsf@gnu.org> <87352vs2g5.fsf@localhost> <83wn07usx7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31159"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64048@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 13 21:32:20 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 1q99ka-0007vN-21 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Jun 2023 21:32:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q99kL-0004Xm-6Y; Tue, 13 Jun 2023 15:32:05 -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 1q99kJ-0004Xb-6J for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2023 15:32:03 -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 1q99kI-00043N-UG for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2023 15:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q99kI-0003Kp-EZ for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2023 15:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Jun 2023 19:32:02 +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.168668469412773 (code B ref 64048); Tue, 13 Jun 2023 19:32:02 +0000 Original-Received: (at 64048) by debbugs.gnu.org; 13 Jun 2023 19:31:34 +0000 Original-Received: from localhost ([127.0.0.1]:43085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q99jp-0003Jw-Nc for submit@debbugs.gnu.org; Tue, 13 Jun 2023 15:31:34 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:46613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q99jm-0003Je-RV for 64048@debbugs.gnu.org; Tue, 13 Jun 2023 15:31:32 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5A4A924002E for <64048@debbugs.gnu.org>; Tue, 13 Jun 2023 21:31:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1686684684; bh=ZvTsJO8fkt7crSxKNZx92aO7qqgY0me55LNyZooslGU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=kaHW4ZwGCsChvy+wxVQpD+pam9tEMD/rb97pnopSQ7J/KD+GCeGYedFBRZGm5JncC LpiYXutpPatyuce9tsTa6wPfzZPYFazTiICfDdGpMxWJR3R7nx4vggwJWopoNdt692 bp44TnEPWFlAlxuWE7Ynd3RGTqDvqvsqgTcUrUm0YGKH9A+JvWLCG4lcEcoaDY70Bs 4GI1p1NVD/Z6PQts7q9BczCCZXX/1y5hHC8WmA4kU/Cg6/BUGHa/JC+CULGYhq6Hqg ElmYTxkksVuxwYBuBxlAIa/ouA/A8fTF/1oWraOs4rUo62MqYMkTsqmPUaKTZQONSk FGTSYMatBX1Dw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qgdvv2W3Sz6tvk; Tue, 13 Jun 2023 21:31:23 +0200 (CEST) In-Reply-To: <83wn07usx7.fsf@gnu.org> 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:263345 Archived-At: Eli Zaretskii writes: >> May I rephrase is as a feature request then? >> Like, please add `global-*-modes' customization for modes defined via `define-globalized-minor-mode'? >> Or, at least, add `global-display-line-numbers-modes' customization? > > I'm not against such a feature, not at all. My objection was only to > the particular implementation that you suggested: we cannot suddenly > add a :predicate to a global mode where previously there wasn't one. > People who activate this global mode expect it to be active > everywhere, no questions asked. > (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) :predicate defines the default value of `global-display-line-numbers-modes' variable. 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. >> 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. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at