[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cfac8bd 21/27: Prepare for the first version in GNU ELPA
From: |
Oleh Krehel |
Subject: |
[elpa] master cfac8bd 21/27: Prepare for the first version in GNU ELPA |
Date: |
Sat, 24 Jan 2015 20:36:36 +0000 |
branch: master
commit cfac8bd9e73ea1e219250867b22881354fc2d56e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Prepare for the first version in GNU ELPA
hydra.el (hydra-set-transient-map): new alias
`set-transient-map' only works for Emacs>=24.4.
---
README.md | 6 ++--
hydra-examples.el | 22 ++++++++--------
hydra.el | 69 +++++++++++++++++++++++++++-------------------------
3 files changed, 50 insertions(+), 47 deletions(-)
diff --git a/README.md b/README.md
index 5a52369..f7ddd40 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ that disables itself auto-magically.
Here's how I use the examples bundled with Hydra:
(require 'hydra-examples)
- (hydra-create "C-M-w" hydra-example-move-window-splitter)
+ (hydra-create "C-M-y" hydra-example-move-window-splitter)
(hydra-create "M-g" hydra-example-goto-error)
You can expand the examples in-place, it still looks elegant:
@@ -34,7 +34,7 @@ You can use the third optional argument of `hydra-create` for
this (it defaults
Here's an example:
```cl
-(hydra-create "z"
+(hydra-create "C-z"
'(("l" forward-char)
("h" backward-char)
("j" next-line)
@@ -47,7 +47,7 @@ For this simple case, there's even a shortcut: if you give a
keymap as the third
the lambda will be generated for you:
```cl
-(hydra-create "z"
+(hydra-create "C-z"
'(("l" forward-char)
("h" backward-char)
("j" next-line)
diff --git a/hydra-examples.el b/hydra-examples.el
index 98f3310..c07bd8e 100644
--- a/hydra-examples.el
+++ b/hydra-examples.el
@@ -1,22 +1,23 @@
-;;; hydra-examples.el --- some applications for hydra
+;;; hydra-examples.el --- Some applications for Hydra
-;; Copyright (C) 2015 Oleh Krehel
+;; Copyright (C) 2015 Free Software Foundation, Inc.
-;; This file is not part of GNU Emacs
+;; Author: Oleh Krehel
-;; This file is free software; you can redistribute it and/or modify
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
@@ -81,5 +82,4 @@ Works best if you have not more than 4 windows.")
Useful for e.g. `occur', `rgrep' and the like.")
(provide 'hydra-examples)
-
;;; hydra-examples.el ends here
diff --git a/hydra.el b/hydra.el
index 49e78e9..932cea2 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1,27 +1,28 @@
-;;; hydra.el --- make bindings that stick around.
+;;; hydra.el --- Make bindings that stick around
-;; Copyright (C) 2015 Oleh Krehel
+;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Oleh Krehel <address@hidden>
+;; Maintainer: Oleh Krehel <address@hidden>
;; URL: https://github.com/abo-abo/hydra
-;; Version: 0.2.3
-;; Package-Requires: ((cl-lib "0.5"))
+;; Version: 0.3.0
;; Keywords: bindings
+;; Package-Requires: ((cl-lib "0.5"))
-;; This file is not part of GNU Emacs
+;; This file is part of GNU Emacs.
-;; This file is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
@@ -29,31 +30,31 @@
;; short bindings with a common prefix - a Hydra.
;;
;; Once you summon the Hydra (through the prefixed binding), all the
-;; heads can be called in succession with only a short extension. The
-;; Hydra is vanquished once Hercules, any binding that isn't the
+;; heads can be called in succession with only a short extension.
+;; The Hydra is vanquished once Hercules, any binding that isn't the
;; Hydra's head, arrives. Note that Hercules, besides vanquishing the
;; Hydra, will still serve his orignal purpose, calling his proper
;; command. This makes the Hydra very seamless, it's like a minor
;; mode that disables itself automagically.
;;
-;; Here's how I use the examples bundled with Hydra:
+;; Here's how to use the examples bundled with Hydra:
;;
;; (require 'hydra-examples)
-;; (hydra-create "C-M-w" hydra-example-move-window-splitter)
+;; (hydra-create "C-M-y" hydra-example-move-window-splitter)
;; (hydra-create "M-g" hydra-example-goto-error)
;;
;; You can expand the examples in-place, it still looks elegant:
;;
;; (hydra-create "<f2>"
-;; '(("g" text-scale-increase)
-;; ("l" text-scale-decrease)))
+;; '(("g" text-scale-increase "zoom in")
+;; ("l" text-scale-decrease "zoom out")))
+;;
+;; The third element of each list is the optional doc string that will
+;; be displayed in the echo area when `hydra-is-helpful' is t.
;;; Code:
(require 'cl-lib)
-(eval-when-compile
- (require 'cl))
-
(defgroup hydra nil
"Make bindings that stick around."
:group 'bindings
@@ -64,8 +65,13 @@
:type 'boolean
:group 'hydra)
+(defalias 'hydra-set-transient-map
+ (if (fboundp 'set-transient-map)
+ 'set-transient-map
+ 'set-temporary-overlay-map))
+
(defvar hydra-last nil
- "The result of the last `set-transient-map' call.")
+ "The result of the last `hydra-set-transient-map' call.")
;;;###autoload
(defmacro hydra-create (body heads &optional method)
@@ -91,17 +97,15 @@ When `(keymapp METHOD)`, it becomes:
(define-key keymap (kbd (car x))
(intern (format "hydra-%s-%S" body (cadr x)))))
heads))
- (hint (concat "hydra: "
+ (hint (format "hydra: %s."
(mapconcat
(lambda (h)
- (if (caddr h)
- (format "[%s]: %s"
- (propertize (car h)
- 'face
'font-lock-keyword-face)
- (caddr h))
- (propertize (car h) 'face
'font-lock-keyword-face)))
- heads ", ")
- "."))
+ (format
+ (if (cl-caddr h)
+ (concat "[%s]: " (cl-caddr h))
+ "%s")
+ (propertize (car h) 'face 'font-lock-keyword-face)))
+ heads ", ")))
(doc (format
"Create a hydra with a \"%s\" body and the heads:\n\n%s."
body
@@ -133,19 +137,18 @@ When `(keymapp METHOD)`, it becomes:
`((call-interactively #',(cadr head))
(when hydra-is-helpful
(message ,hint))
- (setq hydra-last (set-transient-map ',keymap t))))))
+ (setq hydra-last (hydra-set-transient-map ',keymap
t))))))
heads names)
(defun ,(intern (format "hydra-%s-body" body)) ()
,doc
(interactive)
(when hydra-is-helpful
(message ,hint))
- (setq hydra-last (set-transient-map ',keymap t)))
+ (setq hydra-last (hydra-set-transient-map ',keymap t)))
,@(cl-mapcar
(lambda (head name)
`(,method ,(vconcat (kbd body) (kbd (car head))) #',name))
heads names))))
(provide 'hydra)
-
;;; hydra.el ends here
- [elpa] master b982fe5 14/27: Allow to add one head that disables the Hydra, (continued)
- [elpa] master b982fe5 14/27: Allow to add one head that disables the Hydra, Oleh Krehel, 2015/01/24
- [elpa] master c3ce0a9 15/27: `hydra-create' will also define `hydra-...-body', Oleh Krehel, 2015/01/24
- [elpa] master 8884698 17/27: Don't undefine BODY's map binding when it's a prefix, Oleh Krehel, 2015/01/24
- [elpa] master dfe1273 19/27: Simplify and improve the generated defuns, Oleh Krehel, 2015/01/24
- [elpa] master 301b500 16/27: Don't undefine BODY's global binding when it's a prefix, Oleh Krehel, 2015/01/24
- [elpa] master 42538fa 18/27: Add a `next-error'/`previous-error'/`first-error' example, Oleh Krehel, 2015/01/24
- [elpa] master dc0246e 20/27: hydra-examples.el (hydra-example-goto-error): add doc, Oleh Krehel, 2015/01/24
- [elpa] master ddd96d1 23/27: hydra-examples.el: add a `windmove' Hydra, Oleh Krehel, 2015/01/24
- [elpa] master 64e5b91 22/27: Avoid evaling METHOD., Oleh Krehel, 2015/01/24
- [elpa] master 440c41c 24/27: Bump version, Oleh Krehel, 2015/01/24
- [elpa] master cfac8bd 21/27: Prepare for the first version in GNU ELPA,
Oleh Krehel <=
- [elpa] master 7b78b37 27/27: Merge commit '440c41cc3f5137d694211719abaa38c0193a08a2' from hydra, Oleh Krehel, 2015/01/24
- [elpa] master 685c83b 25/27: Setup git subtree add for hydra, Oleh Krehel, 2015/01/24
- [elpa] master f31d537 26/27: Add 'packages/hydra/' from commit 'cfac8bd9e73ea1e219250867b22881354fc2d56e', Oleh Krehel, 2015/01/24