diff options
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/js.el | 43 | ||||
-rw-r--r-- | lisp/progmodes/vhdl-mode.el | 3 |
2 files changed, 26 insertions, 20 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e42e01481b6..b42b2bca822 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1687,29 +1687,36 @@ This performs fontification according to `js--class-styles'." js--font-lock-keywords-3) "Font lock keywords for `js-mode'. See `font-lock-keywords'.") -(defconst js--syntax-propertize-regexp-syntax-table - (let ((st (make-char-table 'syntax-table (string-to-syntax ".")))) - (modify-syntax-entry ?\[ "(]" st) - (modify-syntax-entry ?\] ")[" st) - (modify-syntax-entry ?\\ "\\" st) - st)) +(defconst js--syntax-propertize-regexp-regexp + (rx + ;; Start of regexp. + "/" + (0+ (or + ;; Match characters outside of a character class. + (not (any ?\[ ?/ ?\\)) + ;; Match backslash quoted characters. + (and "\\" not-newline) + ;; Match character class. + (and + "[" + (0+ (or + (not (any ?\] ?\\)) + (and "\\" not-newline))) + "]"))) + (group "/")) + "Regular expression matching a JavaScript regexp literal.") (defun js-syntax-propertize-regexp (end) (let ((ppss (syntax-ppss))) (when (eq (nth 3 ppss) ?/) ;; A /.../ regexp. - (while - (when (re-search-forward "\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*/" - end 'move) - (if (nth 1 (with-syntax-table - js--syntax-propertize-regexp-syntax-table - (let ((parse-sexp-lookup-properties nil)) - (parse-partial-sexp (nth 8 ppss) (point))))) - ;; A / within a character class is not the end of a regexp. - t - (put-text-property (1- (point)) (point) - 'syntax-table (string-to-syntax "\"/")) - nil)))))) + (goto-char (nth 8 ppss)) + (when (and (looking-at js--syntax-propertize-regexp-regexp) + ;; Don't touch text after END. + (<= (match-end 1) end)) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"/")) + (goto-char (match-end 0)))))) (defun js-syntax-propertize (start end) ;; JavaScript allows immediate regular expression objects, written /.../. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 6c76d7e4ad2..06ffd54d2df 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -1010,7 +1010,7 @@ if the header needs to be version controlled. The following keywords for template generation are supported: <filename> : replaced by the name of the buffer <author> : replaced by the user name and email address - (`user-full-name',`mail-host-address', `user-mail-address') + (`user-full-name', `user-mail-address') <authorfull> : replaced by the user full name (`user-full-name') <login> : replaced by user login name (`user-login-name') <company> : replaced by contents of option `vhdl-company-name' @@ -1967,7 +1967,6 @@ are treated as single words otherwise." (unless (featurep 'xemacs) (custom-add-to-group 'vhdl-related 'transient-mark-mode 'custom-variable)) (custom-add-to-group 'vhdl-related 'user-full-name 'custom-variable) -(custom-add-to-group 'vhdl-related 'mail-host-address 'custom-variable) (custom-add-to-group 'vhdl-related 'user-mail-address 'custom-variable) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |