Created
April 16, 2024 18:33
-
-
Save jamescherti/0505d990af3f782b9d3717b6b1a29f76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Description: | |
;; Prevent 'evil-paste-after' and 'evil-paste-before' from failing when the | |
;; paste ring (akin to the clipboard) is empty. | |
;; | |
;; Gits URL: | |
;; License: MIT | |
;; Author: James Cherti | |
(defun ignore-empty-ring-errors (orig-func &rest args) | |
"Ignore errors related to the empty ring when calling ORIG-FUNC with ARGS." | |
(condition-case nil | |
(apply orig-func args) | |
(error (message "Nothing to paste!") nil))) | |
(advice-add 'evil-paste-after :around #'ignore-empty-ring-errors) | |
(advice-add 'evil-paste-before :around #'ignore-empty-ring-errors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment