diff options
author | Alan Mackenzie <acm@muc.de> | 2020-07-04 12:55:49 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2020-07-04 12:55:49 +0000 |
commit | eae028b9e2c23f84dbd130d49da65f9db1db932f (patch) | |
tree | abce20bf8865238e3f471369faaa2cea00a5ef6f /lisp/progmodes | |
parent | 697942f9a0d875cb8b00e6de155a34354db1dcba (diff) | |
download | emacs-eae028b9e2c23f84dbd130d49da65f9db1db932f.tar.gz emacs-eae028b9e2c23f84dbd130d49da65f9db1db932f.tar.bz2 emacs-eae028b9e2c23f84dbd130d49da65f9db1db932f.zip |
Fix filling in js-mode and mhtml-mode (js-mode parts), fixing bug #41897
* lisp/progmodes/js.el (js-mode): Use "\\(?:" in the value of
comment-start-skip rather than "\\(", fixing the second half of bug #41952.
Call c-foreign-init-lit-pos-cache and install c-foreign-truncate-lit-pos-cache
on before-change-functions, to connect up correctly with CC Mode's filling
mechanism.
* lisp/textmodes/mhtml-mode.el (mhtml--crucial-variable-prefix): Add prefixes
"adaptive-fill-", "fill-", "normal-auto-fill-function" and "paragraph-" to
pull in variables crucial to filling.
(mhtml-syntax-propertize): Read the current submode from the piece of text
being propertized rather than one character before it, and do so before
erasing the submode text-property.
(mhtml-mode): Set the js-mode value of auto-fill-function to js-do-auto-fill.
Correctly initialize and use CC Mode's filling facilities, as above.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/js.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 04b449ecd2c..5c50e2accdf 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -4570,7 +4570,7 @@ This function is intended for use in `after-change-functions'." ;; Comments (setq-local comment-start "// ") - (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *") + (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *") (setq-local comment-end "") (setq-local fill-paragraph-function #'js-fill-paragraph) (setq-local normal-auto-fill-function #'js-do-auto-fill) @@ -4591,6 +4591,8 @@ This function is intended for use in `after-change-functions'." (setq imenu-create-index-function #'js--imenu-create-index) ;; for filling, pretend we're cc-mode + (c-foreign-init-lit-pos-cache) + (add-hook 'before-change-functions #'c-foreign-truncate-lit-pos-cache nil t) (setq-local comment-line-break-function #'c-indent-new-comment-line) (setq-local comment-multi-line t) (setq-local electric-indent-chars |