Oleh Krehel [Thu, 5 Mar 2015 20:29:50 +0000 (21:29 +0100)]
hydra-ox.el: Emulate org-mode export dispatch
* hydra-ox.el (hydra-ox): New radiogroup.
(hydra-ox-html): New hydra.
(hydra-ox-latex): New hydra.
(hydra-ox-text): New hydra.
(hydra-ox): New hydra that includes the above three hydras.
(org-mode-map): Add test binding.
Oleh Krehel [Mon, 2 Mar 2015 20:47:50 +0000 (21:47 +0100)]
Add :timeout option to hydra body
* hydra.el (hydra--make-defun): Call `hydra-timeout' with :timeout if
it's given.
(hydra-timer): New var to hold the timer.
(hydra-timeout): New function to call `hydra-keyboard-quit' with delay.
(hydra-keyboard-quit): Cancel `hydra-timeout' timer.
Oleh Krehel [Fri, 27 Feb 2015 18:05:43 +0000 (19:05 +0100)]
Add some features for generating tables
* hydra.el (hydra--pad): New defun.
(hydra--matrix): New defun.
(hydra--cell): New defun.
(hydra--vconcat): New defun.
(hydra-cell-format): New defcustom.
(hydra--table): New defun.
(hydra-reset-radios): New defun.
(defhydra): Allow docstring to be eval-able.
(defhydradio): Don't define `.../reset-radios', instead define
`.../names' that can be passed to `hydra-reset-radios'.
(hydra-multipop): New defmacro.
(hydra--radio): Update the order - the docstring is now a mandatory
second arg, value is the optional third.
Oleh Krehel [Tue, 24 Feb 2015 14:50:49 +0000 (15:50 +0100)]
Don't bind nil heads in outside keymaps
* hydra.el (hydra-exit): New command to be used for nil heads.
(hydra--delete-duplicates): Update for `hydra-exit'.
(defhydra): Don't bind `hydra-exit' in outside keymaps.
Oleh Krehel [Tue, 24 Feb 2015 14:31:46 +0000 (15:31 +0100)]
Improve handling of heads with duplicate cmd
hydra.el (hydra--delete-duplicates): Modify :cmd-name property of
duplicate head to to name of the head that it duplicates.
Heads are considered duplicate if their CMD and COLOR is the same.
The first of the duplicates gets a defun, the rest call it.
* hydra.el (defhydra): Bring heads into a uniform notation. If a
docstring is missing, set it to "". Set :cmd-name property to the
head's name.
Oleh Krehel [Tue, 24 Feb 2015 10:42:00 +0000 (11:42 +0100)]
Simplify the hint part of each head
* hydra.el (defhydra): All heads that don't have a hint, will get "" as
hint. The behavior will remain the same.
(hydra--head-property): Simplify, since plist is now always `cdddr'.
(hydra--hint): Simplify, heads always have length at least 3. Simplify,
third element is always a string or nil.
Oleh Krehel [Mon, 23 Feb 2015 14:12:17 +0000 (15:12 +0100)]
Avoid generating multiple defuns with same name
* hydra.el (hydra--head-name): New defun.
(hydra--delete-duplicates): New defun.
(defhydra): Update to use `hydra--delete-duplicates' and `hydra--head-name'.
Oleh Krehel [Fri, 20 Feb 2015 16:51:52 +0000 (17:51 +0100)]
Improve compatibility for Emacs <= 24.3
* hydra.el (hydra-set-transient-map): Always take 3 arguments.
(hydra--pred): New defun.
(hydra-disable): Update, `overriding-terminal-local-map' is actually
also bound in 24.3.
Oleh Krehel [Fri, 20 Feb 2015 14:41:32 +0000 (15:41 +0100)]
Add an option to fontify heads in a custom way
* hydra.el (hydra--hint): Forward to `hydra-fontify-head'.
(hydra-fontify-head-function): New defvar.
(hydra-fontify-head-default): New defun that represents the classic
fontification behavior.
(hydra-fontify-head): Fontification dispatch - use
`hydra-fontify-head-default'
unless `hydra-fontify-head-function' is set.
(hydra--format): Forward to `hydra-fontify-head'.
Example:
(setq hydra-fontify-head-function
(lambda (head body)
(let ((color (hydra--head-color head body)))
(format
(if (eq color 'blue)
"[%s]"
"{%s}") (car head)))))
Here, ^^^ represent empty characters used to compensate for the fact
that the lengths of variable symbols are different.
You can choose not to use them. The result will be the same, but your
code will look misaligned.
Phillip Lord [Thu, 19 Feb 2015 21:06:58 +0000 (21:06 +0000)]
with-relative-file is now idempotent and tests!
The first version of with-relative-file left a new buffer around, unless
the file was already open, in which case the existing buffer would be
changed. It was all very stateful and this was not very fixable. This
version uses with-temp-buffer instead, so leaves Emacs as it found it.
This does remove the ability to save to the file from within this
buffer.
Oleh Krehel [Thu, 19 Feb 2015 14:56:17 +0000 (15:56 +0100)]
Add teal body color
* hydra.el (hydra-face-teal): New face.
(hydra--face): Update.
(defhydra): Teal color is the same as amaranth, except the heas inherit
blue instead of red.
Oleh Krehel [Thu, 19 Feb 2015 14:48:41 +0000 (15:48 +0100)]
Update faces
* hydra.el (hydra-face-red): Set default to actual color red.
(hydra-face-blue): Set default to actual color blue.
(hydra-face-amaranth): Explain better in the doc.
(hydra-face-pink): Explain better in the doc.
Oleh Krehel [Thu, 19 Feb 2015 14:02:11 +0000 (15:02 +0100)]
Minor refactoring
* hydra.el (hydra--head-color): Rename from `hydra--color'.
(hydra--body-color): New defun.
(hydra--message): First arg isn't pre-processed by `hydra--hint'.
(defhydra): Update call to `hydra-message'.
Oleh Krehel [Thu, 19 Feb 2015 13:19:18 +0000 (14:19 +0100)]
Allow for Ruby-style Hydra docstrings
* hydra.el (hydra--unalias-var): New defun.
(hydra--format): New defun.
(hydra--message): Use `hydra-format' instead of a static string.
Update signature.
(defhydra): Add a warning the pink Hydras can't yet handle unbound
prefix, e.g. "C-x". Update arguments given to `hydra--message'.
* hydra-test.el: Update tests, only hint functions were slightly
affected.
Phillip Lord [Thu, 19 Feb 2015 13:23:16 +0000 (13:23 +0000)]
New functions for opening files.
find-file-noselect-relative opens a file with a relative path.
with-relative-file is a macro that runs in a buffer created with the
contents of the file.