emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]