-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
;;; encourage.el --- Add a message to minibuffer every time you save a document | ||
|
||
;;; Commentary: | ||
;; Add a message to minibuffer every time you save a document | ||
;; A simple package which is inspired by a neovim plugin at | ||
;; r-cha/encourage.nvim which itself was inspired by a VSCode plugin | ||
;; at nicollasricas/vscode-encourage which was inspired by Visual | ||
;; Studio plugin Haacked.Encourage. | ||
|
||
;;; Code: | ||
(defgroup encourage nil "Encourage customization group." | ||
:group 'tools) | ||
|
||
(defcustom encourage-encouragements | ||
'("Great job! ✨" | ||
"You're doing great! 💪" | ||
"Keep up the good work! 🌟" | ||
"Well done! 🎉" | ||
"Onward and upward! 🚀" | ||
"You're on fire! 🔥" | ||
"You're a star! ⭐️" | ||
"You're amazing! 🌈" | ||
"That was awesome! 🎈" | ||
"Smart move. 🧠" | ||
"Bravo! 👏" | ||
"Nailed it. 🔨") | ||
"List of encouragements to display in the minibuffer." | ||
:type 'list | ||
:group 'encourage) | ||
|
||
(defun save-message () | ||
"Display a message in the minibuffer every time a document is saved." | ||
(let ((egmt (nth (random (length encourage-encouragements)) | ||
encourage-encouragements))) | ||
(if (and (featurep 'posframe) (fboundp 'posframe-show)) | ||
;; Shot at top right of frame | ||
(posframe-show "*encourage*" | ||
:string (concat " " egmt " ") | ||
:timeout 2 | ||
:poshandler 'posframe-poshandler-frame-top-right-corner | ||
:background-color "skyblue" | ||
:foreground-color "white" | ||
:poshandler (lambda (_info) pos)) | ||
(message egmt)))) | ||
|
||
(add-hook 'after-save-hook 'save-message) | ||
|
||
(provide 'encourage) | ||
;;; encourage.el ends here |
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