glynnforrest / salt-mode

Emacs major mode for Salt States

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

salt-mode doesn't appear to include itself in prog-mode list

chadhs opened this issue · comments

hey @glynnforrest,

i noticed that salt-mode doesn't appear to include itself in prog-mode list. i'm curious is this is due to mmm being the driver for making two major modes work?

my workaround for now was to just do this for the things that would/should normally load up:

  (add-hook 'salt-mode-hook (lambda ()
                              (enable-paredit-mode)
                              (electric-pair-mode)
                              (evil-cleverparens-mode)))

Thanks @chadhs, good observation.

salt-mode is a derived mode of yaml-mode, which itself is a derived mode of text-mode. There's no prog-mode in that chain unfortunately. The jinja support is added with mmm, which I don't think affects this.

Thinking about it, salt-mode is essentially a markup mode, similar to yaml-mode, html-mode, etc. While it feels like you are 'programming' salt when writing .sls files, it is in fact just dictionaries of data with templating added in. Thus I feel like it shouldn't be treated as a prog-mode.

I guess it would be possible to derive from prog-mode, but since yaml-mode does not, it would require salt-mode to shoehorn in all the yaml syntax highlighting, since we can't derive from that mode anymore. I'm not an authority on this, but that is how I understand it.

I'm open to a discussion if you disagree.

@glynnforrest thank you for the info/lesson there on how the mode is derived and how the jinja2 support is added.

here is where i was in error, turns out… i thought for sure all this time when in yaml-mode, editing ansible stuff etc, that i had paredit and friends on via prog-mode but it turns out I didn't so now your explanation makes a lot of sense and it would not be wise to alter that behavior for salt-mode, it should be in line with yaml-mode.

the only counter i can think of for both ansible and salt modes is that jinja templating does provide conditional logic, variables, etc. when editing a web jinja template (html is also markup) web-mode does derive from prog-mode.

all that being said I'm content doing this to solve my "problem" across the board now that i understand what's happening a little better.

(add-hook 'yaml-mode-hook (lambda ()
                            (enable-paredit-mode)
                            (electric-pair-mode)
                            (evil-cleverparens-mode)))

edit: feel free to close; the other couple places where i had a prog-mode-hook i just added a yaml-mode-hook so all is well! 👍🏼

Great, glad you solved your problem okay!