Skip to content

Instantly share code, notes, and snippets.

@slumos
Created July 7, 2021 20:33
Show Gist options
  • Save slumos/4eeb4ac5931e4e5f09588b53a97f7801 to your computer and use it in GitHub Desktop.
Save slumos/4eeb4ac5931e4e5f09588b53a97f7801 to your computer and use it in GitHub Desktop.
configure hydra from a table

Hydra

(use-package hydra)
(use-package use-package-hydra)
(defun invoke-hydra ()
  (interactive)
  (counsel-M-x "hydra-.*/body "))
(global-set-key (kbd "C-c h") #'invoke-hydra)

Hydras

Commonly visited files

This seems like a decent demonstration of literate programming. Add a row to this table, then eval the defhydra block.

keypathname
c~/.config/emacs/config.orgmain config
N~/Sync/OneDrive/Notes/NOTES.orgNOTES.org
n~/Sync/GDrive/Notes/Notes.orgWork notes
k~/Sync/GDrive/Notes/DMP.orgKrux work
p~/.config/emacs/personal.orgpersonal config
r~/Synt/ST/Notes/Cookbook.orgcookbook
s~/Sync/ST/Notes/SLUMOS.orgSLUMOS.org
w~/.config/emacs/work.orgwork config
(cl-loop for row in table
  do
  (print (list (car row) (list 'find-file (elt row 1)) (elt row 2) :column "File Shortcuts")))
(defhydra hydra-commonly-visited-files-shortcuts (:color blue)
  <<table-to-find-file-heads(table=commonly-visited-files-shortcuts)>>)
(global-set-key (kbd "C-c v") #'hydra-commonly-visited-files-shortcuts/body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment