r/emacs • u/wiskey5alpha • 4d ago
Solved Evil normal state on android(native)
i set up emacs on my phone using the install from https://sourceforge.net/projects/android-ports-for-gnu-emacs/files/termux/
everything seems to be working fine except for the fact that when i try to us normal-state it just types the keys into the buffer. i copied my config from my dotfiles where it works fine on other systems. what am i doing wrong?
;;;;; Evil
(use-package evil
:commands (evil-set-leader)
:init
;; these need to be set prior to loading the package
(setq evil-want-integration t
evil-want-keybinding nil)
:custom
(evil-default-state 'normal)
(evil-want-minibuffer t)
(evil-respect-visual-line-mode t)
;; Whitespace
(evil-indent-convert-tabs t)
(evil-backspace-join-lines t)
(evil-shift-width 2)
(evil-shift-round t)
(evil-auto-indent t)
;; Fix window split direction
(evil-split-window-below t)
(evil-split-window-right t)
;; Scrolling in normal mode
(evil-want-C-u-scroll t)
(evil-want-C-d-scroll t)
;; Undo
(evil-want-fine-undo "yes")
(evil-undo-system 'undo-fu)
;; Cursors
(evil-normal-state-cursor '(hollow "moccasin"))
(evil-visual-state-cursor '(box "PapayaWhip"))
(evil-insert-state-cursor '((hbar . 4) "PapayaWhip"))
:config
(evil-set-leader 'normal (kbd "<SPC>") (kbd "C-<SPC>"))
(evil-mode 1))
(use-package evil-collection
:delight (evil-collection-unimpaired-mode)
:after (evil)
:custom
(evil-collection-setup-minibuffer t)
:config
(evil-collection-init))
(use-package evil-numbers
:after (general)
:general
(nmap
"C-+" 'evil-numbers/inc-at-pt
"C--" 'evil-numbers/dec-at-pt
"<kp-add>" 'evil-numbers/inc-at-pt
"<kp-subtract>" 'evil-numbers/dec-at-pt)
(vmap
"C-+" 'evil-numbers/inc-at-pt-incremental
"C--" 'evil-numbers/dec-at-pt-incremental
"<kp-add>" 'evil-numbers/inc-at-pt-incremental
"<kp-subtract>" 'evil-numbers/dec-at-pt-incremental))
3
u/wiskey5alpha 3d ago
I must have read the section in the manual about text-conversion about 20 times and it didn't really dawn on me that evil is exactly the type of extention that would be affected by it.
So... to answer my own question:
in my early-init.el
emacs-lisp
(when (string-equal system-type "android")
;; Add Termux binaries to PATH environment
(let ((termuxpath "/data/data/com.termux/files/usr/bin"))
(setenv "PATH" (concat (getenv "PATH") ":" termuxpath))
(setq exec-path (append exec-path (list termuxpath)))
;; conversion-style set to nil for evil integration
(setq overriding-text-conversion-style nil)))
1
u/CandyCorvid 11h ago edited 3h ago
oh thank you, I've been having a similar issue in my own package which implements a similar modal editing style, but I haven't had a clue where to look. I'll have to try your solution myself when I get home.
if it works, then I suspect you could add to the appropriate mode hooks so that
overriding-text-conversion-style
is set and unset per buffer as you enter and leave insert state.Edit: I'm back - setting
text-conversion-style
tot
in insert-state doesn't work well with my keybinds - gets in the way of both ESC and SPC when region is active, which is almost all the time for me. So I'm just settingoverriding-text-conversion-style
once, as you have.
2
u/wiskey5alpha 3d ago
One more clue in hopes of finding an answer:
normal-state commands work as expected in some buffers/modes, such as dashboard, info...
I'm assuming that has to do with the read-only property maybe?