From 1d5963cc63979c4a19b5de3b9b537c1b3b61dda3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 8 May 2013 12:27:53 -0400 Subject: * lisp/progmodes/f90.el (f90-mode-syntax-table): Use symbol syntax for "_". Change all regexps to use things like \_< and \_>. * lisp/progmodes/ada-mode.el (ada-mode-abbrev-table): Consolidate declaration. (ada-mode-syntax-table, ada-mode-symbol-syntax-table): Initialize in the declaration. (ada-create-syntax-table): Remove. (ada-capitalize-word): Don't mess with the syntax of "_" since it already has the right syntax nowadays. (ada-goto-next-word): Don't change the syntax of "_". * lisp/progmodes/autoconf.el (autoconf-definition-regexp) (autoconf-font-lock-keywords, autoconf-current-defun-function): Handle a _ with symbol syntax. (autoconf-mode): Don't change the syntax-table for imenu and font-lock. * lisp/progmodes/vera-mode.el (vera-underscore-is-part-of-word): * lisp/progmodes/prolog.el (prolog-underscore-wordchar-flag) (prolog-char-quote-workaround): * lisp/progmodes/cperl-mode.el (cperl-under-as-char): * lisp/progmodes/vhdl-mode.el (vhdl-underscore-is-part-of-word): Mark as obsolete. (vhdl-mode-syntax-table, vhdl-mode-ext-syntax-table): Initialize in their declaration. (vhdl-mode-syntax-table-init): Remove. * lisp/progmodes/ld-script.el (ld-script-mode-syntax-table): Use symbol syntax for "_". (ld-script-font-lock-keywords): Change regexps to use things like \_< and \_>. * lisp/progmodes/m4-mode.el (m4-mode-syntax-table): Add comment on last change. * lisp/font-lock.el (lisp-font-lock-keywords-2): Don't highlight obsolete with-wrapper-hook. * lisp/mh-e/mh-comp.el (mh-regexp-in-field-p): Minor simplification. --- lisp/progmodes/vhdl-mode.el | 97 +++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 52 deletions(-) (limited to 'lisp/progmodes/vhdl-mode.el') diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index e3b421efbe1..1a7ecb5ef87 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -1872,14 +1872,11 @@ NOTE: Activate the new setting by restarting Emacs." "Non-nil means consider the underscore character `_' as part of word. An identifier containing underscores is then treated as a single word in select and move operations. All parts of an identifier separated by underscore -are treated as single words otherwise. - -NOTE: Activate the new setting in a VHDL buffer by using the menu entry - \"Activate Options\"." +are treated as single words otherwise." :type 'boolean - :set (lambda (variable value) - (vhdl-custom-set variable value 'vhdl-mode-syntax-table-init)) :group 'vhdl-misc) +(make-obsolete-variable 'vhdl-underscore-is-part-of-word + 'superword-mode "24.4") (defgroup vhdl-related nil @@ -2433,6 +2430,7 @@ old environment. Used for consistent searching." (progn (set-buffer (create-file-buffer ,file-name)) (setq file-opened t) (vhdl-insert-file-contents ,file-name) + ;; FIXME: This modifies a global syntax-table! (modify-syntax-entry ?\- ". 12" (syntax-table)) (modify-syntax-entry ?\n ">" (syntax-table)) (modify-syntax-entry ?\^M ">" (syntax-table)) @@ -2864,56 +2862,51 @@ STRING are replaced by `-' and substrings are converted to lower case." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Syntax table -(defvar vhdl-mode-syntax-table nil +(defvar vhdl-mode-syntax-table + (let ((st (make-syntax-table))) + ;; define punctuation + (modify-syntax-entry ?\# "." st) + (modify-syntax-entry ?\$ "." st) + (modify-syntax-entry ?\% "." st) + (modify-syntax-entry ?\& "." st) + (modify-syntax-entry ?\' "." st) + (modify-syntax-entry ?\* "." st) + (modify-syntax-entry ?\+ "." st) + (modify-syntax-entry ?\. "." st) + (modify-syntax-entry ?\/ "." st) + (modify-syntax-entry ?\: "." st) + (modify-syntax-entry ?\; "." st) + (modify-syntax-entry ?\< "." st) + (modify-syntax-entry ?\= "." st) + (modify-syntax-entry ?\> "." st) + (modify-syntax-entry ?\\ "." st) + (modify-syntax-entry ?\| "." st) + ;; define string + (modify-syntax-entry ?\" "\"" st) + ;; define underscore + (modify-syntax-entry ?\_ (if vhdl-underscore-is-part-of-word "w" "_") st) + ;; a single hyphen is punctuation, but a double hyphen starts a comment + (modify-syntax-entry ?\- ". 12" st) + ;; and \n and \^M end a comment + (modify-syntax-entry ?\n ">" st) + (modify-syntax-entry ?\^M ">" st) + ;; define parentheses to match + (modify-syntax-entry ?\( "()" st) + (modify-syntax-entry ?\) ")(" st) + (modify-syntax-entry ?\[ "(]" st) + (modify-syntax-entry ?\] ")[" st) + (modify-syntax-entry ?\{ "(}" st) + (modify-syntax-entry ?\} "){" st) + st) "Syntax table used in `vhdl-mode' buffers.") -(defvar vhdl-mode-ext-syntax-table nil +(defvar vhdl-mode-ext-syntax-table + ;; Extended syntax table including '_' (for simpler search regexps). + (let ((st (copy-syntax-table vhdl-mode-syntax-table))) + (modify-syntax-entry ?_ "w" st) + st) "Syntax table extended by `_' used in `vhdl-mode' buffers.") -(defun vhdl-mode-syntax-table-init () - "Initialize `vhdl-mode-syntax-table'." - (setq vhdl-mode-syntax-table (make-syntax-table)) - ;; define punctuation - (modify-syntax-entry ?\# "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\$ "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\% "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\& "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\' "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\* "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\+ "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\. "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\/ "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\: "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\; "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\< "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\= "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\> "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\\ "." vhdl-mode-syntax-table) - (modify-syntax-entry ?\| "." vhdl-mode-syntax-table) - ;; define string - (modify-syntax-entry ?\" "\"" vhdl-mode-syntax-table) - ;; define underscore - (when vhdl-underscore-is-part-of-word - (modify-syntax-entry ?\_ "w" vhdl-mode-syntax-table)) - ;; a single hyphen is punctuation, but a double hyphen starts a comment - (modify-syntax-entry ?\- ". 12" vhdl-mode-syntax-table) - ;; and \n and \^M end a comment - (modify-syntax-entry ?\n ">" vhdl-mode-syntax-table) - (modify-syntax-entry ?\^M ">" vhdl-mode-syntax-table) - ;; define parentheses to match - (modify-syntax-entry ?\( "()" vhdl-mode-syntax-table) - (modify-syntax-entry ?\) ")(" vhdl-mode-syntax-table) - (modify-syntax-entry ?\[ "(]" vhdl-mode-syntax-table) - (modify-syntax-entry ?\] ")[" vhdl-mode-syntax-table) - (modify-syntax-entry ?\{ "(}" vhdl-mode-syntax-table) - (modify-syntax-entry ?\} "){" vhdl-mode-syntax-table) - ;; extended syntax table including '_' (for simpler search regexps) - (setq vhdl-mode-ext-syntax-table (copy-syntax-table vhdl-mode-syntax-table)) - (modify-syntax-entry ?_ "w" vhdl-mode-ext-syntax-table)) - -;; initialize syntax table for VHDL Mode -(vhdl-mode-syntax-table-init) - (defvar vhdl-syntactic-context nil "Buffer local variable containing syntactic analysis list.") (make-variable-buffer-local 'vhdl-syntactic-context) -- cgit v1.2.1