unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Jakub T. Jankiewicz" <jcubic@onet.pl>
To: help-gnu-emacs@gnu.org
Subject: Emacs 28 trigger after-change-major-mode-hook inside mini buffer
Date: Sun, 21 Aug 2022 14:22:50 +0200	[thread overview]
Message-ID: <20220821142250.27cb3c84@jcubic> (raw)

Hi all,

I have this in my .emacs file, which break interactive function in Emacs 28.

```lisp
(defun new-line-and-indent-fix ()
  (interactive)
  (newline)
  (indent-for-tab-command))

(defun after-major-mode ()
  (if (memql major-mode '(yaml-mode
                          python-mode
                          nxml-mode
                          lisp-interaction-mode))
      (electric-indent-mode -1))
  (if (not (memql major-mode
                  '(fundamental-mode
                    erc-mode
                    text-mode
                    eshell-mode
                    shell-mode
                    inferior-js-mode
                    nodejs-repl-mode
                    change-log-mode
                    comint-mode
                    lisp-interaction-mode
                    inferior-scheme-mode
                    sql-mode)))
      (progn
        (local-set-key (kbd "RET")
                       'new-line-and-indent-fix))))

(add-hook 'after-change-major-mode-hook 'after-major-mode)
```

I don't remember why exactly I used this code, somehow the auto indent was
not working for me.

When I run interactive function it trigger new-line-and-indent-fix inside
minibuffer which means that after-change-major-mode-hook is triggered inside
mini buffer. Was this change documented?

So to fix the problem I need to know: what type of major mode does the mini
buffer now have in Emacs 28? So I can filter out that major mode.

I'm using:
GNU Emacs 28.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo
version 1.17.6) of 2022-07-15

Thanks,
Jakub

--
Jakub T. Jankiewicz, Senior Front-End Developer
https://jcubic.pl/me



             reply	other threads:[~2022-08-21 12:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21 12:22 Jakub T. Jankiewicz [this message]
2022-08-21 12:29 ` Emacs 28 trigger after-change-major-mode-hook inside mini buffer Eli Zaretskii
2022-08-21 14:20   ` Jakub T. Jankiewicz
2022-08-21 14:37     ` Eli Zaretskii
2022-08-21 14:49     ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-08-21 14:22 ` Stefan Monnier via Users list for the GNU Emacs text editor

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=20220821142250.27cb3c84@jcubic \
    --to=jcubic@onet.pl \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).