From 4524ea0ed6457e28ae6d3d2e0e8ce0ebfcb0fb82 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 9 Jul 2018 19:41:35 -0700 Subject: [PATCH] Add css-mode hydra --- emacs/.emacs.d/init/oni-css-mode-init.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init/oni-css-mode-init.el b/emacs/.emacs.d/init/oni-css-mode-init.el index 0a57104..f63aae3 100644 --- a/emacs/.emacs.d/init/oni-css-mode-init.el +++ b/emacs/.emacs.d/init/oni-css-mode-init.el @@ -25,6 +25,7 @@ ;;; Code: (require 'css-mode) +(require 'hydra) (eval-when-compile (require 'compile)) (defun oni:css-property-important-p () @@ -51,7 +52,7 @@ (when (re-search-backward " !important" (line-beginning-position) :noerror) (replace-match ""))))) -(defun oni:css-toggle-important () +(defun oni-css-mode-init--toggle-important () "Toggle the important flag on the property on the current line." (interactive) (if (oni:css-property-important-p) @@ -74,7 +75,10 @@ (add-to-list 'compilation-error-regexp-alist (list oni:scss-error-regexp 2 1 nil 2 2))) -(define-key css-mode-map (kbd "C-c !") #'oni:css-toggle-important) +(defhydra css-mode-hydra (:color blue) + ("!" oni-css-mode-init--toggle-important)) + +(define-key css-mode-map (kbd "C-c m") #'css-mode-hydra/body) (provide 'oni-css-mode-init) ;;; oni-css-mode-init.el ends here