diff --git a/core/core-ui.el b/core/core-ui.el index 7bbf53f4e..a9451482c 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -320,6 +320,24 @@ with `doom//reload-theme').") (advice-add #'load-theme :after #'doom*load-theme-hooks) +;; +;; Silence motion errors in minibuffer +;; + +(defun doom*silence-motion-errors (orig-fn &rest args) + (if (and (minibufferp) + (<= (point) (minibuffer-prompt-end))) + (progn + (ignore-errors (apply orig-fn args)) + (goto-char (minibuffer-prompt-end))) + (apply orig-fn args))) + +(advice-add #'left-char :around #'doom*silence-motion-errors) +(advice-add #'right-char :around #'doom*silence-motion-errors) +(advice-add #'delete-backward-char :around #'doom*silence-motion-errors) +(advice-add #'backward-kill-sentence :around #'doom*silence-motion-errors) + + ;; ;; Line numbers ;;