admin管理员组文章数量:1326636
I added the following mon-hook to automatically indent when hitting return in js-mode;
(add-hook 'js-mode-mon-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))
Why isn't this working? I use the same exact thing for C, as follows, and it works:
(add-hook 'c-mode-mon-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))
I added the following mon-hook to automatically indent when hitting return in js-mode;
(add-hook 'js-mode-mon-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))
Why isn't this working? I use the same exact thing for C, as follows, and it works:
(add-hook 'c-mode-mon-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))
Share
Improve this question
edited Apr 24, 2012 at 22:37
N.N.
8,51213 gold badges56 silver badges95 bronze badges
asked Apr 24, 2012 at 18:25
darkskydarksky
21.1k64 gold badges171 silver badges257 bronze badges
1 Answer
Reset to default 10Use js-mode-hook
. Languages that have modes based on cc-mode
can use the mon hook for all related languages. The mode for JavaScript is based on prog-mode
, so it runs prog-mode-hook
first, then js-mode-hook
.
If you look up mode documentation with C-h m, it will usually tell you what hooks get run.
本文标签: javascriptAdding Common Hook to jsmodeStack Overflow
版权声明:本文标题:javascript - Adding Common Hook to js-mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742207451a2433082.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论