Silence beginning/end-of-line/read-only errors on motions in minibuffer

This commit is contained in:
Henrik Lissner 2018-03-23 02:29:17 -04:00
parent dacf50627c
commit 24043d9bfd
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -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
;;