hydra.el (hydra-lv): Remove obsolete defcustom

Fixes #344
master
Oleh Krehel 7 years ago
parent a91dd72529
commit b14aaf71cb
  1. 44
      README.md
  2. 6
      hydra-test.el
  3. 8
      hydra.el

@ -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 ## The one with the least amount of code
```cl ```elisp
(defhydra hydra-zoom (global-map "<f2>") (defhydra hydra-zoom (global-map "<f2>")
"zoom" "zoom"
("g" text-scale-increase "in") ("g" text-scale-increase "in")
@ -95,7 +95,7 @@ Here's the result of pressing <kbd>.</kbd> in the good-old Buffer menu:
The code is large but very simple: The code is large but very simple:
```cl ```elisp
(defhydra hydra-buffer-menu (:color pink (defhydra hydra-buffer-menu (:color pink
:hint nil) :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: Here's what `hydra-zoom/body` looks like, if you're interested:
```cl ```elisp
(defun hydra-zoom/body nil (defun hydra-zoom/body ()
"Create a hydra with a \"<f2>\" body and the heads: "Call the body in the \"hydra-zoom\" hydra.
The heads for the associated hydra are:
\"g\": `text-scale-increase', \"g\": `text-scale-increase',
\"l\": `text-scale-decrease' \"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 \"<f2>\"."
(interactive) (interactive)
(require 'hydra)
(hydra-default-pre) (hydra-default-pre)
(when hydra-is-helpful (let ((hydra--ignore nil))
(if hydra-lv (hydra-keyboard-quit)
(lv-message (setq hydra-curr-body-fn
(eval hydra-zoom/hint)) 'hydra-zoom/body))
(message (hydra-show-hint
(eval hydra-zoom/hint)))) hydra-zoom/hint
'hydra-zoom)
(hydra-set-transient-map (hydra-set-transient-map
hydra-zoom/keymap hydra-zoom/keymap
(lambda nil (lambda nil
@ -203,7 +207,7 @@ This can be any keymap, for instance, `global-map` or `isearch-mode-map`.
For this example: For this example:
```cl ```elisp
(defhydra hydra-zoom (global-map "<f2>") (defhydra hydra-zoom (global-map "<f2>")
"zoom" "zoom"
("g" text-scale-increase "in") ("g" text-scale-increase "in")
@ -215,7 +219,7 @@ For this example:
And here's the relevant generated code: And here's the relevant generated code:
```cl ```elisp
(unless (keymapp (lookup-key global-map (kbd "<f2>"))) (unless (keymapp (lookup-key global-map (kbd "<f2>")))
(define-key global-map (kbd "<f2>") nil)) (define-key global-map (kbd "<f2>") nil))
(define-key global-map [f2 103] (define-key global-map [f2 103]
@ -229,7 +233,7 @@ As you see, `"<f2>"` is used as a prefix for <kbd>g</kbd> (char value 103) and <
If you don't want to use a map right now, you can skip it like this: If you don't want to use a map right now, you can skip it like this:
```cl ```elisp
(defhydra hydra-zoom (nil nil) (defhydra hydra-zoom (nil nil)
"zoom" "zoom"
("g" text-scale-increase "in") ("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: Or even simpler:
```cl ```elisp
(defhydra hydra-zoom () (defhydra hydra-zoom ()
"zoom" "zoom"
("g" text-scale-increase "in") ("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: 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") (defhydra hydra-vi (:pre (set-cursor-color "#40e0d0")
:post (progn :post (progn
(set-cursor-color "#ffffff") (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: Each head looks like this:
```cl ```elisp
(head-binding head-command head-hint head-plist) (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: Here's an example of the last option:
```cl ```elisp
(defhydra hydra-launcher (:color blue) (defhydra hydra-launcher (:color blue)
"Launch" "Launch"
("h" man "man") ("h" man "man")
@ -411,7 +415,7 @@ You can set the head hint to `nil` to do this.
Example: Example:
```cl ```elisp
(defhydra hydra-zoom (global-map "<f2>") (defhydra hydra-zoom (global-map "<f2>")
" "
Press _g_ to zoom in. Press _g_ to zoom in.

@ -1322,9 +1322,9 @@ _f_ auto-fill-mode: %`auto-fill-function
'((a b c d) (e f g h) (i nil nil nil))))) '((a b c d) (e f g h) (i nil nil nil)))))
(ert-deftest hydra--cell () (ert-deftest hydra--cell ()
(should (equal (hydra--cell "% -75s %%`%s" '(hydra-lv hydra-verbose)) (should (equal (hydra--cell "% -75s %%`%s" '(hydra-hint-display-type hydra-verbose))
"When non-nil, `lv-message' (not `message') will be used to display hints. %`hydra-lv^^^^^ "The utility to show hydra hint %`hydra-hint-display-type
When non-nil, hydra will issue some non essential style warnings. %`hydra-verbose"))) When non-nil, hydra will issue some non essential style warnings. %`hydra-verbose^^^^^^^^^^")))
(ert-deftest hydra--vconcat () (ert-deftest hydra--vconcat ()
(should (equal (hydra--vconcat '("abc\ndef" "012\n34" "def\nabc")) (should (equal (hydra--vconcat '("abc\ndef" "012\n34" "def\nabc"))

@ -253,14 +253,6 @@ the body or the head."
(const posframe)) (const posframe))
:group 'hydra) :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 (defcustom hydra-verbose nil
"When non-nil, hydra will issue some non essential style warnings." "When non-nil, hydra will issue some non essential style warnings."
:type 'boolean) :type 'boolean)

Loading…
Cancel
Save