Skip to content

Instantly share code, notes, and snippets.

@zarkone
Created January 6, 2018 03:07
Show Gist options
  • Save zarkone/487e944fe0afb8f70600c45054223acb to your computer and use it in GitHub Desktop.
Save zarkone/487e944fe0afb8f70600c45054223acb to your computer and use it in GitHub Desktop.
(defun should-collapse-p ()
(string-match-p "\s-*(def.*"
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position))))
(defun open-by-controller (should-collapse-p)
(let* ((region (yafolding-get-element-region))
(beg (car region))
(end (cadr region)))
(save-excursion
(next-line)
(while (< (point) (+ 1 end))
(when (should-collapse-p)
(yafolding-hide-element))
(next-line)))))
;; (open-by-controller 'should-collapse-p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment