From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38111: 27.0.50; globalized-minor-mode not enabled on get-buffer-create Date: Sun, 08 Dec 2019 00:56:00 +0200 Message-ID: <87fthvhhj3.fsf@mail.linkov.net> References: <87sgmzqs5z.fsf@mail.linkov.net> <83y2wqd7ec.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="217016"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 38111@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 08 03:23:05 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1idmDw-000uJx-5Q for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Dec 2019 03:23:04 +0100 Original-Received: from localhost ([::1]:54784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idmDt-0008RS-4O for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Dec 2019 21:23:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49214) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idmBI-0008HH-72 for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2019 21:20:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idmB4-0005Im-Uf for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2019 21:20:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43962) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1idmB0-0005En-Gw for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2019 21:20:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1idmB0-0003WW-Cn for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2019 21:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2019 02:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38111 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 38111-submit@debbugs.gnu.org id=B38111.157577159013516 (code B ref 38111); Sun, 08 Dec 2019 02:20:02 +0000 Original-Received: (at 38111) by debbugs.gnu.org; 8 Dec 2019 02:19:50 +0000 Original-Received: from localhost ([127.0.0.1]:49933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1idmAo-0003Vv-04 for submit@debbugs.gnu.org; Sat, 07 Dec 2019 21:19:50 -0500 Original-Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:8273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1idmAk-0003Vh-Mp; Sat, 07 Dec 2019 21:19:48 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 926FD6A1323; Sat, 7 Dec 2019 22:57:48 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com (100-96-92-172.trex.outbound.svc.cluster.local [100.96.92.172]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 11A416A089C; Sat, 7 Dec 2019 22:57:48 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sat, 07 Dec 2019 22:57:48 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Drop-Plucky: 16337ef4422dc416_1575759468306_2868804160 X-MC-Loop-Signature: 1575759468306:2016089413 X-MC-Ingress-Time: 1575759468306 Original-Received: from pdx1-sub0-mail-a51.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTP id 9477183626; Sat, 7 Dec 2019 14:57:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=svdNZtGomr0CYMdaOlSko2kKDv8=; b= KWMy4kMy28WzO25L9fha4ICXMe6HiPsvrJmLIk+0IN7OtIaFVedLJGyqgSHd7FeW czAtvx2I3b6hyLEAY2JKbbu6xLBHJ4PL14AMYJh/EIrIQ2H2gpvRnBvhboooeNEt 7Xve1qm8FVt3ckYf2f+Ei90WcE/rbE/16/ySl53MEt8= Original-Received: from mail.jurta.org (m91-129-96-42.cust.tele2.ee [91.129.96.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTPSA id 731BC85749; Sat, 7 Dec 2019 14:57:38 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a51 In-Reply-To: (Phil Sainty's message of "Wed, 13 Nov 2019 11:42:07 +1300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172993 Archived-At: reopen 38111 tags 38111 - notabug quit >> Sounds like globalized-minor-mode machinery somehow doesn't support >> the latter method of creating a buffer? > > Yep, globalized modes use `after-change-major-mode-hook' to call the > buffer-local minor mode, and that hook is not triggered in these cases > because, although new buffers are in `fundamental-mode' by default, > the `fundamental-mode' function is not actually called, and so no mode > change occurs. > > I believe this has cropped up in past discussion, but I don't recall > where offhand. > > I agree that it's surprising when you are expecting the global mode(s) > to be enabled (I first realised it when attempting to use a globalized > mode for my custom key bindings, and discovering they were not being > enabled in various buffers). > > If this were changed then there *might* be undesirable consequences to > having lots of created-behind-the-scenes buffers suddenly doing things > they never did before. Actually that turned out to be a problem in practice, e.g. with this recipe: 0. emacs -Q 1. M-x global-display-fill-column-indicator-mode RET 2. M-& ls -la RET ;; or any other command that produces enough lines 3. observe that the global mode is activated in the output buffer 4. M-! ls -la RET 5. the global mode is NOT activated in the output buffer The difference between these two is that shell-command-on-region uses just (get-buffer-create "*Shell Command Output*") and doesn't set its default fundamental-mode explicitly. The following patch fixes this, but I'm still not sure if we need to grep all occurrences of get-buffer-create and add set-buffer-major-mode everywhere? diff --git a/lisp/simple.el b/lisp/simple.el index 67ddab3d34..1c4fdf9945 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3925,6 +3926,7 @@ shell-command-on-region ;; replacing its entire contents. (let ((buffer (get-buffer-create (or output-buffer "*Shell Command Output*")))) + (set-buffer-major-mode buffer) (unwind-protect (if (and (eq buffer (current-buffer)) (or (not shell-command-dont-erase-buffer)