damon-kwok/modern-sh

Non file buffer issue

Opened this issue · 1 comments

Hello,

thanks for the package. I notice that there is an edge case to the use of your package: you assume that the buffer is related to a file. On my side, I tend to use, a lot, org-mode to store snippets. Therefore, the package load as the code snippet is not linked to a shell script file.

So in case that is useful, I solved this by wrapping the activating this way:

  (use-package modern-sh
    :ensure t
    :hook (sh-mode . embed-modern-sh-mode-toggle)
    :bind
    (:map modern-sh-mode-map
          ("C-<f6>"  . modern-sh-menu))
    :init
    (defun embed-modern-sh-mode-toggle ()
        (when (buffer-file-name)
          (modern-sh-mode))))

@seblemaguer Thanks. I'm thinking about how to integrate your code.