Refactor minibuffer bindings

+ conform their function names to naming conventions
+ place ivy-specific version in ivy autoloads
This commit is contained in:
Henrik Lissner 2017-05-26 11:16:26 +02:00
parent 2cd0818801
commit 41a288d21d
4 changed files with 22 additions and 17 deletions

View file

@ -1,30 +1,25 @@
;;; ../core/autoload/minibuffer.el
;;;###autoload
(defun doom-minibuffer-kill-word ()
(defun doom/minibuffer-kill-word ()
"Kill a word, backwards, but only if the cursor is after
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
monopolizing the minibuffer."
(interactive)
(call-interactively
(cond ((> (point) (minibuffer-prompt-end))
'backward-kill-word)
((and (fboundp 'evil-ex-p) (evil-ex-p))
'evil-ex-delete-backward-char)
(t
'ivy-backward-delete-char))))
(when (> (point) (minibuffer-prompt-end))
(call-interactively #'backward-kill-word)))
;;;###autoload
(defun doom-minibuffer-kill-line ()
(defun doom/minibuffer-kill-line ()
"Kill the entire line, but only if the cursor is after
`minibuffer-prompt-end', to prevent the 'Text is read-only' warning from
monopolizing the minibuffer."
(interactive)
(when (> (point) (minibuffer-prompt-end))
(call-interactively 'backward-kill-sentence)))
(call-interactively #'backward-kill-sentence)))
;;;###autoload
(defun doom-minibuffer-undo ()
(defun doom/minibuffer-undo ()
"Undo an edit in the minibuffer without throwing errors."
(interactive)
(ignore-errors (call-interactively 'undo)))
(ignore-errors (call-interactively #'undo)))