evil icon indicating copy to clipboard operation
evil copied to clipboard

Input method can not be toggled on in `evil-search` on Emacs 28

Open PRESFIL opened this issue 2 years ago • 7 comments

After updating Emacs to the new branch 28, switching the input method stopped working. I rolled back the version to 27 and the input method works correctly. Probably something has been changed in the upstream.

Issue type

  • Bug report

Environment

Emacs version: GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) of 2022-04-04 Operating System: Manjaro Linux 21.2.6 Evil version: 1.14.0 Evil installation type: MELPA Graphical/Terminal: Graphical Tested in a make emacs session: Yes

Reproduction steps

  • Start Emacs 28
  • Switch to buffer
  • Type / to switch to search mode
  • Type English characters to determine input method
  • Try to switch to second imput method with C-\
  • Type characters in this input method
  • English characters are inserted

Expected behavior

The input method should switch as before Emacs 28.

Actual behavior

The input method stopped switching after the Emacs update 27.2.2 -> 28.1

Further notes

PRESFIL avatar Apr 19 '22 16:04 PRESFIL

I checked the issue in the make emacs environment. It is still present.

PRESFIL avatar Apr 21 '22 14:04 PRESFIL

The solution was found for Emacs 28.

For some reason this doesn't work:

;; Emacs Evil mode
(use-package evil
  :ensure t
  :requires
  (undo-tree)
  :init
  (setq-default evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq-default evil-want-keybinding nil)
  :custom
  (evil-undo-system 'undo-tree)
  (evil-search-module 'evil-search)
  :config
  (evil-mode 1))

But this works:

;; Emacs Evil mode
(use-package evil
  :ensure t
  :requires
  (undo-tree)
  :init
  (setq-default evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq-default evil-want-keybinding nil)
  (setq evil-search-module #'evil-search)
  :custom
  (evil-undo-system 'undo-tree)
  :config
  (evil-mode 1))

At the same time, evil-undo-system is customized correctly.

In make emacs environment setq doesn't work:

(setq evil-search-module 'evil-search)

Only customizing variable with stock customize-variable works.

Do you have any ideas?

PRESFIL avatar Apr 23 '22 06:04 PRESFIL

Hmm strange - I would have expected both to work. The official docs do suggest to use evil-select-search-module, but maybe they should be stronger. I assume adding (evil-select-search-module 'evil-search-module 'evil-search) instead also works?

tomdl89 avatar Apr 23 '22 21:04 tomdl89

Evaluating (evil-select-search-module 'evil-search-module 'evil-search) inside :config section works:

Inside `:config` section
;; Emacs Evil mode
(use-package evil
  :ensure t
  :requires
  (undo-tree)
  :init
  (setq-default evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq-default evil-want-keybinding nil)
  :custom
  (evil-undo-system 'undo-tree)
  :config
  (evil-select-search-module 'evil-search-module 'evil-search)
  (evil-mode 1))

But evaluating (evil-select-search-module 'evil-search-module 'evil-search) inside :init section doesn't:

Inside `:init` section
;; Emacs Evil mode
(use-package evil
  :ensure t
  :requires
  (undo-tree)
  :init
  (setq-default evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq-default evil-want-keybinding nil)
  (evil-select-search-module 'evil-search-module 'evil-search)
  :custom
  (evil-undo-system 'undo-tree)
  :config
  (evil-mode 1))

PRESFIL avatar Apr 24 '22 11:04 PRESFIL

That makes sense. As use-package docs say:

Use the :init keyword to execute code before a package is loaded.

And evil-select-search-module won't be available before evil is loaded.

tomdl89 avatar Apr 24 '22 11:04 tomdl89

Yes, but it doesn't work in :custom, but it worked earlier IMHO.

I also noticed that evil-search-modules and evil-select-search-module are not located in evil-vars, but all the others are located there. Perhaps this may explain why :custom works for evil-undo-system, but evil-search-module does not: it is not located in the module that the use-package is acting on in this expression.

Could it have affected?

Functionally, the only benefit over using setq in a :config block is that customizations might execute code when values are assigned.

PRESFIL avatar Apr 24 '22 14:04 PRESFIL

Related:

  • #1571

PRESFIL avatar Apr 24 '22 15:04 PRESFIL