modern-sh icon indicating copy to clipboard operation
modern-sh copied to clipboard

Non file buffer issue

Open seblemaguer opened this issue 4 years ago • 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 avatar Sep 05 '20 08:09 seblemaguer

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

damon-kwok avatar Sep 09 '20 19:09 damon-kwok