From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Sheng Yang" Newsgroups: gmane.emacs.bugs Subject: bug#47150: 28.0.50; Incorrect major-mode in minibuffer Date: Mon, 15 Mar 2021 13:15:02 -0500 Message-ID: <40f3c845-ba30-4112-bb3c-9c06c1f106d3@www.fastmail.com> References: <877dm9nsii.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=9d45e26453b1409292122bd5e766879b Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13901"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-206-g078a48fda5-fm-20210226.001-g078a48fd Cc: 47150@debbugs.gnu.org To: "Alan Mackenzie" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 15 19:39:41 2021 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 1lLs7v-0003V0-O2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Mar 2021 19:39:40 +0100 Original-Received: from localhost ([::1]:33910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLs7u-0004y4-Oy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Mar 2021 14:39:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrl6-0003g7-2B for bug-gnu-emacs@gnu.org; Mon, 15 Mar 2021 14:16:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLrl4-0005iR-32 for bug-gnu-emacs@gnu.org; Mon, 15 Mar 2021 14:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLrl3-00050D-VR for bug-gnu-emacs@gnu.org; Mon, 15 Mar 2021 14:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Sheng Yang" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Mar 2021 18:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47150 X-GNU-PR-Package: emacs Original-Received: via spool by 47150-submit@debbugs.gnu.org id=B47150.161583213519190 (code B ref 47150); Mon, 15 Mar 2021 18:16:01 +0000 Original-Received: (at 47150) by debbugs.gnu.org; 15 Mar 2021 18:15:35 +0000 Original-Received: from localhost ([127.0.0.1]:36976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLrkc-0004zR-E1 for submit@debbugs.gnu.org; Mon, 15 Mar 2021 14:15:35 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:47431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLrkZ-0004zC-Kc for 47150@debbugs.gnu.org; Mon, 15 Mar 2021 14:15:32 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id E876F2754; Mon, 15 Mar 2021 14:15:24 -0400 (EDT) Original-Received: from imap2 ([10.202.2.52]) by compute6.internal (MEProxy); Mon, 15 Mar 2021 14:15:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm2; bh=Ol6qxcGayOyCw9+GdhIKlcyg7VS1fUv 1K6QwRlWpfgs=; b=mWPXEtDdKeLixDwdtTlc65VePfOt/ko7GhRGizrc5d+O36D tc3hY8DfLvgX3WOsmgNzkumN3FCotFJ2/YxSWnmUJ1FeHUEu8Z+4fLZPgFWSpe6I l7v/Qn31yjaJ5Z3Hzr5OZqf6l81GrIuYY/oCgwFeE2uYjLEUDcntu9xFkgnmSK8r oFy5vHBF/iLp1h8v2vABRCQ3bP3AfE4RaSNkhVu+wXLruNpF2FD9U0cnzWwZRUQ6 yOC8Mb+qbr4nsj2eo3yByh9PYdENTU347rX542g9Oq0CROGJRe1Ir78bi5cj7a7j hwqEbjGEqgawJsxHRFVZYqAYRIel0tO4yVKKKQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Ol6qxc GayOyCw9+GdhIKlcyg7VS1fUv1K6QwRlWpfgs=; b=Vy+L64YN2+z7koJfDpYEiO pJ9DdF6H/zIU2vwvIUxdy0pTVlBlCqz4JhyyaDIK+mgy2psZR+wGsdSr4vf+A7Cs 909iHq1Q1JLO+Q2G8uzKt036BKw8vhy/5cyCtYP2xmk1QLNTFHMj1QVdf4LZI4aU J55s37L1IVbleS3AJ4JU+VWT+hl2F3/UjkHNO+jX8WbXAuSGBtgxi5mNmnV7FxQd tNpHd5Ed/ZNMphru0I1wZWMM67bBwo4R6/hn2lCoby9RAbxqo7dRUaY7j79lFOaK tn0b/TzfzKvmfPTzRiwzxWSc0QBUuZIp/FIFlTKjl7F23h1W5veehdL5tVfS00dw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesrg dtreerreerjeenucfhrhhomhepfdfuhhgvnhhgucgjrghnghdfuceoshhthigrnhhgsehf rghsthhmrghilhdrtghomheqnecuggftrfgrthhtvghrnhepheeluedtudffffegffeile ettedvudeihefhvefgvdeivddttdeifeeigeegveejnecuvehluhhsthgvrhfuihiivgep udenucfrrghrrghmpehmrghilhhfrhhomhepshhthigrnhhgsehfrghsthhmrghilhdrtg homh X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id EE17DA00073; Mon, 15 Mar 2021 14:15:23 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: 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" Xref: news.gmane.io gmane.emacs.bugs:202423 Archived-At: --9d45e26453b1409292122bd5e766879b Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Alan, On Mon, Mar 15, 2021, at 02:59, Alan Mackenzie wrote: > Why is fundamental-mode incorrect for a minibuffer, and what should th= e > major mode be instead? >=20 > What problems does fundamental-mode give you in a minibuffer? The word "correct" here has a two-fold meaning, 1) the design itself is = good (whether it is good can be discussed), 2) the behavior is as intend= ed. For the first point, I think before the offending commit, the major-mode= of a minibuffer is minibuffer-inactive-mode. I am not aware of the reas= ons behind the decision, but it seems a reasonable choice. We do not nee= d a reason to keep the existing decision, but we do need an explanation = for a decision to change it to fundamental-mode. Anyway, I would give a = few points for keeping the major-mode as minibuffer-inactive-mode:=20 1. Packages depend on it, to name a few: lispy, smartparens, and telega.= 2. We do need something to check that we are in the minibuffer, and appl= y something. For my case, I want automatic paren pairing and editing in = eval-expression. Plus we also need a keymap for it, which is minibuffer-= inative-mode-map. We can use (minibufferp), but this will prevent the ex= isting use of *-global-modes in packages to decide whether to enable in = the minibuffer. 3. The choice of minibuffer-inactive-mode is written in elisp manual. I = believe any changes that breaks backward compatibility needs a sound rea= son. If you are aware of a thread on an explanation for the decision to switc= h to fundamantal-mode, please send me a pointer. For the second point, the new behavior seems not intended according to t= he commit message of the offending commit. Here is the whole commit mess= age of 636ef445af: > With minibuffer-follows-selected-frame `hybrid', preserve recursiv= e Mbuffers > =20 > ...when enable-recursive-minibuffers is non-nil, and several minib= uffers are > activated from different frames. Also set the major mode of a reu= sed active > minibuffer to `fundamental-mode' - up till now it's been > minibuffer-inactive-mode. > =20 > * src/minibuf.c (read_minibuf): with the indicated settings of var= iables, > "stack up" all containing minibuffers on the mini-window of the cu= rrent > frame. Delete another, now superfluous such stacking up. > (set_minibuffer_mode): New function. > (get_minibuffer): Call the above new function (twice), in place of= inline > code, ensuring active minibuffers are never left in minibuffer-ina= ctive-mode. At the point of reporting the bug, I thought the change of major mode on= ly applies when you have minibuffer-follows-selected-frame set to `hybir= d'. I am less sure about this understanding now. Currently, from what I = understand, it is only when we reuse an active minibuffer when we have f= undamental-mode set as major mode. However, with a single buffer, and th= e first interactive usage of the minibuffer by pressing M-:, the major-m= ode is reported as fundamental-mode, instead of minibuffer-inactive-mode= , as in Emacs 27.1. What does a "reuse" means here? I am not sure I understand the differences between an active and inactiv= e minibuffer, and the elisp manual does not really help me much. It seem= s to me the minibuffer is alwals inactive? I tried M-x, M-!, M-:, all re= ports minibuffer-inactive-mode in Emacs 27.1. Is this a mistake and the= offending commit was trying to fix this inconsistency? > > 3. Press M-; to call eval-expression, which will report that the maj= or-mode is fundamental-mode Typo fix: to call eval-expression, the key-binding is `M-:' instead of `= M-:' Sheng Yang(=E6=9D=A8=E5=9C=A3), PhD Computer Science Department University of Maryland, College Park E-mail: styang@fastmail.com E-mail (old but still used): yangsheng6810@gmail.com --9d45e26453b1409292122bd5e766879b Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Alan,

On Mon, Mar 15, 2021, at 02:59, Alan Mackenzie wr= ote:
Why is= fundamental-mode incorrect for a minibuffer, and what should the
major mode be instead?

What problem= s does fundamental-mode give you in a minibuffer?
=

The word "correct" here has a two-fold meaning, 1) t= he design itself is good (whether it is good can be discussed), 2) the b= ehavior is as intended.

For the first point= , I think before the offending commit, the major-mode of a minibuffer is= minibuffer-inactive-mode. I am not aware of the reasons behind the deci= sion, but it seems a reasonable choice. We do not need a reason to keep = the existing decision, but we do need an explanation for a decision to c= hange it to fundamental-mode. Anyway, I would give a few points for keep= ing the major-mode as minibuffer-inactive-mode:
1. Packag= es depend on it, to name a few: lispy, smartparens, and telega.
2. We do need something to check that we are in the minibuffer, an= d apply something. For my case, I want automatic paren pairing and editi= ng in eval-expression. Plus we also need a keymap for it, which is minib= uffer-inative-mode-map. We can use (minibufferp), but this will prevent = the existing use of *-global-modes in packages to decide whether to enab= le in the minibuffer.
3. The choice of minibuffer-inactive= -mode is written in elisp manual. I believe any changes that breaks back= ward compatibility needs a sound reason.

If= you are aware of a thread on an explanation for the decision to switch = to fundamantal-mode, please send me a pointer.

<= div>For the second point, the new behavior seems not intended according = to the commit message of the offending commit. Here is the whole commit = message of 636ef445af:
 &nb= sp;  With minibuffer-follows-selected-frame `hybrid', preserve recu= rsive Mbuffers
   
 &nbs= p;  ...when enable-recursive-minibuffers is non-nil, and several mi= nibuffers are
    activated from different = frames.  Also set the major mode of a reused active
&= nbsp;   minibuffer to `fundamental-mode' - up till now it's be= en
    minibuffer-inactive-mode.
<= div>   
    * src/minibuf.c = (read_minibuf): with the indicated settings of variables,
=     "stack up" all containing minibuffers on the mini-win= dow of the current
    frame.  Delete = another, now superfluous such stacking up.
  &nb= sp; (set_minibuffer_mode): New function.
   = ; (get_minibuffer): Call the above new function (twice), in place of inl= ine
    code, ensuring active minibuffers a= re never left in minibuffer-inactive-mode.

At the point of reporting the bug, I thought the= change of major mode only applies when you have minibuffer-follows-sele= cted-frame set to `hybird'. I am less sure about this understanding now.= Currently, from what I understand, it is only when we reuse an active m= inibuffer when we have fundamental-mode set as major mode. However, with= a single buffer, and the first interactive usage of the minibuffer by p= ressing M-:, the major-mode is reported as fundamental-mode, instead of = minibuffer-inactive-mode, as in Emacs 27.1. What does a "reuse" means he= re?

I am not sure I understand the differen= ces between an active and inactive minibuffer, and the elisp manual does= not really help me much. It seems to me the minibuffer is alwals inacti= ve? I tried M-x, M-!, M-:, all reports minibuffer-inactive-mode in Emacs= 27.1.  Is this a mistake and the offending commit was trying to fi= x this inconsistency?

> 3. Press M-; to call eval-expression, whi= ch will report that the major-mode is fundamental-mode

Typo fix: to call eval-expression, the key-binding is `= M-:' instead of `M-:'

Sheng Yang(=E6=9D=A8=E5=9C=A3), PhD
Computer Science Department
University of Maryland, College Park
E-mail (old but still used): yangsheng6810@gmail.com


--9d45e26453b1409292122bd5e766879b--