reddit / emacs

Ruby: Navigate between Scopes

henrymazza · 2022-10-28 14:02
It can be something as simple as "go to previous indentation". ​ Or sticky function that is clickable, or something on those lines...
takeonrules · 2022-10-28 16:08
Enh-ruby-mode has some navigation functions based on sexp
henrymazza · 2022-10-28 18:30
Nice! And it works with \`ruby-mode\` too!
takeonrules · 2022-10-28 19:50
Zenspider is a long time rubyist and wrote/forked to enh-ruby. Zenspider made things like flog, flay, reek, and manay many more.
henrymazza · 2022-10-31 13:16
[Follow Up] as a more agnostic way to go back to previous indentation I've been using this code: ```elisp (defun jump-to-upper-indent (direction) (interactive) (let ((start-indent (current-indentation))) (while (and ;; not end-of-buffer (not (bobp)) ;; line move succeeds (zerop (forward-line (or direction 1))) ;; indentation at point is = or > than start (or (zerop (current-indentation)) (>= (current-indentation) start-indent))))) (back-to-indentation)) ``` ** adapted from https://superuser.com/questions/1017094/emacs-jump-to-the-next-line-with-same-indentation