From 62ae30938178e61b08b40aa0b821122d95f93a1e Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 13 Jan 2018 14:19:12 +0100 Subject: [PATCH] =?UTF-8?q?[Misc]=20Enable=20lispy=20in=20=E2=80=98eval-ex?= =?UTF-8?q?pression=E2=80=99=20and=20the=20like=20only=20if=20loaded=20bef?= =?UTF-8?q?orehand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.el | 12 ++++-------- site-lisp/db-utils.el | 10 ++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/init.el b/init.el index d13b11e..16b6936 100644 --- a/init.el +++ b/init.el @@ -613,7 +613,8 @@ _h_ _l_ _o_k _y_ank db/run-or-hide-eshell db/run-or-hide-ansi-term db/helm-shortcuts - db/hex-to-ascii)) + db/hex-to-ascii + conditionally-enable-lispy)) (use-package db-emacsclient) @@ -1046,13 +1047,8 @@ Certificates are assumed to be of the form *.crt." ;; General Stuff first (use-package lispy - :commands (lispy-mode conditionally-enable-lispy) - :diminish lispy-mode - :config (progn - (defun conditionally-enable-lispy () - (when (or (eq this-command 'eval-expression) - (eq this-command 'pp-eval-expression)) - (lispy-mode 1))))) + :commands (lispy-mode) + :diminish lispy-mode) (use-package eldoc :commands (eldoc-mode) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index b66932d..21749a8 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -189,6 +189,16 @@ If not given, FORMAT-STRING defaults to some ISO 8601-like format." (format-time-string (or format-string "%Y-%m-%dT%H:%M:%S.%9NZ") (list h l u p))))) +(defun conditionally-enable-lispy () + "Enable lispy-mode when in `eval-expression’ or in +`pp-eval-expression’. lispy must have been loaded for this +first, i.e., this function will not automatically load +lispy." + (when (and (featurep 'lispy) + (or (eq this-command 'eval-expression) + (eq this-command 'pp-eval-expression))) + (lispy-mode 1))) + ;;; dired