Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for title-generator and mode-dispatch #55

Open
mattiasdrp opened this issue Sep 26, 2024 · 0 comments
Open

Improvements for title-generator and mode-dispatch #55

mattiasdrp opened this issue Sep 26, 2024 · 0 comments

Comments

@mattiasdrp
Copy link

Your major-mode-hydra-title-generator creates an eager macro expansion when used with a mode with no icon associated, I rewrote it like this:

(setq major-mode-hydra-title-generator
      '(lambda (mode)
         (let ((icon (all-the-icons-icon-for-mode mode :v-adjust 0.05)))
           (if (stringp icon)
               (s-concat "\n"
                         (s-repeat 10 " ")
                         icon
                         " "
                         (s-capitalize (symbol-name mode))
                         " commands")
             (s-concat "\n"
                       (s-repeat 10 " ")
                       (s-capitalize (symbol-name mode))
                       " commands")))))

And this is just for me but I wanted to have a default hydra when not visiting a buffer with a mode that has a major hydra but your major-mode-hydra-dispatch function isn't customizable so I rewrote it like this:

(defun major-mode-hydra-dispatch (mode)
  "Summon the hydra for given MODE (if there is one)."
  (let ((orig-mode mode))
    (catch 'done
      (while mode
        (let ((hydra (major-mode-hydra--body-name-for mode)))
          (when (fboundp hydra)
            (call-interactively hydra)
            (throw 'done t)))
        (setq mode (or (get mode 'derived-mode-parent) 'root-mode))))))

Thanks a lot for this package, it's really useful :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant