Fix some more kkp stuff
This commit is contained in:
parent
998d5cf3fa
commit
04fa288627
18
init.el
18
init.el
@ -398,27 +398,27 @@ directory. Otherwise, run `find-file' on that file."
|
||||
(insert-and-inherit char)
|
||||
(setq arg (1- arg))))))
|
||||
(keymap-global-set "C-q" #'my/quoted-insert)
|
||||
(defun my/-kkp-fix-save-some-buffers (oldfun &optional arg pred)
|
||||
"Fix `save-some-buffers' when used in a terminal with kkp enabled."
|
||||
(defun my/-kkp-fix-map-y-or-n-p (oldfun &rest args)
|
||||
"Fix `map-y-or-n-p' when used in a terminal with kkp enabled."
|
||||
(let ((status (kkp--terminal-has-active-kkp-p)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(when status (kkp--terminal-teardown (kkp--selected-terminal)))
|
||||
(funcall oldfun arg pred))
|
||||
(apply oldfun args))
|
||||
(when (and status (not (kkp--terminal-has-active-kkp-p)))
|
||||
;; this does async stuff that will make kitty send characters after
|
||||
;; Emacs exists. We prevent that by not re-enabling if this frame (or
|
||||
;; Emacs exits. We prevent that by not re-enabling if this frame (or
|
||||
;; Emacs) is about to die
|
||||
(let ((will-die-p))
|
||||
(let ((will-die))
|
||||
(mapbacktrace
|
||||
(lambda (_evald func _args _flags)
|
||||
(when (or (eq func 'save-buffers-kill-emacs)
|
||||
(eq func 'server-save-buffers-kill-terminal))
|
||||
(setq will-die-p t))))
|
||||
(unless will-die-p
|
||||
(setq will-die t))))
|
||||
(unless will-die
|
||||
(kkp-enable-in-terminal)))))))
|
||||
(advice-add #'save-some-buffers :around
|
||||
#'my/-kkp-fix-save-some-buffers))
|
||||
(advice-add #'map-y-or-n-p :around
|
||||
#'my/-kkp-fix-map-y-or-n-p))
|
||||
|
||||
;; mozc
|
||||
(require 'mozc nil t)
|
||||
|
Loading…
Reference in New Issue
Block a user