[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master abef4bf 02/27: Split away the examples
From: |
Oleh Krehel |
Subject: |
[elpa] master abef4bf 02/27: Split away the examples |
Date: |
Sat, 24 Jan 2015 20:36:28 +0000 |
branch: master
commit abef4bfc86aeb53bd477f93259e19386f338381e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Split away the examples
---
hydra-examples.el | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++
hydra.el | 43 +------------------------------
2 files changed, 74 insertions(+), 41 deletions(-)
diff --git a/hydra-examples.el b/hydra-examples.el
new file mode 100644
index 0000000..99cb451
--- /dev/null
+++ b/hydra-examples.el
@@ -0,0 +1,72 @@
+;;; hydra-examples.el --- some applications for hydra
+
+;; Copyright (C) 2015 Oleh Krehel
+
+;; This file is not part of GNU Emacs
+
+;; This file 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.
+
+;; This program 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/>.
+
+
+;;; Commentary:
+;;
+;; These are the sample Hydras that you can use.
+
+;;; Code:
+
+(require 'hydra)
+
+(defvar hydra-example-text-scale
+ '(("g" . text-scale-increase)
+ ("l" . text-scale-decrease))
+ "A two-headed hydra for text scale manipulation.")
+
+(require 'windmove)
+
+(defun hydra-move-splitter-left ()
+ "Move window splitter left."
+ (interactive)
+ (if (windmove-find-other-window 'right)
+ (shrink-window-horizontally 1)
+ (enlarge-window-horizontally 1)))
+
+(defun hydra-move-splitter-right ()
+ "Move window splitter right."
+ (interactive)
+ (if (windmove-find-other-window 'right)
+ (enlarge-window-horizontally 1)
+ (shrink-window-horizontally 1)))
+
+(defun hydra-move-splitter-up ()
+ "Move window splitter up."
+ (interactive)
+ (if (windmove-find-other-window 'up)
+ (enlarge-window 1)
+ (shrink-window 1)))
+
+(defun hydra-move-splitter-down ()
+ "Move window splitter down."
+ (interactive)
+ (if (windmove-find-other-window 'up)
+ (shrink-window 1)
+ (enlarge-window 1)))
+
+(defvar hydra-example-move-window-splitter
+ '(("h" . hydra-move-splitter-left)
+ ("j" . hydra-move-splitter-down)
+ ("k" . hydra-move-splitter-up)
+ ("l" . hydra-move-splitter-right)))
+
+(provide 'hydra-examples)
+
+;;; hydra-examples.el ends here
diff --git a/hydra.el b/hydra.el
index 2cfcc53..14b1282 100644
--- a/hydra.el
+++ b/hydra.el
@@ -37,6 +37,7 @@
;;
;; Here's how I use the examples bundled with Hydra:
;;
+;; (require 'hydra-examples)
;; (hydra-create "C-M-w" hydra-example-move-window-splitter)
;;
;; You can expand the examples in-place, it still looks elegant:
@@ -47,6 +48,7 @@
;;; Code:
+;;;###autoload
(defmacro hydra-create (body heads)
"Create a hydra with a BODY prefix and HEADS.
This will result in `global-set-key' statements with the keys
@@ -91,47 +93,6 @@ Call the head: `%S'."
`(global-set-key ,(kbd (concat body " " (car head))) #',name))
heads names))))
-(defvar hydra-example-text-scale
- '(("g" . text-scale-increase)
- ("l" . text-scale-decrease))
- "A two-headed hydra for text scale manipulation.")
-
-(require 'windmove)
-
-(defun move-splitter-left ()
- "Move window splitter left."
- (interactive)
- (if (windmove-find-other-window 'right)
- (shrink-window-horizontally 1)
- (enlarge-window-horizontally 1)))
-
-(defun move-splitter-right ()
- "Move window splitter right."
- (interactive)
- (if (windmove-find-other-window 'right)
- (enlarge-window-horizontally 1)
- (shrink-window-horizontally 1)))
-
-(defun move-splitter-up ()
- "Move window splitter up."
- (interactive)
- (if (windmove-find-other-window 'up)
- (enlarge-window 1)
- (shrink-window 1)))
-
-(defun move-splitter-down ()
- "Move window splitter down."
- (interactive)
- (if (windmove-find-other-window 'up)
- (shrink-window 1)
- (enlarge-window 1)))
-
-(defvar hydra-example-move-window-splitter
- '(("h" . move-splitter-left)
- ("j" . move-splitter-down)
- ("k" . move-splitter-up)
- ("l" . move-splitter-right)))
-
(provide 'hydra)
;;; hydra.el ends here
- [elpa] master updated (c7f675e -> 7b78b37), Oleh Krehel, 2015/01/24
- [elpa] master 916a130 05/27: Depend on cl-lib v0.5 for `cl-mapcar', Oleh Krehel, 2015/01/24
- [elpa] master a179f31 04/27: Unbind hydra's body unconditionally to avoid error, Oleh Krehel, 2015/01/24
- [elpa] master abef4bf 02/27: Split away the examples,
Oleh Krehel <=
- [elpa] master 2a367fa 03/27: README.md: update doc, Oleh Krehel, 2015/01/24
- [elpa] master f55c1ff 07/27: Add `hydra-is-helpful' custom var, Oleh Krehel, 2015/01/24
- [elpa] master 9b86656 01/27: Initial import, Oleh Krehel, 2015/01/24
- [elpa] master 6966e14 11/27: Fix the bugged `global-set-key' version, Oleh Krehel, 2015/01/24
- [elpa] master 11323ec 06/27: Allow to use minor-mode-maps and more, Oleh Krehel, 2015/01/24
- [elpa] master dbd77f0 09/27: Don't unbind hydra's body, unless using global-set-key, Oleh Krehel, 2015/01/24
- [elpa] master 998b533 10/27: Make sure `windmove-wrap-around' is nil during tests, Oleh Krehel, 2015/01/24
- [elpa] master 5318fc3 08/27: Update `hydra-create' format, Oleh Krehel, 2015/01/24
- [elpa] master e156bf2 12/27: Require cl at compile time, Oleh Krehel, 2015/01/24
- [elpa] master 69bb4a4 13/27: Fix `kbd' interpretting "<tab>" char-by-char, Oleh Krehel, 2015/01/24