help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs 28 trigger after-change-major-mode-hook inside mini buffer


From: Jakub T. Jankiewicz
Subject: Emacs 28 trigger after-change-major-mode-hook inside mini buffer
Date: Sun, 21 Aug 2022 14:22:50 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]