Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Discover yafolding commands
;; Goal: have a magit-like menu to discover yafolding commands.
;; we use Mickey's version https://github.com/mickeynp/discover.el
;; We get a shorcut (M-f) which displays a list of actions associated with a hot key:
;; h will be for `yafolding-hide-element`, H to hide all, s to show the element, etc.
;; evil-mode users will need:
(evil-set-initial-state 'makey-key-mode 'emacs)
(discover-add-context-menu
:context-menu '(yafolding
(description "folding based on indentation")
(lisp-switches ;; to adapt if neeeded
("-cf" "Case should fold search" case-fold-search t nil))
(lisp-arguments ;; to adapt
("=l" "context lines to show (occur)"
"list-matching-lines-default-context-lines"
(lambda (dummy) (interactive) (read-number "Number of context lines to show: "))))
(actions
("yafolding"
("h" "yafolding hide element" yafolding-hide-element)
("s" "show element" yafolding-show-element)
("H" "hide all" yafolding-hide-all)
("S" "show all" yafolding-show-all))
))
:bind "M-f")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.