unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Platon Pronko <platon7pronko@gmail.com>
Cc: 45792@debbugs.gnu.org
Subject: bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
Date: Sun, 31 Jan 2021 17:01:40 +0000	[thread overview]
Message-ID: <YBbidBZyewiDTM8D@ACM> (raw)
In-Reply-To: <81a72c8d-b92c-2eea-5ef3-ec4988634095@gmail.com>

Hello, Platon.

On Sun, Jan 31, 2021 at 15:11:11 +0300, Platon Pronko wrote:
> Hi!

> Tested the commit, the issue is gone - both with and without (not
> (minibufferp)).

Thanks!  I'll mark the bug as closed, just as soon as your other
observation has been dealt with.

> However I noticed that (minibufferp) can return nil when it is called
> on *Minibuf-1* (I noticed this when suddenly dvorak was enabled in
> minibuffer even though (not (minibufferp)) guard was still in the
> code).

> Here's some debug code I used to check minibufferp return:

> (define-minor-mode dvorak-minor-mode "Use english-dvorak input method." :lighter nil
>    (message (format "%s %s" (buffer-name (current-buffer)) (minibufferp)))
>    (if (and dvorak-minor-mode (not (minibufferp)))
>      (activate-input-method "english-dvorak")))
> (define-global-minor-mode global-dvorak-mode dvorak-minor-mode dvorak-minor-mode)
> (global-dvorak-mode t)

> And here's sample output in the *Message* buffer:

> For information about GNU Emacs and the GNU system, type C-h C-a.
> *scratch* nil
> Loading quail/latin-post...done
>   *Minibuf-0* t
> *Messages* nil
>   *Echo Area 0* nil
>   *Echo Area 1* nil
>   *load* nil
>   *Minibuf-1* nil  <<-- here it thinks that Minibuf-1 is not a minibuffer
>   *Minibuf-0* t

> Is this supposed to happen?

No, it is most definitely not, and well done for spotting it.  It's
taken me most of the afternoon to fix it, and I still don't understand
fully what's causing it.

But, basically, the minibuffers are kept on a Lisp list, one minibuffer
per recursive depth.  They are nconc'd onto the end of the list as they
are created, and minibufferp works by seeing if the buffer is a member
of this list.

Before my fix, the major mode of the newly created minibuffer was
getting set before it was in its place on the list.  I presume something
in this major mode setting was trying to get a minibuffer, for some
reason, when the minibuffer list was not in a consistent state.

I've changed the order of these operations, so that the new minibuffer
is firmly in the list before its mode gets set.  The problem appears to
have been fixed.

Give me half an hour (or so), and I will have committed this fix to the
Emacs repository master branch.

Again, thanks for spotting such an obscure bug.

> Best regards,
> Platon Pronko

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2021-01-31 17:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 16:09 bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file Platon Pronko
2021-01-12  9:06 ` martin rudalics
2021-01-12 10:29   ` Platon Pronko
2021-01-12 19:00 ` Alan Mackenzie
2021-01-16 16:36 ` Alan Mackenzie
2021-01-17  7:50   ` Platon Pronko
2021-01-30 18:35     ` Alan Mackenzie
2021-01-31  8:54       ` Platon Pronko
2021-01-31 11:50         ` Alan Mackenzie
2021-01-31 12:11           ` Platon Pronko
2021-01-31 17:01             ` Alan Mackenzie [this message]
2021-01-31 19:37               ` Platon Pronko
2021-01-31 20:06                 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YBbidBZyewiDTM8D@ACM \
    --to=acm@muc.de \
    --cc=45792@debbugs.gnu.org \
    --cc=platon7pronko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).