emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112519: * lisp/progmodes/f90.el (f90


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112519: * lisp/progmodes/f90.el (f90-mode-syntax-table): Use symbol syntax for "_".
Date: Wed, 08 May 2013 12:27:53 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112519
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-05-08 12:27:53 -0400
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/font-lock.el
  lisp/mh-e/ChangeLog
  lisp/mh-e/mh-comp.el
  lisp/progmodes/ada-mode.el
  lisp/progmodes/autoconf.el
  lisp/progmodes/cperl-mode.el
  lisp/progmodes/f90.el
  lisp/progmodes/ld-script.el
  lisp/progmodes/m4-mode.el
  lisp/progmodes/meta-mode.el
  lisp/progmodes/prolog.el
  lisp/progmodes/vera-mode.el
  lisp/progmodes/verilog-mode.el
  lisp/progmodes/vhdl-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-08 15:13:25 +0000
+++ b/lisp/ChangeLog    2013-05-08 16:27:53 +0000
@@ -1,3 +1,41 @@
+2013-05-08  Stefan Monnier  <address@hidden>
+
+       * progmodes/vera-mode.el (vera-underscore-is-part-of-word):
+       * progmodes/prolog.el (prolog-underscore-wordchar-flag)
+       (prolog-char-quote-workaround):
+       * progmodes/cperl-mode.el (cperl-under-as-char):
+       * 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.
+
+       * progmodes/m4-mode.el (m4-mode-syntax-table): Add comment on last 
change.
+
+       * 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 \_>.
+
+       * progmodes/f90.el (f90-mode-syntax-table): Use symbol syntax for "_".
+       Change all regexps to use things like \_< and \_>.
+
+       * 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.
+
+       * 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 "_".
+
+       * font-lock.el (lisp-font-lock-keywords-2): Don't highlight obsolete
+       with-wrapper-hook.
+
 2013-05-08  Sam Steingold  <address@hidden>
 
        * thingatpt.el (thing-at-point): Accept optional second argument

=== modified file 'lisp/font-lock.el'
--- a/lisp/font-lock.el 2013-03-25 13:47:32 +0000
+++ b/lisp/font-lock.el 2013-05-08 16:27:53 +0000
@@ -2298,7 +2298,7 @@
                 "with-selected-window" "with-selected-frame"
                 "with-silent-modifications" "with-syntax-table"
                 "with-temp-buffer" "with-temp-file" "with-temp-message"
-                "with-timeout" "with-timeout-handler" "with-wrapper-hook") t)
+                "with-timeout" "with-timeout-handler") t)
          "\\_>")
          .  1)
        ;; Control structures.  Common Lisp forms.

=== modified file 'lisp/mh-e/ChangeLog'
--- a/lisp/mh-e/ChangeLog       2013-03-11 16:31:55 +0000
+++ b/lisp/mh-e/ChangeLog       2013-05-08 16:27:53 +0000
@@ -1,3 +1,7 @@
+2013-05-08  Stefan Monnier  <address@hidden>
+
+       * mh-comp.el (mh-regexp-in-field-p): Minor simplification.
+
 2013-03-02  Bill Wohler  <address@hidden>
 
        Release MH-E version 8.5.

=== modified file 'lisp/mh-e/mh-comp.el'
--- a/lisp/mh-e/mh-comp.el      2013-02-18 18:11:43 +0000
+++ b/lisp/mh-e/mh-comp.el      2013-05-08 16:27:53 +0000
@@ -1205,17 +1205,17 @@
           (let ((search-result nil))
             (while fields
               (let ((field (car fields))
-                    (syntax-table mh-regexp-in-field-syntax-table))
-                (if (null syntax-table)
-                    (let ((case-fold-search t))
-                      (cond
-                       ((string-match field "^To$\\|^[BD]?cc$\\|^From$")
-                        (setq syntax-table mh-addr-syntax-table))
-                       ((string-match field "^Fcc$")
-                        (setq syntax-table mh-fcc-syntax-table))
-                       (t
-                        (setq syntax-table (syntax-table)))
-                       )))
+                    (syntax-table
+                     (or mh-regexp-in-field-syntax-table
+                         (let ((case-fold-search t))
+                           (cond
+                            ((string-match field "^To$\\|^[BD]?cc$\\|^From$")
+                             mh-addr-syntax-table)
+                            ((string-match field "^Fcc$")
+                             mh-fcc-syntax-table)
+                            (t
+                             (syntax-table)))
+                           ))))
                 (if (and (mh-goto-header-field field)
                          (set-syntax-table syntax-table)
                          (re-search-forward

=== modified file 'lisp/progmodes/ada-mode.el'
--- a/lisp/progmodes/ada-mode.el        2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/ada-mode.el        2013-05-08 16:27:53 +0000
@@ -457,15 +457,8 @@
 (defvar ada-mode-extra-prefix "\C-c\C-q"
   "Prefix key to access `ada-mode-extra-map' functions.")
 
-(defvar ada-mode-abbrev-table nil
+(define-abbrev-table 'ada-mode-abbrev-table ()
   "Local abbrev table for Ada mode.")
-(define-abbrev-table 'ada-mode-abbrev-table ())
-
-(defvar ada-mode-syntax-table nil
-  "Syntax table to be used for editing Ada source code.")
-
-(defvar ada-mode-symbol-syntax-table nil
-  "Syntax table for Ada, where `_' is a word constituent.")
 
 (eval-when-compile
   ;; These values are used in eval-when-compile expressions.
@@ -845,61 +838,58 @@
 ;; better is available on XEmacs.
 ;;-------------------------------------------------------------------------
 
-(defun ada-create-syntax-table ()
-  "Create the two syntax tables use in the Ada mode.
-The standard table declares `_' as a symbol constituent, the second one
-declares it as a word constituent."
-  (interactive)
-  (setq ada-mode-syntax-table (make-syntax-table))
-
-  ;; define string brackets (`%' is alternative string bracket, but
-  ;; almost never used as such and throws font-lock and indentation
-  ;; off the track.)
-  (modify-syntax-entry ?%  "$" ada-mode-syntax-table)
-  (modify-syntax-entry ?\" "\"" ada-mode-syntax-table)
-
-  (modify-syntax-entry ?:  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\; "." ada-mode-syntax-table)
-  (modify-syntax-entry ?&  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\|  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?+  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?*  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?/  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?=  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?<  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?>  "." ada-mode-syntax-table)
-  (modify-syntax-entry ?$ "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\[ "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\] "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\{ "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\} "." ada-mode-syntax-table)
-  (modify-syntax-entry ?. "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\\ "." ada-mode-syntax-table)
-  (modify-syntax-entry ?\' "." ada-mode-syntax-table)
-
-  ;; a single hyphen is punctuation, but a double hyphen starts a comment
-  (modify-syntax-entry ?-  ". 12" ada-mode-syntax-table)
-
-  ;; See the comment above on grammar related function for the special
-  ;; setup for '#'.
-  (if (featurep 'xemacs)
-      (modify-syntax-entry ?#  "<" ada-mode-syntax-table)
-    (modify-syntax-entry ?#  "$" ada-mode-syntax-table))
-
-  ;; and \f and \n end a comment
-  (modify-syntax-entry ?\f  ">   " ada-mode-syntax-table)
-  (modify-syntax-entry ?\n  ">   " ada-mode-syntax-table)
-
-  ;; define what belongs in Ada symbols
-  (modify-syntax-entry ?_ "_" ada-mode-syntax-table)
-
-  ;; define parentheses to match
-  (modify-syntax-entry ?\( "()" ada-mode-syntax-table)
-  (modify-syntax-entry ?\) ")(" ada-mode-syntax-table)
-
-  (setq ada-mode-symbol-syntax-table (copy-syntax-table ada-mode-syntax-table))
-  (modify-syntax-entry ?_ "w" ada-mode-symbol-syntax-table)
-  )
+(defvar ada-mode-syntax-table
+  (let ((st (make-syntax-table)))
+    ;; Define string brackets (`%' is alternative string bracket, but
+    ;; almost never used as such and throws font-lock and indentation
+    ;; off the track.)
+    (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)
+    (modify-syntax-entry ?\} "." st)
+    (modify-syntax-entry ?. "." st)
+    (modify-syntax-entry ?\\ "." st)
+    (modify-syntax-entry ?\' "." st)
+
+    ;; A single hyphen is punctuation, but a double hyphen starts a comment.
+    (modify-syntax-entry ?-  ". 12" st)
+
+    ;; See the comment above on grammar related function for the special
+    ;; setup for '#'.
+    (modify-syntax-entry ?# (if (featurep 'xemacs) "<" "$") st)
+
+    ;; And \f and \n end a comment.
+    (modify-syntax-entry ?\f  ">   " st)
+    (modify-syntax-entry ?\n  ">   " st)
+
+    ;; Define what belongs in Ada symbols.
+    (modify-syntax-entry ?_ "_" st)
+
+    ;; Define parentheses to match.
+    (modify-syntax-entry ?\( "()" st)
+    (modify-syntax-entry ?\) ")(" st)
+    st)
+  "Syntax table to be used for editing Ada source code.")
+
+(defvar ada-mode-symbol-syntax-table
+  (let ((st (make-syntax-table ada-mode-syntax-table)))
+    (modify-syntax-entry ?_ "w" st)
+    st)
+  "Syntax table for Ada, where `_' is a word constituent.")
 
 ;;  Support of special characters in XEmacs (see the comments at the beginning
 ;;  of the section on Grammar related functions).
@@ -1293,7 +1283,7 @@
   (if ada-popup-key
       (define-key ada-mode-map ada-popup-key 'ada-popup-menu))
 
-  ;;  Support for Abbreviations (the user still need to "M-x abbrev-mode"
+  ;;  Support for Abbreviations (the user still needs to "M-x abbrev-mode").
   (setq local-abbrev-table ada-mode-abbrev-table)
 
   ;;  Support for which-function mode
@@ -1625,9 +1615,8 @@
       (let ((lastk last-command-event))
 
         (with-syntax-table ada-mode-symbol-syntax-table
-          (cond ((or (eq lastk ?\n)
-                     (eq lastk ?\r))
-                 ;; horrible kludge
+          (cond ((memq lastk '(?\n ?\r))
+                 ;; Horrible kludge.
                  (insert " ")
                  (ada-adjust-case)
                  ;; horrible dekludge
@@ -1706,9 +1695,7 @@
   (interactive)
   (let ((end   (save-excursion (skip-syntax-forward  "w") (point)))
        (begin (save-excursion (skip-syntax-backward "w") (point))))
-    (modify-syntax-entry ?_ "_")
-    (capitalize-region begin end)
-    (modify-syntax-entry ?_ "w")))
+    (capitalize-region begin end)))
 
 (defun ada-adjust-case-region (from to)
   "Adjust the case of all words in the region between FROM and TO.
@@ -2165,7 +2152,7 @@
     (unwind-protect
        (with-syntax-table ada-mode-symbol-syntax-table
 
-         ;;  This need to be done here so that the advice is not always
+         ;;  This needs to be done here so that the advice is not always
          ;;  activated (this might interact badly with other modes)
          (if (featurep 'xemacs)
              (ad-activate 'parse-partial-sexp t))
@@ -3419,27 +3406,23 @@
 If BACKWARD is non-nil, jump to the beginning of the previous word.
 Return the new position of point or nil if not found."
   (let ((match-cons nil)
-       (orgpoint (point))
-       (old-syntax (char-to-string (char-syntax ?_))))
-    (modify-syntax-entry ?_ "w")
+       (orgpoint (point)))
     (unless backward
-      (skip-syntax-forward "w"))
+      (skip-syntax-forward "w_"))
     (if (setq match-cons
-              (ada-search-ignore-string-comment "\\w" backward nil t))
+              (ada-search-ignore-string-comment "\\sw\\|\\s_" backward nil t))
        ;;
        ;; move to the beginning of the word found
        ;;
        (progn
          (goto-char (car match-cons))
-         (skip-syntax-backward "w")
+         (skip-syntax-backward "w_")
          (point))
       ;;
       ;; if not found, restore old position of point
       ;;
       (goto-char orgpoint)
-      'nil)
-    (modify-syntax-entry ?_ old-syntax))
-  )
+      'nil)))
 
 
 (defun ada-check-matching-start (keyword)
@@ -5431,9 +5414,6 @@
 (ada-create-keymap)
 (ada-create-menu)
 
-;;  Create the syntax tables, but do not activate them
-(ada-create-syntax-table)
-
 ;;  Add the default extensions (and set up speedbar)
 (ada-add-extensions ".ads" ".adb")
 ;; This two files are generated by GNAT when running with -gnatD

=== modified file 'lisp/progmodes/autoconf.el'
--- a/lisp/progmodes/autoconf.el        2013-01-02 16:13:04 +0000
+++ b/lisp/progmodes/autoconf.el        2013-05-08 16:27:53 +0000
@@ -41,10 +41,10 @@
   "Hook run by `autoconf-mode'.")
 
 (defconst autoconf-definition-regexp
-  
"A\\(?:H_TEMPLATE\\|C_\\(?:SUBST\\|DEFINE\\(?:_UNQUOTED\\)?\\)\\)(\\[*\\(\\sw+\\)\\]*")
+  
"A\\(?:H_TEMPLATE\\|C_\\(?:SUBST\\|DEFINE\\(?:_UNQUOTED\\)?\\)\\)(\\[*\\(\\(?:\\sw\\|\\s_\\)+\\)\\]*")
 
 (defvar autoconf-font-lock-keywords
-  `(("\\_<A[CHMS]_\\sw+" . font-lock-keyword-face)
+  `(("\\_<A[CHMS]_\\(?:\\sw\\|\\s_\\)+" . font-lock-keyword-face)
     (,autoconf-definition-regexp
      1 font-lock-function-name-face)
     ;; Are any other M4 keywords really appropriate for configure.ac,
@@ -67,13 +67,11 @@
 This version looks back for an AC_DEFINE or AC_SUBST.  It will stop
 searching backwards at another AC_... command."
   (save-excursion
-    (with-syntax-table (copy-syntax-table autoconf-mode-syntax-table)
-      (modify-syntax-entry ?_ "w")
-      (skip-syntax-forward "w" (line-end-position))
-      (if (re-search-backward autoconf-definition-regexp
-                             (save-excursion (beginning-of-defun) (point))
-                             t)
-         (match-string-no-properties 1)))))
+    (skip-syntax-forward "w_" (line-end-position))
+    (if (re-search-backward autoconf-definition-regexp
+                            (save-excursion (beginning-of-defun) (point))
+                            t)
+        (match-string-no-properties 1))))
 
 ;;;###autoload
 (define-derived-mode autoconf-mode prog-mode "Autoconf"
@@ -85,9 +83,8 @@
   (setq-local syntax-propertize-function
              (syntax-propertize-rules ("\\<dnl\\>" (0 "<"))))
   (setq-local font-lock-defaults
-             `(autoconf-font-lock-keywords nil nil (("_" . "w"))))
+             `(autoconf-font-lock-keywords nil nil))
   (setq-local imenu-generic-expression autoconf-imenu-generic-expression)
-  (setq-local imenu-syntax-alist '(("_" . "w")))
   (setq-local indent-line-function #'indent-relative)
   (setq-local add-log-current-defun-function
              #'autoconf-current-defun-function))

=== modified file 'lisp/progmodes/cperl-mode.el'
--- a/lisp/progmodes/cperl-mode.el      2013-02-13 04:31:09 +0000
+++ b/lisp/progmodes/cperl-mode.el      2013-05-08 16:27:53 +0000
@@ -565,6 +565,7 @@
   "*Non-nil means that the _ (underline) should be treated as word char."
   :type 'boolean
   :group 'cperl)
+(make-obsolete-variable 'cperl-under-as-char 'superword-mode "24.4")
 
 (defcustom cperl-extra-perl-args ""
   "*Extra arguments to use when starting Perl.

=== modified file 'lisp/progmodes/f90.el'
--- a/lisp/progmodes/f90.el     2013-05-07 07:05:21 +0000
+++ b/lisp/progmodes/f90.el     2013-05-08 16:27:53 +0000
@@ -367,7 +367,7 @@
   "Keyword-regexp for font-lock level >= 3.")
 
 (defconst f90-procedures-re
-  (concat "\\<"
+  (concat "\\_<"
           (regexp-opt
            '("abs" "achar" "acos" "adjustl" "adjustr" "aimag" "aint"
              "all" "allocated" "anint" "any" "asin" "associated"
@@ -491,16 +491,16 @@
 Set the match data so that subexpression 1,2 are the TYPE, and
 type-name parts, respectively."
   (let (found l)
-    (while (and (re-search-forward "\\<\\(\\(?:end[ \t]*\\)?type\\)\\>[ \t]*"
+    (while (and (re-search-forward "\\_<\\(\\(?:end[ \t]*\\)?type\\)\\_>[ \t]*"
                                    limit t)
                 (not (setq found
                            (progn
                              (setq l (match-data))
-                             (unless (looking-at "\\(is\\>\\|(\\)")
-                               (when (if (looking-at "\\(\\sw+\\)")
+                             (unless (looking-at "\\(is\\_>\\|(\\)")
+                               (when (if (looking-at 
"\\(\\(?:\\sw\\|\\s_\\)+\\)")
                                          (goto-char (match-end 0))
                                        (re-search-forward
-                                        "[ \t]*::[ \t]*\\(\\sw+\\)"
+                                        "[ \t]*::[ 
\t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
                                         (line-end-position) t))
                                  ;; 0 is wrong, but we don't use it.
                                  (set-match-data
@@ -512,33 +512,33 @@
 (defvar f90-font-lock-keywords-1
   (list
    ;; Special highlighting of "module procedure".
-   '("\\<\\(module[ \t]*procedure\\)\\>\\([^()\n]*::\\)?[ \t]*\\([^&!\n]*\\)"
+   '("\\_<\\(module[ \t]*procedure\\)\\_>\\([^()\n]*::\\)?[ \t]*\\([^&!\n]*\\)"
      (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
    ;; Highlight definition of derived type.
-;;;    '("\\<\\(\\(?:end[ \t]*\\)?type\\)\\>\\([^()\n]*::\\)?[ \t]*\\(\\sw+\\)"
+;;;    '("\\_<\\(\\(?:end[ \t]*\\)?type\\)\\_>\\([^()\n]*::\\)?[ 
\t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
 ;;;      (1 font-lock-keyword-face) (3 font-lock-function-name-face))
    '(f90-typedef-matcher
      (1 font-lock-keyword-face) (2 font-lock-function-name-face))
    ;; F2003.  Prevent operators being highlighted as functions.
-   '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
+   '("\\_<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
 read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
    ;; Other functions and declarations.  Named interfaces = F2003.
    ;; F2008: end submodule submodule_name.
-   '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\
+   '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\
 function\\|associate\\|subroutine\\|interface\\)\\|use\\|call\\)\
-\\>[ \t]*\\(\\sw+\\)?"
+\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
      (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
    ;; F2008: submodule (parent_name) submodule_name.
-   '("\\<\\(submodule\\)\\>[ \t]*([^)\n]+)[ \t]*\\(\\sw+\\)?"
+   '("\\_<\\(submodule\\)\\_>[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
      (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
    ;; F2003.
-   '("\\<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\
-\\(\\sw+\\)"
+   '("\\_<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\
+\\(\\(?:\\sw\\|\\s_\\)+\\)"
      (1 font-lock-keyword-face) (2 font-lock-keyword-face)
      (3 font-lock-function-name-face))
-   "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\>"
+   "\\_<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\_>"
    ;; "abstract interface" is F2003.
-   '("\\<abstract[ \t]*interface\\>" (0 font-lock-keyword-face t)))
+   '("\\_<abstract[ \t]*interface\\_>" (0 font-lock-keyword-face t)))
   "This does fairly subdued highlighting of comments and function calls.")
 
 ;; NB not explicitly handling this, yet it seems to work.
@@ -550,7 +550,7 @@
   ;; Matcher functions must return nil only when there are no more
   ;; matches within the search range.
   (let (found l)
-    (while (and (re-search-forward "\\<\\(type\\|class\\)[ \t]*(" limit t)
+    (while (and (re-search-forward "\\_<\\(type\\|class\\)[ \t]*(" limit t)
                 (not
                  (setq found
                        (condition-case nil
@@ -565,7 +565,7 @@
                              (when
                                  (re-search-forward
                                   ;; type (foo) bar, qux
-                                  (if (looking-at "\\sw+")
+                                  (if (looking-at "\\(?:\\sw\\|\\s_\\)+")
                                       "\\([^&!\n]+\\)"
                                     ;; type (foo), stuff :: bar, qux
                                     "::[ \t]*\\([^&!\n]+\\)")
@@ -608,53 +608,53 @@
     ;; integer( kind=1 ) function foo()
     ;; thanks to the happy accident described above.
     ;; Not anchored, so don't need to worry about "pure" etc.
-    '("\\<\\(\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|\
+    '("\\_<\\(\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|\
 logical\\|double[ \t]*precision\\|\
-\\(?:type\\|class\\)[ \t]*([ \t]*\\sw+[ \t]*)\\)[ \t]*\\)\
-\\(function\\)\\>[ \t]*\\(\\sw+\\)[ \t]*\\(([^&!\n]*)\\)"
+\\(?:type\\|class\\)[ \t]*([ \t]*\\(?:\\sw\\|\\s_\\)+[ \t]*)\\)[ \t]*\\)\
+\\(function\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*\\(([^&!\n]*)\\)"
       (1 font-lock-type-face t) (4 font-lock-keyword-face t)
       (5 font-lock-function-name-face t) (6 'default t))
     ;; enum (F2003; must be followed by ", bind(C)").
-    '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face))
+    '("\\_<\\(enum\\)[ \t]*," (1 font-lock-keyword-face))
     ;; end do, enum (F2003), if, select, where, and forall constructs.
     ;; block, critical (F2008).
     ;; Note that "block data" may get somewhat mixed up with F2008 blocks,
     ;; but since the former is obsolete I'm not going to worry about it.
-    '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\|\
-block\\|critical\\)\\)\\>\
-\\([ \t]+\\(\\sw+\\)\\)?"
+    '("\\_<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\|\
+block\\|critical\\)\\)\\_>\
+\\([ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\)?"
       (1 font-lock-keyword-face) (3 font-lock-constant-face nil t))
-    '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\
+    '("^[ \t0-9]*\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\
 do\\([ \t]*while\\)?\\|select[ \t]*\\(?:case\\|type\\)\\|where\\|\
-forall\\|block\\|critical\\)\\)\\>"
+forall\\|block\\|critical\\)\\)\\_>"
       (2 font-lock-constant-face nil t) (3 font-lock-keyword-face))
     ;; Implicit declaration.
-    '("\\<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\
+    '("\\_<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\
 \\|enumerator\\|procedure\\|\
-logical\\|double[ \t]*precision\\|type[ \t]*(\\sw+)\\|none\\)[ \t]*"
+logical\\|double[ \t]*precision\\|type[ \t]*(\\(?:\\sw\\|\\s_\\)+)\\|none\\)[ 
\t]*"
       (1 font-lock-keyword-face) (2 font-lock-type-face))
-    '("\\<\\(namelist\\|common\\)[ \t]*\/\\(\\sw+\\)?\/"
+    '("\\_<\\(namelist\\|common\\)[ \t]*\/\\(\\(?:\\sw\\|\\s_\\)+\\)?\/"
       (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
-    "\\<else\\([ \t]*if\\|where\\)?\\>"
+    "\\_<else\\([ \t]*if\\|where\\)?\\_>"
     '("\\(&\\)[ \t]*\\(!\\|$\\)"  (1 font-lock-keyword-face))
-    "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>"
-    '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>"
+    "\\_<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\_>"
+    '("\\_<\\(exit\\|cycle\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?\\_>"
       (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
-    '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
+    '("\\_<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
     ;; F2003 "class default".
-    '("\\<\\(class\\)[ \t]*default" . 1)
+    '("\\_<\\(class\\)[ \t]*default" . 1)
     ;; F2003 "type is" in a "select type" block.
-    '("\\<\\(\\(type\\|class\\)[ \t]*is\\)[ \t]*(" (1 font-lock-keyword-face 
t))
-    '("\\<\\(do\\|go[ \t]*to\\)\\>[ \t]*\\([0-9]+\\)"
+    '("\\_<\\(\\(type\\|class\\)[ \t]*is\\)[ \t]*(" (1 font-lock-keyword-face 
t))
+    '("\\_<\\(do\\|go[ \t]*to\\)\\_>[ \t]*\\([0-9]+\\)"
       (1 font-lock-keyword-face) (2 font-lock-constant-face))
     ;; Line numbers (lines whose first character after number is letter).
     '("^[ \t]*\\([0-9]+\\)[ \t]*[a-z]+" (1 font-lock-constant-face t))
     ;; Override eg for "#include".
-    '("^#[ \t]*\\w+" (0 font-lock-preprocessor-face t)
-      ("\\<defined\\>" nil nil (0 font-lock-preprocessor-face)))
+    '("^#[ \t]*\\(?:\\sw\\|\\s_\\)+" (0 font-lock-preprocessor-face t)
+      ("\\_<defined\\_>" nil nil (0 font-lock-preprocessor-face)))
     '("^#" ("\\(&&\\|||\\)" nil nil (0 font-lock-constant-face t)))
-    '("^#[ \t]*define[ \t]+\\(\\w+\\)(" (1 font-lock-function-name-face))
-    '("^#[ \t]*define[ \t]+\\(\\w+\\)" (1 font-lock-variable-name-face))
+    '("^#[ \t]*define[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)(" (1 
font-lock-function-name-face))
+    '("^#[ \t]*define[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 
font-lock-variable-name-face))
     '("^#[ \t]*include[ \t]+\\(<.+>\\)" (1 font-lock-string-face))))
   "Highlights declarations, do-loops and other constructs.")
 
@@ -666,9 +666,9 @@
            ;; FIXME why isn't this font-lock-builtin-face, which
            ;; otherwise we hardly use, as in fortran.el?
            (list f90-procedures-re '(1 font-lock-keyword-face keep))
-           "\\<real\\>"                 ; avoid overwriting real defs
+           "\\_<real\\_>"                 ; avoid overwriting real defs
            ;; As an attribute, but not as an optional argument.
-           '("\\<\\(asynchronous\\)[ \t]*[^=]" . 1)))
+           '("\\_<\\(asynchronous\\)[ \t]*[^=]" . 1)))
   "Highlights all F90 keywords and intrinsic procedures.")
 
 (defvar f90-font-lock-keywords-4
@@ -687,8 +687,7 @@
   (let ((table (make-syntax-table)))
     (modify-syntax-entry ?\! "<"  table) ; begin comment
     (modify-syntax-entry ?\n ">"  table) ; end comment
-    ;; FIXME: This goes against the convention: it should be "_".
-    (modify-syntax-entry ?_  "w"  table) ; underscore in names
+    (modify-syntax-entry ?_  "_"  table) ; underscore in names
     (modify-syntax-entry ?\' "\"" table) ; string quote
     (modify-syntax-entry ?\" "\"" table) ; string quote
     ;; FIXME: We used to set ` to word syntax for the benefit of abbrevs, but
@@ -850,7 +849,7 @@
                         "enum" "associate"
                         ;; F2008.
                         "submodule" "block" "critical"))
-          "\\)\\>")
+          "\\)\\_>")
   "Regexp potentially indicating a \"block\" of F90 code.")
 
 (defconst f90-program-block-re
@@ -866,15 +865,15 @@
 (defconst f90-end-if-re
   (concat "end[ \t]*"
           (regexp-opt '("if" "select" "where" "forall") 'paren)
-          "\\>")
+          "\\_>")
   "Regexp matching the end of an IF, SELECT, WHERE, FORALL block.")
 
 (defconst f90-end-type-re
-  "end[ \t]*\\(type\\|enum\\|interface\\|block[ \t]*data\\)\\>"
+  "end[ \t]*\\(type\\|enum\\|interface\\|block[ \t]*data\\)\\_>"
   "Regexp matching the end of a TYPE, ENUM, INTERFACE, BLOCK DATA section.")
 
 (defconst f90-end-associate-re
-  "end[ \t]*associate\\>"
+  "end[ \t]*associate\\_>"
   "Regexp matching the end of an ASSOCIATE block.")
 
 ;; This is for a TYPE block, not a variable of derived TYPE.
@@ -885,12 +884,12 @@
   ;; type, stuff :: word
   ;; type, bind(c) :: word
   ;; NOT "type ("
-  "\\<\\(type\\)\\>\\(?:\\(?:[^()\n]*\\|\
-.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\sw+\\)"
+  "\\_<\\(type\\)\\_>\\(?:\\(?:[^()\n]*\\|\
+.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ 
\t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
   "Regexp matching the definition of a derived type.")
 
 (defconst f90-typeis-re
-  "\\<\\(class\\|type\\)[ \t]*is[ \t]*("
+  "\\_<\\(class\\|type\\)[ \t]*is[ \t]*("
   "Regexp matching a CLASS/TYPE IS statement.")
 
 (defconst f90-no-break-re
@@ -909,12 +908,12 @@
 
 ;; Hideshow support.
 (defconst f90-end-block-re
-  (concat "^[ \t0-9]*\\<end[ \t]*"
+  (concat "^[ \t0-9]*\\_<end[ \t]*"
           (regexp-opt '("do" "if" "forall" "function" "interface"
                         "module" "program" "select" "subroutine"
                         "type" "where" "enum" "associate" "submodule"
                         "block" "critical") t)
-          "\\>")
+          "\\_>")
   "Regexp matching the end of an F90 \"block\", from the line start.
 Used in the F90 entry in `hs-special-modes-alist'.")
 
@@ -924,11 +923,11 @@
   (concat
    "^[ \t0-9]*"                         ; statement number
    "\\(\\("
-   "\\(\\sw+[ \t]*:[ \t]*\\)?"          ; structure label
+   "\\(\\(?:\\sw\\|\\s_\\)+[ \t]*:[ \t]*\\)?"          ; structure label
    "\\(do\\|select[ \t]*\\(case\\|type\\)\\|"
    ;; See comments in fortran-start-block-re for the problems of IF.
    "if[ \t]*(\\(.*\\|"
-   ".*\n\\([^if]*\\([^i].\\|.[^f]\\|.\\>\\)\\)\\)\\<then\\|"
+   ".*\n\\([^if]*\\([^i].\\|.[^f]\\|.\\_>\\)\\)\\)\\_<then\\|"
    ;; Distinguish WHERE block from isolated WHERE.
    "\\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)\\)\\)"
    "\\|"
@@ -938,7 +937,7 @@
    "type[ \t,]\\("
    "[^i(!\n\"\& \t]\\|"                 ; not-i(
    "i[^s!\n\"\& \t]\\|"                 ; i not-s
-   "is\\sw\\)\\|"
+   "is\\(?:\\sw\\|\\s_\\)\\)\\|"
    ;; "abstract interface" is F2003; "submodule" is F2008.
    "program\\|\\(?:abstract[ \t]*\\)?interface\\|\\(?:sub\\)?module\\|"
    ;; "enum", but not "enumerator".
@@ -966,10 +965,10 @@
                 (not (setq found
                            (save-excursion
                              (goto-char (match-end 0))
-                             (unless (looking-at "\\(is\\>\\|(\\)")
-                               (or (looking-at "\\(\\sw+\\)")
+                             (unless (looking-at "\\(is\\_>\\|(\\)")
+                               (or (looking-at "\\(\\(?:\\sw\\|\\s_\\)+\\)")
                                    (re-search-forward
-                                    "[ \t]*::[ \t]*\\(\\sw+\\)"
+                                    "[ \t]*::[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
                                     (line-end-position) t))))))))
     found))
 
@@ -978,36 +977,35 @@
         (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]")
         ;; (not-ib "[^i(!\n\"\& \t]") (not-s "[^s!\n\"\& \t]")
         )
-    (list
-     '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1)
-     '("Submodules" "^[ \t0-9]*submodule[ \t]*([^)\n]+)[ \t]*\
-\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1)
-     '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1)
-     (list "Types" 'f90-imenu-type-matcher 1)
-     ;; Does not handle: "type[, stuff] :: foo".
-;;;      (format "^[ \t0-9]*type[ \t]+\\(\\(%s\\|i%s\\|is\\sw\\)\\sw*\\)"
-;;;              not-ib not-s)
-;;;      1)
-     ;; Can't get the subexpression numbers to match in the two branches.
-;;;      (format "^[ \t0-9]*type\\([ \t]*,.*\\(::\\)[ \t]*\\(\\sw+\\)\\|[ 
\t]+\\(\\(%s\\|i%s\\|is\\sw\\)\\sw*\\)\\)" not-ib not-s)
-;;;      3)
-     (list
-      "Procedures"
-      (concat
-       "^[ \t0-9]*"
-       "\\("
-       ;; At least three non-space characters before function/subroutine.
-       ;; Check that the last three non-space characters do not spell E N D.
-       "[^!\"\&\n]*\\("
-       not-e good-char good-char "\\|"
-       good-char not-n good-char "\\|"
-       good-char good-char not-d "\\)"
-       "\\|"
-       ;; Less than three non-space characters before function/subroutine.
-       good-char "?" good-char "?"
-       "\\)"
-       "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)")
-      4)))
+    `((nil "^[ \t0-9]*program[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)" 1)
+      ("Submodules" "^[ \t0-9]*submodule[ \t]*([^)\n]+)[ \t]*\
+\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*\\(!\\|$\\)" 1)
+      ("Modules" "^[ \t0-9]*module[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)[ 
\t]*\\(!\\|$\\)" 1)
+      '("Types" f90-imenu-type-matcher 1)
+      ;; Does not handle: "type[, stuff] :: foo".
+      ;;(format "^[ \t0-9]*type[ 
\t]+\\(\\(%s\\|i%s\\|is\\(?:\\sw\\|\\s_\\)\\)\\(?:\\sw\\|\\s_\\)*\\)"
+      ;;        not-ib not-s)
+      ;;1)
+      ;; Can't get the subexpression numbers to match in the two branches.
+      ;; FIXME: Now with \(?N:..\) we can get the numbers to match!
+      ;;(format "^[ \t0-9]*type\\([ \t]*,.*\\(::\\)[ 
\t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\|[ 
\t]+\\(\\(%s\\|i%s\\|is\\(?:\\sw\\|\\s_\\)\\)\\(?:\\sw\\|\\s_\\)*\\)\\)" not-ib 
not-s)
+      ;;3)
+      ("Procedures"
+       ,(concat
+         "^[ \t0-9]*"
+         "\\("
+         ;; At least three non-space characters before function/subroutine.
+         ;; Check that the last three non-space characters do not spell E N D.
+         "[^!\"\&\n]*\\("
+         not-e good-char good-char "\\|"
+         good-char not-n good-char "\\|"
+         good-char good-char not-d "\\)"
+         "\\|"
+         ;; Less than three non-space characters before function/subroutine.
+         good-char "?" good-char "?"
+         "\\)"
+         "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)")
+       4)))
   "Value for `imenu-generic-expression' in F90 mode.")
 
 (defun f90-add-imenu-menu ()
@@ -1144,7 +1142,7 @@
   whether to blink the matching beginning (default 'blink).
 `f90-auto-keyword-case'
   Automatic change of case of keywords (default nil).
-  The possibilities are 'downcase-word, 'upcase-word, 'capitalize-word.
+  The possibilities are `downcase-word', `upcase-word', `capitalize-word'.
 `f90-leave-line-no'
   Do not left-justify line numbers (default nil).
 
@@ -1256,13 +1254,13 @@
 (defsubst f90-looking-at-do ()
   "Return (\"do\" NAME) if a do statement starts after point.
 NAME is nil if the statement has no label."
-  (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(do\\)\\>")
+  (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\\(do\\)\\_>")
       (list (match-string 3) (match-string 2))))
 
 (defsubst f90-looking-at-select-case ()
   "Return (\"select\" NAME) if a select statement starts after point.
 NAME is nil if the statement has no label."
-  (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\
+  (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\
 \\(select\\)[ \t]*\\(case\\|type\\)[ \t]*(")
       (list (match-string 3) (match-string 2))))
 
@@ -1270,50 +1268,50 @@
   "Return (\"if\" NAME) if an if () then statement starts after point.
 NAME is nil if the statement has no label."
   (save-excursion
-    (when (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(if\\)\\>")
+    (when (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ 
\t]*\\(if\\)\\_>")
       (let ((struct (match-string 3))
             (label (match-string 2))
             (pos (scan-lists (point) 1 0)))
         (and pos (goto-char pos))
         (skip-chars-forward " \t")
-        (if (or (looking-at "then\\>")
+        (if (or (looking-at "then\\_>")
                 (when (f90-line-continued)
                   (f90-next-statement)
                   (skip-chars-forward " \t0-9&")
-                  (looking-at "then\\>")))
+                  (looking-at "then\\_>")))
             (list struct label))))))
 
 ;; FIXME label?
 (defsubst f90-looking-at-associate ()
   "Return (\"associate\") if an associate block starts after point."
-  (if (looking-at "\\<\\(associate\\)[ \t]*(")
+  (if (looking-at "\\_<\\(associate\\)[ \t]*(")
       (list (match-string 1))))
 
 (defsubst f90-looking-at-critical ()
   "Return (KIND NAME) if a critical or block block starts after point."
-  (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(critical\\|block\\)\\>")
+  (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ 
\t]*\\(critical\\|block\\)\\_>")
       (let ((struct (match-string 3))
             (label (match-string 2)))
         (if (or (not (string-equal "block" struct))
                 (save-excursion
                   (skip-chars-forward " \t")
-                  (not (looking-at "data\\>"))))
+                  (not (looking-at "data\\_>"))))
             (list struct label)))))
 
 (defsubst f90-looking-at-end-critical ()
   "Return non-nil if a critical or block block ends after point."
-  (if (looking-at "end[ \t]*\\(critical\\|block\\)\\>")
+  (if (looking-at "end[ \t]*\\(critical\\|block\\)\\_>")
       (or (not (string-equal "block" (match-string 1)))
           (save-excursion
             (skip-chars-forward " \t")
-            (not (looking-at "data\\>"))))))
+            (not (looking-at "data\\_>"))))))
 
 (defsubst f90-looking-at-where-or-forall ()
   "Return (KIND NAME) if a where or forall block starts after point.
 NAME is nil if the statement has no label."
   (save-excursion
-    (when (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\
-\\(where\\|forall\\)\\>")
+    (when (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\
+\\(where\\|forall\\)\\_>")
       (let ((struct (match-string 3))
             (label (match-string 2))
             (pos (scan-lists (point) 1 0)))
@@ -1326,43 +1324,43 @@
 NAME is non-nil only for type and certain interfaces."
   (cond
    ((save-excursion
-      (and (looking-at "\\<type\\>[ \t]*")
+      (and (looking-at "\\_<type\\_>[ \t]*")
            (goto-char (match-end 0))
-           (not (looking-at "\\(is\\>\\|(\\)"))
-           (or (looking-at "\\(\\sw+\\)")
-               (re-search-forward "[ \t]*::[ \t]*\\(\\sw+\\)"
+           (not (looking-at "\\(is\\_>\\|(\\)"))
+           (or (looking-at "\\(\\(?:\\sw\\|\\s_\\)+\\)")
+               (re-search-forward "[ \t]*::[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
                                   (line-end-position) t))))
     (list "type" (match-string 1)))
 ;;;    ((and (not (looking-at f90-typeis-re))
 ;;;          (looking-at f90-type-def-re))
 ;;;     (list (match-string 1) (match-string 2)))
-   ((looking-at "\\<\\(interface\\)\\>[ \t]*")
+   ((looking-at "\\_<\\(interface\\)\\_>[ \t]*")
     (list (match-string 1)
           (save-excursion
             (goto-char (match-end 0))
             (if (or (looking-at "\\(operator\\|assignment\\|read\\|\
 write\\)[ \t]*([^)\n]*)")
-                    (looking-at "\\sw+"))
+                    (looking-at "\\(?:\\sw\\|\\s_\\)+"))
                 (match-string 0)))))
-   ((looking-at "\\(enum\\|block[ \t]*data\\)\\>")
+   ((looking-at "\\(enum\\|block[ \t]*data\\)\\_>")
     (list (match-string 1) nil))
-   ((looking-at "abstract[ \t]*\\(interface\\)\\>")
+   ((looking-at "abstract[ \t]*\\(interface\\)\\_>")
     (list (match-string 1) nil))))
 
 (defsubst f90-looking-at-program-block-start ()
   "Return (KIND NAME) if a program block with name NAME starts after point."
 ;;;NAME is nil for an un-named main PROGRAM block."
   (cond
-   ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
-    (list (match-string 1) (match-string 2)))
-   ((and (not (looking-at "module[ \t]*procedure\\>"))
-         (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
-    (list (match-string 1) (match-string 2)))
-   ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\sw+\\)\\>")
+   ((looking-at "\\(program\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")
+    (list (match-string 1) (match-string 2)))
+   ((and (not (looking-at "module[ \t]*procedure\\_>"))
+         (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"))
+    (list (match-string 1) (match-string 2)))
+   ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ 
\t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")
     (list (match-string 1) (match-string 2)))
    ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
          (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\
-\\(\\sw+\\)"))
+\\(\\(?:\\sw\\|\\s_\\)+\\)"))
     (list (match-string 1) (match-string 2)))))
 ;; Following will match an un-named main program block; however
 ;; one needs to check if there is an actual PROGRAM statement after
@@ -1378,7 +1376,7 @@
 \\(?:assignment\\|operator\\|read\\|write\\)[ \t]*([^)\n]*)\\)")
          (list (match-string 1) (match-string 2)))
         ((looking-at (concat "end[ \t]*" f90-blocks-re
-                             "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
+                             "?\\([ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\)?\\_>"))
         (list (match-string 1) (match-string 3)))))
 
 (defsubst f90-comment-indent ()
@@ -1435,10 +1433,10 @@
     (not (or (looking-at "end")
              (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
 \\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
-block\\|critical\\)\\>")
+block\\|critical\\)\\_>")
              (looking-at "\\(program\\|\\(?:sub\\)?module\\|\
-\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\>")
-             (looking-at "\\(contains\\|\\sw+[ \t]*:\\)")
+\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
+             (looking-at "\\(contains\\|\\(?:\\sw\\|\\s_\\)+[ \t]*:\\)")
              (looking-at f90-type-def-re)
              (re-search-forward "\\(function\\|subroutine\\)"
                                 (line-end-position) t)))))
@@ -1504,7 +1502,7 @@
                (setq icol (- icol f90-associate-indent)))
               ((f90-looking-at-end-critical)
                (setq icol (- icol f90-critical-indent)))
-              ((looking-at "end[ \t]*do\\>")
+              ((looking-at "end[ \t]*do\\_>")
                (setq icol (- icol f90-do-indent))))
         (end-of-line))
       icol)))
@@ -1571,7 +1569,7 @@
                         (cond ((or (looking-at f90-else-like-re)
                                    (looking-at f90-end-if-re))
                                (setq icol (- icol f90-if-indent)))
-                              ((looking-at "end[ \t]*do\\>")
+                              ((looking-at "end[ \t]*do\\_>")
                                (setq icol (- icol f90-do-indent)))
                               ((looking-at f90-end-type-re)
                                (setq icol (- icol f90-type-indent)))
@@ -1692,7 +1690,7 @@
              (setq start-list (cons start-this start-list) ; not add-to-list!
                    count (1+ count)))
             ((looking-at (concat "end[ \t]*" f90-blocks-re
-                                 "[ \t]*\\(\\sw+\\)?"))
+                                 "[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"))
              (setq end-type (match-string 1)
                    end-label (match-string 2)
                    count (1- count))
@@ -1737,7 +1735,7 @@
       (skip-chars-forward " \t0-9")
       (cond ((or (f90-in-string) (f90-in-comment)))
             ((looking-at (concat "end[ \t]*" f90-blocks-re
-                                 "[ \t]*\\(\\sw+\\)?"))
+                                 "[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"))
              (setq end-list (cons (list (match-string 1) (match-string 2))
                                   end-list)
                    count (1+ count)))
@@ -1983,7 +1981,7 @@
                                     (car end-struct) (cadr end-struct))))
              (setq ind-b
                    (cond ((looking-at f90-end-if-re) f90-if-indent)
-                         ((looking-at "end[ \t]*do\\>")  f90-do-indent)
+                         ((looking-at "end[ \t]*do\\_>")  f90-do-indent)
                          ((looking-at f90-end-type-re) f90-type-indent)
                          ((looking-at f90-end-associate-re)
                           f90-associate-indent)

=== modified file 'lisp/progmodes/ld-script.el'
--- a/lisp/progmodes/ld-script.el       2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/ld-script.el       2013-05-08 16:27:53 +0000
@@ -48,7 +48,7 @@
     (modify-syntax-entry ?\) ")(" st)
     (modify-syntax-entry ?\[ "(]" st)
     (modify-syntax-entry ?\] ")[" st)
-    (modify-syntax-entry ?_ "w"   st)
+    (modify-syntax-entry ?_ "_"   st)
     (modify-syntax-entry ?. "_"   st)
     (modify-syntax-entry ?\\  "\\" st)
     (modify-syntax-entry ?: "." st)
@@ -154,10 +154,10 @@
 
 (defvar ld-script-font-lock-keywords
   (append
-   `((,(regexp-opt ld-script-keywords 'words)
-      1 font-lock-keyword-face)
-     (,(regexp-opt ld-script-builtins 'words)
-      1 font-lock-builtin-face)
+   `((,(concat "\\_<" (regexp-opt ld-script-keywords) "\\_>")
+      0 font-lock-keyword-face)
+     (,(concat "\\_<" (regexp-opt ld-script-builtins) "\\_>")
+      0 font-lock-builtin-face)
      ;; 3.6.7 Output Section Discarding
      ;; 3.6.4.1 Input Section Basics
      ;; 3.6.8.7 Output Section Phdr

=== modified file 'lisp/progmodes/m4-mode.el'
--- a/lisp/progmodes/m4-mode.el 2013-05-08 06:56:37 +0000
+++ b/lisp/progmodes/m4-mode.el 2013-05-08 16:27:53 +0000
@@ -88,8 +88,12 @@
     (modify-syntax-entry ?\n ">#" table)
     (modify-syntax-entry ?{  "_" table)
     (modify-syntax-entry ?}  "_" table)
+    ;; FIXME: This symbol syntax for underscore looks OK on its own, but it's
+    ;; odd that it should have the same syntax as { and } are these really
+    ;; valid in m4 symbols?
+    (modify-syntax-entry ?_  "_" table)
+    ;; FIXME: These three chars with word syntax look wrong.
     (modify-syntax-entry ?*  "w" table)
-    (modify-syntax-entry ?_  "_" table)
     (modify-syntax-entry ?\"  "w" table)
     (modify-syntax-entry ?\"  "w" table)
     table)

=== modified file 'lisp/progmodes/meta-mode.el'
--- a/lisp/progmodes/meta-mode.el       2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/meta-mode.el       2013-05-08 16:27:53 +0000
@@ -794,6 +794,7 @@
 
 (defvar meta-common-mode-syntax-table
   (let ((st (make-syntax-table)))
+    ;; FIXME: This goes against the convention!
     ;; underscores are word constituents
     (modify-syntax-entry ?_  "w"  st)
     ;; miscellaneous non-word symbols

=== modified file 'lisp/progmodes/prolog.el'
--- a/lisp/progmodes/prolog.el  2013-04-20 16:24:04 +0000
+++ b/lisp/progmodes/prolog.el  2013-05-08 16:27:53 +0000
@@ -772,6 +772,8 @@
   :version "24.1"
   :group 'prolog-other
   :type 'boolean)
+(make-obsolete-variable 'prolog-underscore-wordchar-flag
+                        'superword-mode "24.4")
 
 (defcustom prolog-use-sicstus-sd nil
   "If non-nil, use the source level debugger of SICStus 3#7 and later."
@@ -785,6 +787,7 @@
   :version "24.1"
   :group 'prolog-other
   :type 'boolean)
+(make-obsolete-variable 'prolog-char-quote-workaround nil "24.1")
 
 
 ;;-------------------------------------------------------------------
@@ -802,10 +805,7 @@
   ;; - In atoms \x<hex> sometimes needs a terminating \ (ISO-style)
   ;;   and sometimes not.
   (let ((table (make-syntax-table)))
-    (if prolog-underscore-wordchar-flag
-        (modify-syntax-entry ?_ "w" table)
-      (modify-syntax-entry ?_ "_" table))
-
+    (modify-syntax-entry ?_ (if prolog-underscore-wordchar-flag "w" "_") table)
     (modify-syntax-entry ?+ "." table)
     (modify-syntax-entry ?- "." table)
     (modify-syntax-entry ?= "." table)
@@ -815,7 +815,8 @@
     (modify-syntax-entry ?\' "\"" table)
 
     ;; Any better way to handle the 0'<char> construct?!?
-    (when prolog-char-quote-workaround
+    (when (and prolog-char-quote-workaround
+               (not (fboundp 'syntax-propertize-rules)))
       (modify-syntax-entry ?0 "\\" table))
 
     (modify-syntax-entry ?% "<" table)

=== modified file 'lisp/progmodes/vera-mode.el'
--- a/lisp/progmodes/vera-mode.el       2013-02-23 21:54:00 +0000
+++ b/lisp/progmodes/vera-mode.el       2013-05-08 16:27:53 +0000
@@ -101,6 +101,8 @@
 are treated as single words otherwise."
   :type 'boolean
   :group 'vera)
+(make-obsolete-variable 'vera-underscore-is-part-of-word
+                        'superword-mode "24.4")
 
 (defcustom vera-intelligent-tab t
   "Non-nil means `TAB' does indentation, word completion and tab insertion.

=== modified file 'lisp/progmodes/verilog-mode.el'
--- a/lisp/progmodes/verilog-mode.el    2013-02-12 17:36:54 +0000
+++ b/lisp/progmodes/verilog-mode.el    2013-05-08 16:27:53 +0000
@@ -2784,6 +2784,8 @@
     (modify-syntax-entry ?> "." table)
     (modify-syntax-entry ?& "." table)
     (modify-syntax-entry ?| "." table)
+    ;; FIXME: This goes against Emacs conventions.  Use "_" syntax instead and
+    ;; then use regexps with things like "\\_<...\\_>".
     (modify-syntax-entry ?` "w" table)
     (modify-syntax-entry ?_ "w" table)
     (modify-syntax-entry ?\' "." table)

=== modified file 'lisp/progmodes/vhdl-mode.el'
--- a/lisp/progmodes/vhdl-mode.el       2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/vhdl-mode.el       2013-05-08 16:27:53 +0000
@@ -1872,14 +1872,11 @@
   "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 @@
                       (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 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]