with imenu-use-markers = t
for buffer being the buffers
for imenu-index = (with-current-buffer buffer
- (when (eq major-mode 'js-mode)
+ (when (derived-mode-p 'js-mode)
(js--imenu-create-index)))
do (js--imenu-to-flat imenu-index "" symbols)
finally return symbols))
;;; Main Function
;;;###autoload
-(define-derived-mode js-mode prog-mode "js"
- "Major mode for editing JavaScript.
-
-Key bindings:
-
-\\{js-mode-map}"
-
+(define-derived-mode js-mode prog-mode "Javascript"
+ "Major mode for editing JavaScript."
:group 'js
- :syntax-table js-mode-syntax-table
(set (make-local-variable 'indent-line-function) 'js-indent-line)
(set (make-local-variable 'beginning-of-defun-function)
(set (make-local-variable 'imenu-create-index-function)
#'js--imenu-create-index)
- (setq major-mode 'js-mode)
- (setq mode-name "Javascript")
-
;; for filling, pretend we're cc-mode
(setq c-comment-prefix-regexp "//+\\|\\**"
c-paragraph-start "$"
;; the buffer containing the problem, JIT-lock will apply the
;; correct syntax to the regular expresion literal and the problem
;; will mysteriously disappear.
- (font-lock-set-defaults)
-
- (let (font-lock-keywords) ; leaves syntactic keywords intact
- (font-lock-fontify-buffer)))
+ ;; FIXME: We should actually do this fontification lazily by adding
+ ;; calls to syntax-propertize wherever it's really needed.
+ (syntax-propertize (point-max)))
;;;###autoload
(defalias 'javascript-mode 'js-mode)