Add ui/hydra module

And conforms all existing hydras to the naming convention for
interactive commands, e.g.

  +vc-gutter-hydra -> +vc/gutter-hydra
This commit is contained in:
Henrik Lissner 2019-07-22 22:49:27 +02:00
parent 388267d256
commit d7ed52f3c7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
14 changed files with 116 additions and 105 deletions

View file

@ -55,7 +55,7 @@ Change ~+ein-notebook-dir~ to tell ein where to find your Jupityr notebooks.
#+END_SRC
** Using hydra
This module provides a batteries-included hydra - ~+ein-hydra~ - to make using ein
This module provides a batteries-included hydra - ~+ein/hydra~ - to make using ein
easier. Things like navigating between cells, workbook management etc, are greatly
simplified and are easily accessible. However, by default, it's not bound to any key.
Here's an example of how to bind it:
@ -63,6 +63,6 @@ Here's an example of how to bind it:
#+BEGIN_SRC emacs-lisp
(map! :map ein:notebook-mode-map
:localleader
"," #'+ein-hydra/body)
"," #'+ein/hydra/body)
#+END_SRC

View file

@ -0,0 +1,24 @@
;;; tools/ein/autoload.el -*- lexical-binding: t; -*-
(defun +ein--collect-ein-buffer-links ()
(let ((end (window-end))
points)
(save-excursion
(goto-char (window-start))
(while (re-search-forward "~?/.+\\|\s\\[" end t)
(push (+ (match-beginning 0) 1) points))
(nreverse points))))
;;;###autoload
(defun +ein/ace-link-ein ()
"Ace jump to links in ein notebooklist."
(interactive)
(require 'avy)
(let ((res (avy-with +ein/ace-link-ein
(avy--process
(+ein--collect-ein-buffer-links)
#'avy--overlay-pre))))
;(avy--style-fn avy-style)))))
(when (numberp res)
(goto-char (1+ res))
(widget-button-press (point)))))

View file

@ -1,30 +1,8 @@
;;; tools/ein/autoload.el -*- lexical-binding: t; -*-
;;; tools/ein/autoload/hydra.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
(defun +ein--collect-ein-buffer-links ()
(let ((end (window-end))
points)
(save-excursion
(goto-char (window-start))
(while (re-search-forward "~?/.+\\|\s\\[" end t)
(push (+ (match-beginning 0) 1) points))
(nreverse points))))
;;;###autoload
(defun +ein/ace-link-ein ()
"Ace jump to links in ein notebooklist."
(interactive)
(require 'avy)
(let ((res (avy-with +ein/ace-link-ein
(avy--process
(+ein--collect-ein-buffer-links)
#'avy--overlay-pre))))
;(avy--style-fn avy-style)))))
(when (numberp res)
(goto-char (1+ res))
(widget-button-press (point)))))
;;;###autoload (autoload '+ein-hydra/body "tools/ein/autoload" nil t)
(defhydra +ein-hydra (:hint t :color red)
;;;###autoload (autoload '+ein/hydra/body "tools/ein/autoload" nil t)
(defhydra +ein/hydra (:hint t :color red)
"
Operations on Cells^^^^^^ Other
----------------------------^^^^^^ ----------------------------------^^^^

View file

@ -1,7 +1,8 @@
;;; tools/rgb/autoload.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
;;;###autoload (autoload '+rgb-kurecolor-hydra/body "tools/rgb/autoload" nil t)
(defhydra +rgb-kurecolor-hydra (:color pink :hint nil)
;;;###autoload (autoload '+rgb/kurecolor-hydra/body "tools/rgb/autoload" nil t)
(defhydra +rgb/kurecolor-hydra (:color pink :hint nil)
"
Inc/Dec _w_/_W_ brightness _d_/_D_ saturation _e_/_E_ hue "
("w" kurecolor-decrease-brightness-by-step)