Fix kkp, again
This commit is contained in:
parent
4e94728235
commit
32b3042418
16
init.el
16
init.el
@ -409,10 +409,16 @@ directory. Otherwise, run `find-file' on that file."
|
|||||||
(defun my/-kkp-fix-map-y-or-n-p (oldfun &rest args)
|
(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."
|
"Fix `map-y-or-n-p' when used in a terminal with kkp enabled."
|
||||||
(let ((status (kkp--terminal-has-active-kkp-p)))
|
(let ((status (kkp--terminal-has-active-kkp-p)))
|
||||||
(unwind-protect
|
(condition-case err
|
||||||
(progn
|
(progn
|
||||||
(when status (kkp-disable-in-terminal))
|
(when status (kkp-disable-in-terminal))
|
||||||
(apply oldfun args))
|
(apply oldfun args))
|
||||||
|
(quit
|
||||||
|
;; We won't die in this case, so just re-enable kkp
|
||||||
|
(when (and status (not (kkp--terminal-has-active-kkp-p)))
|
||||||
|
(kkp-enable-in-terminal))
|
||||||
|
(signal 'quit nil))
|
||||||
|
(t
|
||||||
(when (and status (not (kkp--terminal-has-active-kkp-p)))
|
(when (and status (not (kkp--terminal-has-active-kkp-p)))
|
||||||
;; this does async stuff that will make kitty send characters after
|
;; this does async stuff that will make kitty send characters after
|
||||||
;; Emacs exits. We prevent that by not re-enabling if this frame (or
|
;; Emacs exits. We prevent that by not re-enabling if this frame (or
|
||||||
@ -424,7 +430,9 @@ directory. Otherwise, run `find-file' on that file."
|
|||||||
(eq func 'server-save-buffers-kill-terminal))
|
(eq func 'server-save-buffers-kill-terminal))
|
||||||
(setq will-die t))))
|
(setq will-die t))))
|
||||||
(unless will-die
|
(unless will-die
|
||||||
(kkp-enable-in-terminal)))))))
|
(kkp-enable-in-terminal))))
|
||||||
|
(when err
|
||||||
|
(signal (car err) (cdr err)))))))
|
||||||
(advice-add #'map-y-or-n-p :around
|
(advice-add #'map-y-or-n-p :around
|
||||||
#'my/-kkp-fix-map-y-or-n-p))
|
#'my/-kkp-fix-map-y-or-n-p))
|
||||||
|
|
||||||
@ -524,7 +532,7 @@ With NO-EDGE, return nil if beg or end fall on the edge of the range."
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
;; this fixes that fact that `thing-at-point-bounds-of-string-at-point'
|
;; this fixes that fact that `thing-at-point-bounds-of-string-at-point'
|
||||||
;; errors if called at the end of the buffer
|
;; errors if called at the end of the buffer
|
||||||
(condition-case _
|
(condition-case nil
|
||||||
(let ((sb (progn (goto-char beg) (bounds-of-thing-at-point thing)))
|
(let ((sb (progn (goto-char beg) (bounds-of-thing-at-point thing)))
|
||||||
(eb (progn (goto-char end) (bounds-of-thing-at-point thing))))
|
(eb (progn (goto-char end) (bounds-of-thing-at-point thing))))
|
||||||
(and sb eb (equal sb eb)
|
(and sb eb (equal sb eb)
|
||||||
@ -1370,7 +1378,7 @@ entry, return nil."
|
|||||||
;; go to top level and check if the character at point is {
|
;; go to top level and check if the character at point is {
|
||||||
(let ((start-pos (point))
|
(let ((start-pos (point))
|
||||||
(last-valid (point)))
|
(last-valid (point)))
|
||||||
(condition-case _
|
(condition-case nil
|
||||||
(while t
|
(while t
|
||||||
(backward-up-list 1 t t)
|
(backward-up-list 1 t t)
|
||||||
(setq last-valid (point)))
|
(setq last-valid (point)))
|
||||||
|
Loading…
Reference in New Issue
Block a user