From b14aaf71cb644d5a7ab852d755fa3b9c4c27a36e Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Wed, 21 Aug 2019 11:39:32 +0200 Subject: [PATCH] hydra.el (hydra-lv): Remove obsolete defcustom Fixes #344 --- README.md | 44 ++++++++++++++++++++++++-------------------- hydra-test.el | 6 +++--- hydra.el | 8 -------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 35aedca..074fe8c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ If you want to quickly understand the concept, see [the video demo](https://www. ## The one with the least amount of code -```cl +```elisp (defhydra hydra-zoom (global-map "") "zoom" ("g" text-scale-increase "in") @@ -95,7 +95,7 @@ Here's the result of pressing . in the good-old Buffer menu: The code is large but very simple: -```cl +```elisp (defhydra hydra-buffer-menu (:color pink :hint nil) " @@ -171,22 +171,26 @@ If you name your hydra `hydra-awesome`, the return result of `defhydra` will be Here's what `hydra-zoom/body` looks like, if you're interested: -```cl -(defun hydra-zoom/body nil - "Create a hydra with a \"\" body and the heads: +```elisp +(defun hydra-zoom/body () + "Call the body in the \"hydra-zoom\" hydra. + +The heads for the associated hydra are: \"g\": `text-scale-increase', \"l\": `text-scale-decrease' -The body can be accessed via `hydra-zoom/body'." +The body can be accessed via `hydra-zoom/body', which is bound to \"\"." (interactive) + (require 'hydra) (hydra-default-pre) - (when hydra-is-helpful - (if hydra-lv - (lv-message - (eval hydra-zoom/hint)) - (message - (eval hydra-zoom/hint)))) + (let ((hydra--ignore nil)) + (hydra-keyboard-quit) + (setq hydra-curr-body-fn + 'hydra-zoom/body)) + (hydra-show-hint + hydra-zoom/hint + 'hydra-zoom) (hydra-set-transient-map hydra-zoom/keymap (lambda nil @@ -203,7 +207,7 @@ This can be any keymap, for instance, `global-map` or `isearch-mode-map`. For this example: -```cl +```elisp (defhydra hydra-zoom (global-map "") "zoom" ("g" text-scale-increase "in") @@ -215,7 +219,7 @@ For this example: And here's the relevant generated code: -```cl +```elisp (unless (keymapp (lookup-key global-map (kbd ""))) (define-key global-map (kbd "") nil)) (define-key global-map [f2 103] @@ -229,7 +233,7 @@ As you see, `""` is used as a prefix for g (char value 103) and < If you don't want to use a map right now, you can skip it like this: -```cl +```elisp (defhydra hydra-zoom (nil nil) "zoom" ("g" text-scale-increase "in") @@ -238,7 +242,7 @@ If you don't want to use a map right now, you can skip it like this: Or even simpler: -```cl +```elisp (defhydra hydra-zoom () "zoom" ("g" text-scale-increase "in") @@ -260,7 +264,7 @@ Below is a list of each key. You can specify code that will be called before each head, and after the body. For example: -```cl +```elisp (defhydra hydra-vi (:pre (set-cursor-color "#40e0d0") :post (progn (set-cursor-color "#ffffff") @@ -359,7 +363,7 @@ If the result of the Elisp expression is a string and you don't want to quote it Each head looks like this: -```cl +```elisp (head-binding head-command head-hint head-plist) ``` @@ -392,7 +396,7 @@ The `head-command` can be: Here's an example of the last option: -```cl +```elisp (defhydra hydra-launcher (:color blue) "Launch" ("h" man "man") @@ -411,7 +415,7 @@ You can set the head hint to `nil` to do this. Example: -```cl +```elisp (defhydra hydra-zoom (global-map "") " Press _g_ to zoom in. diff --git a/hydra-test.el b/hydra-test.el index f09689d..69ca77f 100644 --- a/hydra-test.el +++ b/hydra-test.el @@ -1322,9 +1322,9 @@ _f_ auto-fill-mode: %`auto-fill-function '((a b c d) (e f g h) (i nil nil nil))))) (ert-deftest hydra--cell () - (should (equal (hydra--cell "% -75s %%`%s" '(hydra-lv hydra-verbose)) - "When non-nil, `lv-message' (not `message') will be used to display hints. %`hydra-lv^^^^^ -When non-nil, hydra will issue some non essential style warnings. %`hydra-verbose"))) + (should (equal (hydra--cell "% -75s %%`%s" '(hydra-hint-display-type hydra-verbose)) + "The utility to show hydra hint %`hydra-hint-display-type +When non-nil, hydra will issue some non essential style warnings. %`hydra-verbose^^^^^^^^^^"))) (ert-deftest hydra--vconcat () (should (equal (hydra--vconcat '("abc\ndef" "012\n34" "def\nabc")) diff --git a/hydra.el b/hydra.el index 246d3d3..a33be7a 100644 --- a/hydra.el +++ b/hydra.el @@ -253,14 +253,6 @@ the body or the head." (const posframe)) :group 'hydra) -(define-obsolete-variable-alias - 'hydra-lv 'hydra-hint-display-type "0.14.0" - "Use either `hydra-hint-display-type' or `hydra-set-property' :verbosity.") - -(defcustom hydra-lv t - "When non-nil, `lv-message' (not `message') will be used to display hints." - :type 'boolean) - (defcustom hydra-verbose nil "When non-nil, hydra will issue some non essential style warnings." :type 'boolean)