]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/vhdl-mode.el
Sync with upstream vhdl mode v3.38.1.
[gnu-emacs] / lisp / progmodes / vhdl-mode.el
index 875de3b865c1be99424fb4b780a9bc94a701cb38..a390494ebf5c7017fc5c732f255a4e8c6d83bf2d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vhdl-mode.el --- major mode for editing VHDL code
 
-;; Copyright (C) 1992-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2016 Free Software Foundation, Inc.
 
 ;; Authors:     Reto Zimmermann <reto@gnu.org>
 ;;              Rodney J. Whitby <software.vhdl-mode@rwhitby.net>
 ;; filed in the Emacs bug reporting system against this file, a copy
 ;; of the bug report be sent to the maintainer's email address.
 
-(defconst vhdl-version "3.36.1"
+(defconst vhdl-version "3.38.1"
   "VHDL Mode version number.")
 
-(defconst vhdl-time-stamp "2014-11-27"
+(defconst vhdl-time-stamp "2015-03-12"
   "VHDL Mode time stamp for last update.")
 
 ;; This file is part of GNU Emacs.
@@ -59,7 +59,7 @@
 ;;   - Block commenting
 ;;   - Code fixing/alignment/beautification
 ;;   - PostScript printing
-;;   - VHDL'87/'93 and VHDL-AMS supported
+;;   - VHDL'87/'93/'02/'08 and VHDL-AMS supported
 ;;   - Comprehensive menu
 ;;   - Fully customizable
 ;;   - Works under GNU Emacs (recommended) and XEmacs
 '/' or is empty)."
   (let ((val (widget-value widget)))
     (unless (string-match "^\\(\\|.*/\\)$" val)
-      (widget-put widget :error "Invalid directory entry: must end with '/'")
+      (widget-put widget :error "Invalid directory entry: must end with `/'")
       widget)))
 
 ;; help string for user options
@@ -266,9 +266,14 @@ Overrides local variable `indent-tabs-mode'."
     ;; WARNING[2]: test.vhd(85): Possible infinite loop
     ;; ** Warning: [4] ../src/emacsvsim.vhd(43): An abstract ...
     ;; ** Error: adder.vhd(190): Unknown identifier: ctl_numb
+    ;; ** Error: counter_rtl.vhd(18): Nonresolved signal 'hallo' has multiple sources.
+    ;;  Drivers:
+    ;;    counter_rtl.vhd(27):Conditional signal assignment line__27
+    ;;    counter_rtl.vhd(29):Conditional signal assignment line__29
     ("ModelSim" "vcom" "-93 -work \\1" "make" "-f \\1"
      nil "vlib \\1; vmap \\2 \\1" "./" "work/" "Makefile" "modelsim"
-     ("^\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*:\\( *\[[0-9]+\]\\)? \\([^ \t\n]+\\)(\\([0-9]+\\)):" 3 4 nil) ("" 0)
+     ("\\(ERROR:\\|WARNING\\[[0-9]+\\]:\\|\\*\\* Error:\\|\\*\\* Warning: \\[[0-9]+\\]\\| +\\) \\([^ ]+\\)(\\([0-9]+\\)):" 2 3 nil)
+     ("" 0)
      ("\\1/_primary.dat" "\\2/\\1.dat" "\\1/_primary.dat"
       "\\1/_primary.dat" "\\1/body.dat" downcase))
     ;; ProVHDL, Synopsys LEDA: provhdl -w work -f test.vhd
@@ -315,7 +320,7 @@ Overrides local variable `indent-tabs-mode'."
     ;;     ERROR[11]::File test.vhd Line 100: Use of undeclared identifier
     ("Speedwave" "analyze" "-libfile vsslib.ini -src" "make" "-f \\1"
      nil "mkdir \\1" "./" "work/" "Makefile" "speedwave"
-     ("^ *ERROR\[[0-9]+\]::File \\([^ \t\n]+\\) Line \\([0-9]+\\):" 1 2 nil) ("" 0)
+     ("^ *ERROR\\[[0-9]+]::File \\([^ \t\n]+\\) Line \\([0-9]+\\):" 1 2 nil) ("" 0)
      nil)
     ;; Synopsys, VHDL Analyzer (sim): vhdlan -nc test.vhd
     ;; **Error: vhdlan,703 test.vhd(22): OTHERS is not legal in this context.
@@ -364,7 +369,7 @@ Overrides local variable `indent-tabs-mode'."
     ;; ERROR:HDLParsers:164 - "test.vhd" Line 3. parse error
     ("Xilinx XST" "xflow" "" "make" "-f \\1"
      nil "mkdir \\1" "./" "work/" "Makefile" "xilinx"
-     ("^ERROR:HDLParsers:[0-9]+ - \"\\([^ \t\n]+\\)\" Line \\([0-9]+\\)\." 1 2 nil) ("" 0)
+     ("^ERROR:HDLParsers:[0-9]+ - \"\\([^ \t\n]+\\)\" Line \\([0-9]+\\)\\." 1 2 nil) ("" 0)
      nil)
     )
   "List of available VHDL compilers and their properties.
@@ -376,8 +381,8 @@ Compiler:
   Make command     : command used for compilation using a Makefile
   Make options     : make options (\"\\1\" inserts Makefile name)
   Generate Makefile: use built-in function or command to generate a Makefile
-                     \(\"\\1\" inserts Makefile name, \"\\2\" inserts library name)
-  Library command  : command to create library directory \(\"\\1\" inserts
+                     (\"\\1\" inserts Makefile name, \"\\2\" inserts library name)
+  Library command  : command to create library directory (\"\\1\" inserts
                      library directory, \"\\2\" inserts library name)
   Compile directory: where compilation is run and the Makefile is placed
   Library directory: directory of default library
@@ -519,9 +524,9 @@ with other user Makefiles."
 Allows you to insert user specific parts into a Makefile.
 
 Example:
-  \(lambda nil
-    \(re-search-backward \"^# Rule for compiling entire design\")
-    \(insert \"# My target\\n\\n.MY_TARGET :\\n\\n\\n\"))"
+  (lambda nil
+    (re-search-backward \"^# Rule for compiling entire design\")
+    (insert \"# My target\\n\\n.MY_TARGET :\\n\\n\\n\"))"
   :type 'hook
   :group 'vhdl-compile)
 
@@ -573,7 +578,7 @@ Is overwritten by project settings if a project is active."
                         \"\\3\" project-specific options)
       - Do not compile: do not compile this file (in Makefile)
   Compile directory: where compilation is run and the Makefile is placed
-                     \(\"\\1\" inserts compiler ID string)
+                     (\"\\1\" inserts compiler ID string)
   Library name     : name of library (default is \"work\")
   Library directory: path to library (\"\\1\" inserts compiler ID string)
   Makefile name    : name of Makefile
@@ -585,7 +590,7 @@ option `vhdl-file-header').
 
 The default directory must have an absolute path (use `M-TAB' for completion).
 All other paths can be absolute or relative to the default directory.  All
-paths must end with '/'.
+paths must end with `/'.
 
 The design units found in the sources (files and directories) are shown in the
 hierarchy browser.  Path and file name can contain wildcards `*' and `?' as
@@ -716,6 +721,7 @@ A project setup file can be obtained by exporting a project (see menu).
 Basic standard:
   VHDL'87      : IEEE Std 1076-1987
   VHDL'93/02   : IEEE Std 1076-1993/2002
+  VHDL'08      : IEEE Std 1076-2008
 Additional standards:
   VHDL-AMS     : IEEE Std 1076.1 (analog-mixed-signal)
   Math packages: IEEE Std 1076.2 (`math_real', `math_complex')
@@ -724,7 +730,8 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
       \"Activate Options\"."
   :type '(list (choice :tag "Basic standard"
                       (const :tag "VHDL'87" 87)
-                      (const :tag "VHDL'93/02" 93))
+                      (const :tag "VHDL'93/02" 93)
+                      (const :tag "VHDL'08" 08))
               (set :tag "Additional standards" :indent 2
                    (const :tag "VHDL-AMS" ams)
                    (const :tag "Math packages" math)))
@@ -942,6 +949,12 @@ If nil, only a list of actual parameters is entered."
   :type 'boolean
   :group 'vhdl-template)
 
+(defcustom vhdl-sensitivity-list-all t
+  "Non-nil means use `all' keyword in sensitivity list."
+  :version "25.1"
+  :type 'boolean
+  :group 'vhdl-template)
+
 (defcustom vhdl-zero-string "'0'"
   "String to use for a logic zero."
   :type 'string
@@ -989,7 +1002,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',`mail-host-address', `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'
@@ -1095,7 +1108,7 @@ Otherwise, falling edge triggers."
 
 (defcustom vhdl-clock-edge-condition 'standard
   "Syntax of the clock edge condition.
-  Standard: \"clk'event and clk = '1'\"
+  Standard: \"clk\\='event and clk = \\='1\\='\"
   Function: \"rising_edge(clk)\""
   :type '(choice (const :tag "Standard" standard)
                 (const :tag "Function" function))
@@ -1670,8 +1683,8 @@ syntax (as regular expression) are highlighted in the corresponding color.
 
   Name         : string of words and spaces
   Regexp       : regular expression describing word syntax
-                 (e.g. \"\\\\=\<\\\w+_c\\\\=\>\" matches word with suffix \"_c\")
-                 expression must start with \"\\\\=\<\" and end with \"\\\\=\>\"
+                 (e.g., `\\=\\<\\w+_c\\>' matches word with suffix `_c')
+                 expression must start with `\\=\\<' and end with `\\>'
                  if only whole words should be matched (no substrings)
   Color (light): foreground color for light background
                  (matching color examples: Gold3, Grey50, LimeGreen, Tomato,
@@ -1682,14 +1695,14 @@ syntax (as regular expression) are highlighted in the corresponding color.
   In comments  : If non-nil, words are also highlighted inside comments
 
 Can be used for visual support of naming conventions, such as highlighting
-different kinds of signals (e.g. \"Clk50\", \"Rst_n\") or objects (e.g.
-\"Signal_s\", \"Variable_v\", \"Constant_c\") by distinguishing them using
+different kinds of signals (e.g. `Clk50', `Rst_n') or objects (e.g.
+`Signal_s', `Variable_v', `Constant_c') by distinguishing them using
 common substrings or name suffices.
 For each entry, a new face is generated with the specified colors and name
-\"vhdl-font-lock-\" + name + \"-face\".
+`vhdl-font-lock-' + name + `-face'.
 
 NOTE: Activate a changed regexp in a VHDL buffer by re-fontifying it (menu
-      entry \"Fontify Buffer\").  All other changes require restarting Emacs."
+      entry `Fontify Buffer').  All other changes require restarting Emacs."
   :type '(repeat (list :tag "Face" :indent 2
                       (string :tag "Name         ")
                       (regexp :tag "Regexp       " "\\w+_")
@@ -1728,7 +1741,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
                          'vhdl-words-init 'vhdl-font-lock-init))
   :group 'vhdl-highlight)
 
-(defcustom vhdl-directive-keywords '("pragma" "synopsys")
+(defcustom vhdl-directive-keywords '("psl" "pragma" "synopsys")
   "List of compiler directive keywords recognized for highlighting.
 
 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
@@ -2001,6 +2014,8 @@ reported and the syntactic symbol is ignored.")
     (package              . 0)
     (architecture         . 0)
     (package-body         . 0)
+    (context              . 0)
+    (directive            . 0)
     )
   "Default settings for offsets of syntactic elements.
 Do not change this constant!  See the variable `vhdl-offsets-alist' for
@@ -2065,7 +2080,8 @@ Here is the current list of valid syntactic element symbols:
  configuration          -- inside a configuration declaration
  package                -- inside a package declaration
  architecture           -- inside an architecture body
- package-body           -- inside a package body")
+ package-body           -- inside a package body
+ context                -- inside a context declaration")
 
 (defvar vhdl-comment-only-line-offset 0
   "Extra offset for line which contains only the start of a comment.
@@ -2294,11 +2310,12 @@ Ignore byte-compiler warnings you might see."
 
 (defun vhdl-warning-when-idle (&rest args)
   "Wait until idle, then print out warning STRING and beep."
-  (if noninteractive
-      (vhdl-warning (apply 'format args) t)
-    (unless vhdl-warnings
-      (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
-    (push (apply 'format args) vhdl-warnings)))
+  (let ((message (apply #'format-message args)))
+    (if noninteractive
+        (vhdl-warning message t)
+      (unless vhdl-warnings
+        (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
+      (push message vhdl-warnings))))
 
 (defun vhdl-warning (string &optional nobeep)
   "Print out warning STRING and beep."
@@ -2465,7 +2482,7 @@ current buffer if no project is defined."
     default-directory))
 
 (defmacro vhdl-prepare-search-1 (&rest body)
-  "Enable case insensitive search and switch to syntax table that includes '_',
+  "Enable case insensitive search and switch to syntax table that includes `_',
 then execute BODY, and finally restore the old environment.  Used for
 consistent searching."
   `(let ((case-fold-search t))         ; case insensitive search
@@ -2474,38 +2491,19 @@ consistent searching."
        ,@body)))
 
 (defmacro vhdl-prepare-search-2 (&rest body)
-  "Enable case insensitive search, switch to syntax table that includes '_',
-and remove `intangible' overlays, then execute BODY, and finally restore the
-old environment.  Used for consistent searching."
-  ;; FIXME: Why not just let-bind `inhibit-point-motion-hooks'?  --Stef
+  "Enable case insensitive search, switch to syntax table that includes `_',
+arrange to ignore `intangible' overlays, then execute BODY, and finally restore
+the old environment.  Used for consistent searching."
   `(let ((case-fold-search t)          ; case insensitive search
         (current-syntax-table (syntax-table))
-        overlay-all-list overlay-intangible-list overlay)
+         (inhibit-point-motion-hooks t))
      ;; use extended syntax table
      (set-syntax-table vhdl-mode-ext-syntax-table)
-     ;; remove `intangible' overlays
-     (when (fboundp 'overlay-lists)
-       (setq overlay-all-list (overlay-lists))
-       (setq overlay-all-list
-            (append (car overlay-all-list) (cdr overlay-all-list)))
-       (while overlay-all-list
-        (setq overlay (car overlay-all-list))
-        (when (memq 'intangible (overlay-properties overlay))
-          (setq overlay-intangible-list
-                (cons overlay overlay-intangible-list))
-          (overlay-put overlay 'intangible nil))
-        (setq overlay-all-list (cdr overlay-all-list))))
      ;; execute BODY safely
      (unwind-protect
          (progn ,@body)
        ;; restore syntax table
-       (set-syntax-table current-syntax-table)
-       ;; restore `intangible' overlays
-       (when (fboundp 'overlay-lists)
-         (while overlay-intangible-list
-           (overlay-put (car overlay-intangible-list) 'intangible t)
-           (setq overlay-intangible-list
-                 (cdr overlay-intangible-list)))))))
+       (set-syntax-table current-syntax-table))))
 
 (defmacro vhdl-visit-file (file-name issue-error &rest body)
   "Visit file FILE-NAME and execute BODY."
@@ -2684,6 +2682,7 @@ elements > `vhdl-menu-max-size'."
   (define-key vhdl-template-map "Cd"   'vhdl-template-configuration-decl)
   (define-key vhdl-template-map "Cs"   'vhdl-template-configuration-spec)
   (define-key vhdl-template-map "co"   'vhdl-template-constant)
+  (define-key vhdl-template-map "ct"   'vhdl-template-context)
   (define-key vhdl-template-map "di"   'vhdl-template-disconnect)
   (define-key vhdl-template-map "el"   'vhdl-template-else)
   (define-key vhdl-template-map "ei"   'vhdl-template-elsif)
@@ -2765,7 +2764,7 @@ elements > `vhdl-menu-max-size'."
 
 (defun vhdl-function-name (prefix string &optional postfix)
   "Generate a Lisp function name.
-PREFIX, STRING and optional POSTFIX are concatenated by '-' and spaces in
+PREFIX, STRING and optional POSTFIX are concatenated by `-' and spaces in
 STRING are replaced by `-' and substrings are converted to lower case."
   (let ((name prefix))
     (while (string-match "\\(\\w+\\)\\s-*\\(.*\\)" string)
@@ -2963,7 +2962,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
     (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)
@@ -2975,11 +2974,13 @@ STRING are replaced by `-' and substrings are converted to lower case."
     (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)
+    ;; single-line comments
+    (modify-syntax-entry ?\- ". 12b" st)
+    ;; multi-line comments
+    (modify-syntax-entry ?\/ ". 14b" st)
+    (modify-syntax-entry ?*  ". 23" st)
+    (modify-syntax-entry ?\n "> b"  st)
+    (modify-syntax-entry ?\^M "> b"   st)
     ;; define parentheses to match
     (modify-syntax-entry ?\( "()"   st)
     (modify-syntax-entry ?\) ")("   st)
@@ -3044,6 +3045,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
                  ("configuration" . vhdl-template-configuration-hook)
                  ("cons"         . vhdl-template-constant-hook)
                  ("constant"     . vhdl-template-constant-hook)
+                 ("context"      . vhdl-template-context-hook)
                  ("disconnect"   . vhdl-template-disconnect-hook)
                  ("downto"       . vhdl-template-default-hook)
                  ("else"         . vhdl-template-else-hook)
@@ -3191,6 +3193,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
       ("configuration declaration"        vhdl-template-configuration-decl)
       ("configuration specification"      vhdl-template-configuration-spec)
       ("constant declaration"             vhdl-template-constant)
+      ("context declaration"              vhdl-template-context)
       ("disconnection specification"      vhdl-template-disconnect)
       ("entity declaration"               vhdl-template-entity)
       ("exit statement"                           vhdl-template-exit)
@@ -3367,6 +3370,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
         ["Configuration (Decl)"        vhdl-template-configuration-decl t]
         ["Configuration (Spec)"        vhdl-template-configuration-spec t]
         ["Constant"            vhdl-template-constant t]
+        ["Context"             vhdl-template-context t]
         ["Disconnect"          vhdl-template-disconnect t]
         ["Else"                vhdl-template-else t]
         ["Elsif"               vhdl-template-elsif t]
@@ -3708,6 +3712,11 @@ STRING are replaced by `-' and substrings are converted to lower case."
                                       (list '93 (cadr vhdl-standard)))
               (vhdl-activate-customizations))
        :style radio :selected (eq '93 (car vhdl-standard))]
+       ["VHDL'08"
+       (progn (customize-set-variable 'vhdl-standard
+                                      (list '08 (cadr vhdl-standard)))
+              (vhdl-activate-customizations))
+       :style radio :selected (eq '08 (car vhdl-standard))]
        "--"
        ["VHDL-AMS"
        (progn (customize-set-variable
@@ -3830,6 +3839,10 @@ STRING are replaced by `-' and substrings are converted to lower case."
        (customize-set-variable 'vhdl-conditions-in-parenthesis
                               (not vhdl-conditions-in-parenthesis))
        :style toggle :selected vhdl-conditions-in-parenthesis]
+      ["Sensitivity List uses 'all'"
+       (customize-set-variable 'vhdl-sensitivity-list-all
+                              (not vhdl-sensitivity-list-all))
+       :style toggle :selected vhdl-sensitivity-list-all]
       ["Zero String..." (customize-option 'vhdl-zero-string) t]
       ["One String..." (customize-option 'vhdl-one-string) t]
       ("File Header"
@@ -4224,6 +4237,9 @@ STRING are replaced by `-' and substrings are converted to lower case."
     ("Entity"
      "^\\s-*\\(entity\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)"
      2)
+    ("Context"
+     "^\\s-*\\(context\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)"
+     2)
     )
   "Imenu generic expression for VHDL Mode.  See `imenu-generic-expression'.")
 
@@ -4312,7 +4328,7 @@ Usage:
   TEMPLATE INSERTION (electrification):
     After typing a VHDL keyword and entering `SPC', you are prompted for
     arguments while a template is generated for that VHDL construct.  Typing
-    `RET' or `C-g' at the first \(mandatory) prompt aborts the current
+    `RET' or `C-g' at the first (mandatory) prompt aborts the current
     template generation.  Optional arguments are indicated by square
     brackets and removed if the queried string is left empty.  Prompts for
     mandatory arguments remain in the code if the queried string is left
@@ -4331,7 +4347,7 @@ Usage:
     conf, comp, cons, func, inst, pack, sig, var.
 
       Template styles can be customized in customization group
-    `vhdl-template' \(see OPTIONS).
+    `vhdl-template' (see OPTIONS).
 
 
   HEADER INSERTION:
@@ -4350,7 +4366,7 @@ Usage:
       ;;;  -->  \" := \"      [[  -->  [        --CR  -->  comment-out code
       ..   -->  \" => \"      ]   -->  )        ---   -->  horizontal line
       ,,   -->  \" <= \"      ]]  -->  ]        ----  -->  display comment
-      ==   -->  \" == \"      ''  -->  \\\"
+      ==   -->  \" == \"      \\='\\='  -->  \\\"
 
 
   WORD COMPLETION:
@@ -4362,7 +4378,7 @@ Usage:
       Typing `TAB' after `(' looks for and inserts complete parenthesized
     expressions (e.g. for array index ranges).  All keywords as well as
     standard types and subprograms of VHDL have predefined abbreviations
-    \(e.g. type \"std\" and `TAB' will toggle through all standard types
+    (e.g., type \"std\" and `TAB' will toggle through all standard types
     beginning with \"std\").
 
       Typing `TAB' after a non-word character indents the line if at the
@@ -4406,13 +4422,13 @@ Usage:
     the entire region.
 
       Indentation can be done for a group of lines (`C-c C-i C-g'), a region
-    \(`M-C-\\') or the entire buffer (menu).  Argument and port lists are
+    (`M-C-\\') or the entire buffer (menu).  Argument and port lists are
     indented normally (nil) or relative to the opening parenthesis (non-nil)
     according to option `vhdl-argument-list-indent'.
 
       If option `vhdl-indent-tabs-mode' is nil, spaces are used instead of
-    tabs.  `M-x tabify' and `M-x untabify' allow to convert spaces to tabs
-    and vice versa.
+    tabs.  `\\[tabify]' and `\\[untabify]' allow the conversion of spaces to
+    tabs and vice versa.
 
       Syntax-based indentation can be very slow in large files.  Option
     `vhdl-indent-syntax-based' allows you to use faster but simpler indentation.
@@ -4552,7 +4568,7 @@ Usage:
     Enables simple structural composition.  `C-c C-m C-n' creates a skeleton
     for a new component.  Subcomponents (i.e. component declaration and
     instantiation) can be automatically placed from a previously read port
-    \(`C-c C-m C-p') or directly from the hierarchy browser (`P').  Finally,
+    (`C-c C-m C-p') or directly from the hierarchy browser (`P').  Finally,
     all subcomponents can be automatically connected using internal signals
     and ports (`C-c C-m C-w') following these rules:
       - subcomponent actual ports with same name are considered to be
@@ -4677,7 +4693,7 @@ Usage:
 
   VHDL STANDARDS:
     The VHDL standards to be used are specified in option `vhdl-standard'.
-    Available standards are: VHDL'87/'93(02), VHDL-AMS, and Math Packages.
+    Available standards are: VHDL'87/'93(02)/'08, VHDL-AMS, and Math Packages.
 
 
   KEYWORD CASE:
@@ -4722,7 +4738,7 @@ Usage:
     `vhdl-highlight-translate-off' is non-nil.
 
       For documentation and customization of the used colors see
-    customization group `vhdl-highlight-faces' (`M-x customize-group').  For
+    customization group `vhdl-highlight-faces' (`\\[customize-group]').  For
     highlighting of matching parenthesis, see customization group
     `paren-showing'.  Automatic buffer highlighting is turned on/off by
     option `global-font-lock-mode' (`font-lock-auto-fontify' in XEmacs).
@@ -4752,7 +4768,7 @@ Usage:
           Insert them once manually (will be kept afterwards).
         - Out parameters of procedures are considered to be read.
       Use option `vhdl-entity-file-name' to specify the entity file name
-      \(used to obtain the port names).
+      (used to obtain the port names).
       Use option `vhdl-array-index-record-field-in-sensitivity-list' to
       specify whether to include array indices and record fields in
       sensitivity lists.
@@ -4760,12 +4776,12 @@ Usage:
 
   CODE FIXING:
     `C-c C-x C-p' fixes the closing parenthesis of a generic/port clause
-    \(e.g. if the closing parenthesis is on the wrong line or is missing).
+    (e.g., if the closing parenthesis is on the wrong line or is missing).
 
 
   PRINTING:
     PostScript printing with different faces (an optimized set of faces is
-    used if `vhdl-print-customize-faces' is non-nil) or colors \(if
+    used if `vhdl-print-customize-faces' is non-nil) or colors (if
     `ps-print-color-p' is non-nil) is possible using the standard Emacs
     PostScript printing commands.  Option `vhdl-print-two-column' defines
     appropriate default settings for nice landscape two-column printing.
@@ -4782,14 +4798,14 @@ Usage:
     sessions using the \"Save Options\" menu entry.
 
       Options and their detailed descriptions can also be accessed by using
-    the \"Customize\" menu entry or the command `M-x customize-option' (`M-x
-    customize-group' for groups).  Some customizations only take effect
+    the \"Customize\" menu entry or the command `\\[customize-option]'
+    (`\\[customize-group]' for groups).  Some customizations only take effect
     after some action (read the NOTE in the option documentation).
     Customization can also be done globally (i.e. site-wide, read the
     INSTALL file).
 
       Not all options are described in this documentation, so go and see
-    what other useful user options there are (`M-x vhdl-customize' or menu)!
+    what other useful user options there are (`\\[vhdl-customize]' or menu)!
 
 
   FILE EXTENSIONS:
@@ -4797,7 +4813,7 @@ Usage:
     automatically recognized as VHDL source files.  To add an extension
     \".xxx\", add the following line to your Emacs start-up file (`.emacs'):
 
-      \(push '(\"\\\\.xxx\\\\'\" . vhdl-mode) auto-mode-alist)
+      (push \\='(\"\\\\.xxx\\\\\\='\" . vhdl-mode) auto-mode-alist)
 
 
   HINTS:
@@ -4818,7 +4834,7 @@ Usage:
 Maintenance:
 ------------
 
-To submit a bug report, enter `M-x vhdl-submit-bug-report' within VHDL Mode.
+To submit a bug report, enter `\\[vhdl-submit-bug-report]' within VHDL Mode.
 Add a description of the problem and include a reproducible test case.
 
 Questions and enhancement requests can be sent to <reto@gnu.org>.
@@ -4860,8 +4876,6 @@ Key bindings:
   (set (make-local-variable 'indent-line-function) 'vhdl-indent-line)
   (set (make-local-variable 'comment-start) "--")
   (set (make-local-variable 'comment-end) "")
-  (when vhdl-emacs-21
-    (set (make-local-variable 'comment-padding) ""))
   (set (make-local-variable 'comment-column) vhdl-inline-comment-column)
   (set (make-local-variable 'end-comment-column) vhdl-end-comment-column)
   (set (make-local-variable 'comment-start-skip) "--+\\s-*")
@@ -4884,7 +4898,7 @@ Key bindings:
            (syntax-propertize-rules
             ;; Mark single quotes as having string quote syntax in
             ;; 'c' instances.
-            ("\\(\'\\).\\(\'\\)" (1 "\"'") (2 "\"'"))))
+            ("\\('\\).\\('\\)" (1 "\"'") (2 "\"'"))))
     (set (make-local-variable 'font-lock-syntactic-keywords)
          vhdl-font-lock-syntactic-keywords))
   (unless vhdl-emacs-21
@@ -4987,6 +5001,12 @@ Key bindings:
     )
   "List of VHDL'02 keywords.")
 
+(defconst vhdl-08-keywords
+  '(
+    "context" "force" "property" "release" "sequence"
+    )
+  "List of VHDL'08 keywords.")
+
 (defconst vhdl-ams-keywords
   '(
     "across" "break" "limit" "nature" "noise" "procedural" "quantity"
@@ -5028,6 +5048,12 @@ Key bindings:
     )
   "List of VHDL'02 standardized types.")
 
+(defconst vhdl-08-types
+  '(
+    "boolean_vector" "integer_vector" "real_vector" "time_vector"
+    )
+  "List of VHDL'08 standardized types.")
+
 (defconst vhdl-ams-types
   ;; standards: IEEE Std 1076.1-2007, IEEE Std 1076.1.1-2004
   '(
@@ -5103,6 +5129,12 @@ Key bindings:
     )
   "List of VHDL'02 standardized attributes.")
 
+(defconst vhdl-08-attributes
+  '(
+    "instance_name" "path_name"
+    )
+  "List of VHDL'08 standardized attributes.")
+
 (defconst vhdl-ams-attributes
   '(
     "across" "through"
@@ -5174,6 +5206,15 @@ Key bindings:
     )
   "List of VHDL'02 standardized functions.")
 
+(defconst vhdl-08-functions
+  '(
+    "finish" "flush" "justify" "maximum" "minimum"
+    "resolution_limit" "rising_edge" "stop" "swrite"
+    "tee" "to_binarystring" "to_bstring" "to_hexstring" "to_hstring"
+    "to_octalstring" "to_ostring" "to_string"
+    )
+  "List of VHDL'08 standardized functions.")
+
 (defconst vhdl-ams-functions
   '(
     ;; package `standard'
@@ -5202,6 +5243,13 @@ Key bindings:
     )
   "List of VHDL'02 standardized packages and libraries.")
 
+(defconst vhdl-08-packages
+  '(
+    "env" "numeric_std_signed" "numeric_std_unsigned"
+    "ieee_bit_context" "ieee_std_context"  ;; contexts
+    )
+  "List of VHDL'08 standardized packages and libraries.")
+
 (defconst vhdl-ams-packages
   '(
     "fundamental_constants" "material_constants" "energy_systems"
@@ -5216,6 +5264,18 @@ Key bindings:
     )
   "List of Math Packages standardized packages and libraries.")
 
+(defconst vhdl-08-directives
+  '(
+    "author" "author_info" "begin" "begin_protected" "comment"
+    "data_block" "data_keyname" "data_keyowner" "data_method"
+    "decrypt_license" "digest_block" "digest_key_method" "digest_keyname"
+    "digest_keyowner" "digest_method"
+    "encoding" "encrypt_agent" "encrypt_agent_info" "end" "end_protected"
+    "key_block" "key_keyname" "key_keyowner" "key_method"
+    "runtime_license" "viewport"
+    )
+  "List of VHDL'08 standardized tool directives.")
+
 (defvar vhdl-keywords nil
   "List of VHDL keywords.")
 
@@ -5237,6 +5297,9 @@ Key bindings:
 (defvar vhdl-packages nil
   "List of VHDL standardized packages and libraries.")
 
+(defvar vhdl-directives nil
+  "List of VHDL standardized packages and libraries.")
+
 (defvar vhdl-reserved-words nil
   "List of additional reserved words.")
 
@@ -5282,17 +5345,20 @@ Key bindings:
        (vhdl-upcase-list
         (and vhdl-highlight-case-sensitive vhdl-upper-case-keywords)
         (append vhdl-02-keywords
+                (when (vhdl-standard-p '08) vhdl-08-keywords)
                 (when (vhdl-standard-p 'ams) vhdl-ams-keywords))))
   (setq vhdl-types
        (vhdl-upcase-list
         (and vhdl-highlight-case-sensitive vhdl-upper-case-types)
         (append vhdl-02-types
+                (when (vhdl-standard-p '08) vhdl-08-types)
                 (when (vhdl-standard-p 'ams) vhdl-ams-types)
                 (when (vhdl-standard-p 'math) vhdl-math-types))))
   (setq vhdl-attributes
        (vhdl-upcase-list
         (and vhdl-highlight-case-sensitive vhdl-upper-case-attributes)
         (append vhdl-02-attributes
+                (when (vhdl-standard-p '08) vhdl-08-attributes)
                 (when (vhdl-standard-p 'ams) vhdl-ams-attributes))))
   (setq vhdl-enum-values
        (vhdl-upcase-list
@@ -5307,12 +5373,16 @@ Key bindings:
                 '(""))))
   (setq vhdl-functions
        (append vhdl-02-functions
+               (when (vhdl-standard-p '08) vhdl-08-functions)
                (when (vhdl-standard-p 'ams) vhdl-ams-functions)
                (when (vhdl-standard-p 'math) vhdl-math-functions)))
   (setq vhdl-packages
        (append vhdl-02-packages
+               (when (vhdl-standard-p '08) vhdl-08-packages)
                (when (vhdl-standard-p 'ams) vhdl-ams-packages)
                (when (vhdl-standard-p 'math) vhdl-math-packages)))
+  (setq vhdl-directives
+       (append (when (vhdl-standard-p '08) vhdl-08-directives)))
   (setq vhdl-reserved-words
        (append (when vhdl-highlight-forbidden-words vhdl-forbidden-words)
                (when vhdl-highlight-verilog-keywords vhdl-verilog-keywords)
@@ -5357,7 +5427,8 @@ Key bindings:
         (list vhdl-upper-case-enum-values) vhdl-enum-values
         (list vhdl-upper-case-constants) vhdl-constants
         (list nil) vhdl-functions
-        (list nil) vhdl-packages)))
+        (list nil) vhdl-packages
+        (list nil) vhdl-directives)))
 
 ;; initialize reserved words for VHDL Mode
 (vhdl-words-init)
@@ -5598,9 +5669,24 @@ the offset is simply returned."
 
 ;; Syntactic support functions:
 
-(defun vhdl-in-comment-p ()
-  "Check if point is in a comment."
-  (eq (vhdl-in-literal) 'comment))
+(defun vhdl-in-comment-p (&optional pos)
+  "Check if point is in a comment (include multi-line comments)."
+  (let ((parse (lambda (p)
+                (let ((c (char-after p)))
+                  (or (and c (eq (char-syntax c) ?<))
+                      (nth 4 (parse-partial-sexp
+                              (save-excursion
+                                (beginning-of-defun)
+                                (point)) p)))))))
+    (save-excursion
+      (goto-char (or pos (point)))
+      (or (funcall parse (point))
+         ;; `parse-partial-sexp's notion of comments doesn't span lines
+         (progn
+           (back-to-indentation)
+           (unless (eolp)
+             (forward-char)
+             (funcall parse (point))))))))
 
 (defun vhdl-in-string-p ()
   "Check if point is in a string."
@@ -5625,10 +5711,13 @@ the offset is simply returned."
        ((nth 3 state) 'string)
        ((nth 4 state) 'comment)
        ((vhdl-beginning-of-macro) 'pound)
+       ((vhdl-beginning-of-directive) 'directive)
+       ;; for multi-line comments
+       ((and (vhdl-standard-p '08) (vhdl-in-comment-p)) 'comment)
        (t nil)))))
 
 (defun vhdl-in-extended-identifier-p ()
-  "Determine if point is inside extended identifier (delimited by '\')."
+  "Determine if point is inside extended identifier (delimited by `\\')."
   (save-match-data
     (and (save-excursion (re-search-backward "\\\\" (vhdl-point 'bol) t))
         (save-excursion (re-search-forward "\\\\" (vhdl-point 'eol) t)))))
@@ -5675,7 +5764,7 @@ negative, skip forward otherwise."
       (goto-char lim )
       (while (< (point) here)
        (setq match
-             (and (re-search-forward "--\\|[\"']"
+             (and (re-search-forward "--\\|[\"']\\|`"
                                      here 'move)
                   (buffer-substring (match-beginning 0) (match-end 0))))
        (setq state
@@ -5685,6 +5774,9 @@ negative, skip forward otherwise."
               ;; looking at the opening of a VHDL style comment
               ((string= "--" match)
                (if (<= here (progn (end-of-line) (point))) 'comment))
+              ;; looking at a directive
+              ((string= "`" match)
+               (if (<= here (progn (end-of-line) (point))) 'directive))
               ;; looking at the opening of a double quote string
               ((string= "\"" match)
                (if (not (save-restriction
@@ -5729,7 +5821,7 @@ negative, skip forward otherwise."
       (setq here (point))
       (vhdl-forward-comment hugenum)
       ;; skip preprocessor directives
-      (when (and (eq (char-after) ?#)
+      (when (and (or (eq (char-after) ?#) (eq (char-after) ?`))
                 (= (vhdl-point 'boi) (point)))
        (while (and (eq (char-before (vhdl-point 'eol)) ?\\)
                    (= (forward-line 1) 0)))
@@ -5766,6 +5858,19 @@ negative, skip forward otherwise."
       (goto-char here)
       nil)))
 
+(defun vhdl-beginning-of-directive (&optional lim)
+  "Go to the beginning of a directive (nicked from `cc-engine')."
+  (let ((here (point)))
+    (beginning-of-line)
+    (while (eq (char-before (1- (point))) ?\\)
+      (forward-line -1))
+    (back-to-indentation)
+    (if (and (<= (point) here)
+            (eq (char-after) ?`))
+       t
+      (goto-char here)
+      nil)))
+
 (defun vhdl-backward-syntactic-ws (&optional lim)
   "Backward skip over syntactic whitespace."
   (let* ((here (point-min))
@@ -5822,7 +5927,7 @@ that point, else nil."
 ;; Core syntactic evaluation functions:
 
 (defconst vhdl-libunit-re
-  "\\b\\(architecture\\|configuration\\|entity\\|package\\)\\b[^_]")
+  "\\b\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\b[^_]")
 
 (defun vhdl-libunit-p ()
   (and
@@ -5840,7 +5945,7 @@ that point, else nil."
    ))
 
 (defconst vhdl-defun-re
-  "\\b\\(architecture\\|block\\|configuration\\|entity\\|package\\|process\\|procedural\\|procedure\\|function\\)\\b[^_]")
+  "\\b\\(architecture\\|block\\|configuration\\|context\\|entity\\|package\\|process\\|procedural\\|procedure\\|function\\)\\b[^_]")
 
 (defun vhdl-defun-p ()
   (save-excursion
@@ -5849,7 +5954,7 @@ that point, else nil."
        (save-excursion
          (backward-sexp)
          (not (looking-at "end\\s-+\\w")))
-      ;; "architecture", "configuration", "entity",
+      ;; "architecture", "configuration", "context", "entity",
       ;; "package", "procedure", "function":
       t)))
 
@@ -5863,7 +5968,7 @@ corresponding \"begin\" keyword, else return nil."
         (if (looking-at "block\\|process\\|procedural")
             ;; "block", "process". "procedural:
             (buffer-substring (match-beginning 0) (match-end 0))
-          ;; "architecture", "configuration", "entity", "package",
+          ;; "architecture", "configuration", "context", "entity", "package",
           ;; "procedure", "function":
           "is"))))
 
@@ -5884,7 +5989,7 @@ vhdl-begin-fwd-re, and are not inside a literal, and that we are not in
 the middle of an identifier that just happens to contain a \"begin\"
 keyword."
   (cond
-   ;; "[architecture|case|configuration|entity|package|
+   ;; "[architecture|case|configuration|context|entity|package|
    ;;   procedure|function] ... is":
    ((and (looking-at "i")
         (save-excursion
@@ -5894,10 +5999,11 @@ keyword."
           ;; following search list so that we don't run into
           ;; semicolons in the function interface list.
           (backward-sexp)
+          (skip-chars-forward "(")
           (let (foundp)
             (while (and (not foundp)
                         (re-search-backward
-                         ";\\|\\b\\(architecture\\|case\\|configuration\\|entity\\|package\\|procedure\\|return\\|is\\|begin\\|process\\|procedural\\|block\\)\\b[^_]"
+                         ";\\|\\b\\(architecture\\|case\\|configuration\\|context\\|entity\\|package\\|procedure\\|return\\|is\\|begin\\|process\\|procedural\\|block\\)\\b[^_]"
                          lim 'move))
               (if (or (= (preceding-char) ?_)
                       (vhdl-in-literal))
@@ -6092,7 +6198,7 @@ of an identifier that just happens to contain an \"end\" keyword."
              (vector "for" (vhdl-first-word pos) nil nil))
             ;; "end [id]":
             (t
-             (vector "begin\\|architecture\\|configuration\\|entity\\|package\\|procedure\\|function"
+             (vector "begin\\|architecture\\|configuration\\|context\\|entity\\|package\\|procedure\\|function"
                      (vhdl-first-word pos)
                      ;; return an alist of (statement . keyword) mappings
                      '(
@@ -6102,6 +6208,8 @@ of an identifier that just happens to contain an \"end\" keyword."
                        ("architecture"   . "is")
                        ;; "configuration ... is ... end [id]":
                        ("configuration"  . "is")
+                       ;; "context ... is ... end [id]":
+                       ("context"        . "is")
                        ;; "entity ... is ... end [id]":
                        ("entity"         . "is")
                        ;; "package ... is ... end [id]":
@@ -6473,7 +6581,7 @@ returned point is at the first character of the \"libunit\" keyword."
         ;; keyword, allow for the keyword and an extra character,
         ;; as this will be used when looking forward for the
         ;; "begin" keyword.
-        (save-excursion (forward-word 1) (1+ (point))))
+        (save-excursion (forward-word-strictly 1) (1+ (point))))
        foundp literal placeholder)
     ;; Find the "libunit" keyword.
     (while (and (not foundp)
@@ -6524,7 +6632,7 @@ stops due to beginning or end of buffer."
             ;; keyword, allow for the keyword and an extra character,
             ;; as this will be used when looking forward for the
             ;; "begin" keyword.
-            (save-excursion (forward-word 1) (1+ (point))))
+            (save-excursion (forward-word-strictly 1) (1+ (point))))
            begin-string literal)
        (while (and (not foundp)
                    (re-search-backward vhdl-defun-re nil 'move))
@@ -6603,7 +6711,7 @@ search, and an argument indicating an interactive call."
   (re-search-forward vhdl-e-o-s-re))
 
 (defconst vhdl-b-o-s-re
-  (concat ";[^_]\\|\([^_]\\|\)[^_]\\|\\bwhen\\b[^_]\\|"
+  (concat ";[^_]\\|([^_]\\|)[^_]\\|\\bwhen\\b[^_]\\|"
          vhdl-begin-bwd-re "\\|" vhdl-statement-bwd-re))
 
 (defun vhdl-beginning-of-statement-1 (&optional lim)
@@ -6670,7 +6778,8 @@ statement if already at the beginning of one."
                    ;; start point was not inside leader area
                    ;; set stop point at word after leader
                    (setq pos (point))))
-           (forward-word 1)
+           (unless (looking-at "\\<else\\s-+generate\\>")
+             (forward-word-strictly 1))
            (vhdl-forward-syntactic-ws here)
            (setq pos (point)))
          (goto-char pos)
@@ -6716,7 +6825,8 @@ keyword at PLACEHOLDER, then return the library unit type."
          (cond
           ((looking-at "e") 'entity)
           ((looking-at "a") 'architecture)
-          ((looking-at "c") 'configuration)
+          ((looking-at "conf") 'configuration)
+          ((looking-at "cont") 'context)
           ((looking-at "p")
            (save-excursion
              (goto-char bod)
@@ -6992,7 +7102,7 @@ is not moved."
                   (goto-char (1+ containing-sexp))
                   (skip-chars-forward " \t")
                   (not (eolp))
-                  (not (looking-at "--")))
+                  (not (looking-at "--\\|`")))
                 (save-excursion
                   (vhdl-beginning-of-statement-1 containing-sexp)
                   (skip-chars-backward " \t(")
@@ -7141,8 +7251,10 @@ is not moved."
        ;; now we need to look at any modifiers
        (goto-char indent-point)
        (skip-chars-forward " \t")
-       (if (looking-at "--")
+       (if (or (looking-at "--") (looking-at "/\\*"))
            (vhdl-add-syntax 'comment))
+       (if (looking-at "`")
+           (vhdl-add-syntax 'directive))
        (if (eq literal 'pound)
            (vhdl-add-syntax 'cpp-macro))
        ;; return the syntax
@@ -7216,8 +7328,12 @@ only-lines."
        (vhdl-comment-indent)
       ;; otherwise, indent as specified by vhdl-comment-only-line-offset
       (if (not (bolp))
+         ;; inside multi-line comment
+         (if (looking-at "\\*")
+             1
+           ;; otherwise
          (or (car-safe vhdl-comment-only-line-offset)
-             vhdl-comment-only-line-offset)
+               vhdl-comment-only-line-offset))
        (or (cdr-safe vhdl-comment-only-line-offset)
            (car-safe vhdl-comment-only-line-offset)
            -1000                       ;jam it against the left side
@@ -7273,11 +7389,11 @@ only-lines."
                (- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
     (let ((delta (- (aref vhdl-progress-info 1)
                     (aref vhdl-progress-info 0))))
-      (if (= 0 delta)
-          (message (concat string "... (100%s)") "%")
-        (message (concat string "... (%2d%s)")
-                 (/ (* 100 (- pos (aref vhdl-progress-info 0)))
-                    delta) "%")))
+      (message "%s... (%2d%%)" string
+              (if (= 0 delta)
+                  100
+                 (floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
+                        delta))))
     (aset vhdl-progress-info 2 (nth 1 (current-time)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -7457,7 +7573,7 @@ ENDPOS is encountered."
     (mapc
      (function
       (lambda (elt)
-       (if (memq (car elt) '(entity configuration package
+       (if (memq (car elt) '(entity configuration context package
                                     package-body architecture))
            nil
          (setq expurgated (append expurgated (list elt))))))
@@ -7787,7 +7903,7 @@ the token in MATCH."
     (vhdl-prepare-search-2
      (save-excursion
        ;; search for declarative part
-       (when (and (re-search-backward "^\\(architecture\\|begin\\|configuration\\|end\\|entity\\|package\\)\\>" nil t)
+       (when (and (re-search-backward "^\\(architecture\\|begin\\|configuration\\|context\\|end\\|entity\\|package\\)\\>" nil t)
                  (not (member (upcase (match-string 1)) '("BEGIN" "END"))))
         (setq beg (point))
         (re-search-forward "^\\(begin\\|end\\)\\>" nil t)
@@ -7950,25 +8066,25 @@ end of line, do nothing in comments and strings."
     (setq end (point-marker))
     ;; have no space before and one space after `,' and ';'
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
        (replace-match "\\3 " nil nil nil 2)))
     ;; have no space after `('
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\((\\)\\s-+" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\((\\)\\s-+" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
        (replace-match "\\2")))
     ;; have no space before `)'
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
        (replace-match "\\2")))
     ;; surround operator symbols by one space
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\([^/:<>=\n]\\)\\(:\\|\\??=\\|\\??<<\\|\\??>>\\|\\??<\\|\\??>\\|:=\\|\\??<=\\|\\??>=\\|=>\\|\\??/=\\|\\?\\?\\)\\([^=>\n]\\|$\\)\\)" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\([^/:<>=\n]\\)\\(:\\|\\??=\\|\\??<<\\|\\??>>\\|\\??<\\|\\??>\\|:=\\|\\??<=\\|\\??>=\\|=>\\|\\??/=\\|\\?\\?\\)\\([^=>\n]\\|$\\)\\)" end t)
       (if (or (match-string 1)
              (<= (match-beginning 0)  ; not if at boi
                 (save-excursion (back-to-indentation) (point))))
@@ -8078,8 +8194,8 @@ options vhdl-upper-case-{keywords,types,attributes,enum-values}."
 
 (defun vhdl-fix-statement-region (beg end &optional arg)
   "Force statements in region on separate line except when on same line
-with 'end' keyword (necessary for correct indentation).
-Currently supported keywords: 'begin', 'if'."
+with `end' keyword (necessary for correct indentation).
+Currently supported keywords: `begin', `if'."
   (interactive "r\nP")
   (vhdl-prepare-search-2
    (let (point)
@@ -8125,7 +8241,7 @@ Currently supported keywords: 'begin', 'if'."
 
 (defun vhdl-fix-statement-buffer ()
   "Force statements in buffer on separate line except when on same line
-with 'end' keyword (necessary for correct indentation)."
+with `end' keyword (necessary for correct indentation)."
   (interactive)
   (vhdl-fix-statement-region (point-min) (point-max)))
 
@@ -8160,7 +8276,7 @@ case fixing to a region.  Calls functions `vhdl-indent-buffer',
   (setq end (save-excursion (goto-char end) (point-marker)))
   (save-excursion ; remove DOS EOL characters in UNIX file
     (goto-char beg)
-    (while (search-forward "\r" nil t)
+    (while (search-forward "\r" nil t)
       (replace-match "" nil t)))
   (when (nth 0 vhdl-beautify-options) (vhdl-fixup-whitespace-region beg end t))
   (when (nth 1 vhdl-beautify-options) (vhdl-fix-statement-region beg end))
@@ -8341,7 +8457,7 @@ buffer."
            (setq end (vhdl-re-search-forward "\\<then\\>" proc-end t))
            (when (vhdl-re-search-backward "\\('event\\|\\<\\(falling\\|rising\\)_edge\\)\\>" beg t)
              (goto-char end)
-             (backward-word 1)
+             (backward-word-strictly 1)
              (vhdl-forward-sexp)
              (push (cons end (point)) seq-region-list)
              (beginning-of-line)))
@@ -8624,14 +8740,15 @@ is omitted or nil."
                  (let ((next-input (read-char)))
                    (if (= next-input ?-) ; four dashes
                        (vhdl-comment-display t)
-                     (setq unread-command-events ; pushback the char
-                           (list (vhdl-character-to-event next-input))))))
-             (setq unread-command-events ; pushback the char
-                   (list (vhdl-character-to-event next-input)))
+                     (push (vhdl-character-to-event next-input)
+                                        ; pushback the char
+                            unread-command-events))))
+              (push (vhdl-character-to-event next-input) ; pushback the char
+                    unread-command-events)
              (vhdl-comment-insert)))))
     (self-insert-command count)))
 
-(defun vhdl-electric-open-bracket (count) "'[' --> '(', '([' --> '['"
+(defun vhdl-electric-open-bracket (count) "`[' --> `(', `([' --> `['"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (if (= (preceding-char) ?\()
@@ -8639,7 +8756,7 @@ is omitted or nil."
        (insert-char ?\( 1))
     (self-insert-command count)))
 
-(defun vhdl-electric-close-bracket (count) "']' --> ')', ')]' --> ']'"
+(defun vhdl-electric-close-bracket (count) "`]' --> `)', `)]' --> `]'"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (progn
@@ -8649,7 +8766,7 @@ is omitted or nil."
        (blink-matching-open))
     (self-insert-command count)))
 
-(defun vhdl-electric-quote (count) "'' --> \""
+(defun vhdl-electric-quote (count) "\\='\\=' --> \""
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (if (= (preceding-char) vhdl-last-input-event)
@@ -8657,7 +8774,7 @@ is omitted or nil."
        (insert-char ?\' 1))
     (self-insert-command count)))
 
-(defun vhdl-electric-semicolon (count) "';;' --> ' : ', ': ;' --> ' := '"
+(defun vhdl-electric-semicolon (count) "`;;' --> ` : ', `: ;' --> ` := '"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (cond ((= (preceding-char) vhdl-last-input-event)
@@ -8671,7 +8788,7 @@ is omitted or nil."
            (t (insert-char ?\; 1)))
     (self-insert-command count)))
 
-(defun vhdl-electric-comma (count) "',,' --> ' <= '"
+(defun vhdl-electric-comma (count) "`,,' --> ` <= '"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (cond ((= (preceding-char) vhdl-last-input-event)
@@ -8681,7 +8798,7 @@ is omitted or nil."
            (t (insert-char ?\, 1)))
     (self-insert-command count)))
 
-(defun vhdl-electric-period (count) "'..' --> ' => '"
+(defun vhdl-electric-period (count) "`..' --> ` => '"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (cond ((= (preceding-char) vhdl-last-input-event)
@@ -8691,7 +8808,7 @@ is omitted or nil."
            (t (insert-char ?\. 1)))
     (self-insert-command count)))
 
-(defun vhdl-electric-equal (count) "'==' --> ' == '"
+(defun vhdl-electric-equal (count) "`==' --> ` == '"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
       (cond ((= (preceding-char) vhdl-last-input-event)
@@ -8812,7 +8929,7 @@ is omitted or nil."
     (vhdl-insert-keyword ": BLOCK ")
     (goto-char start)
     (when (setq label (vhdl-template-field "label" nil t start (+ (point) 8)))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1)
       (insert "(")
       (if (vhdl-template-field "[guard expression]" nil t)
@@ -8848,7 +8965,7 @@ is omitted or nil."
                   (if (vhdl-template-field "[quantity name]" " USE " t)
                       (progn (vhdl-template-field "quantity name" " => ") t)
                     (delete-region (point)
-                                   (progn (forward-word -1) (point)))
+                                   (progn (forward-word-strictly -1) (point)))
                     nil))
            (vhdl-template-field "[quantity name]" " => " t))
       (vhdl-template-field "expression")
@@ -8881,7 +8998,7 @@ is omitted or nil."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (when (vhdl-template-field "expression" nil t start (point))
       (vhdl-insert-keyword (concat " " (if (eq kind 'is) "IS" "USE") "\n\n"))
@@ -9137,12 +9254,33 @@ a configuration declaration if not within a design unit."
          (insert ";")
          (vhdl-comment-insert-inline))))))
 
+(defun vhdl-template-context ()
+  "Insert a context declaration."
+  (interactive)
+  (let ((margin (current-indentation))
+       (start (point))
+       entity-exists string name position)
+    (vhdl-insert-keyword "CONTEXT ")
+    (when (setq name (vhdl-template-field "name" nil t start (point)))
+      (vhdl-insert-keyword " IS\n")
+      (when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
+      (indent-to (+ margin vhdl-basic-offset))
+      (setq position (point))
+      (insert "\n")
+      (when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
+      (indent-to margin)
+      (vhdl-insert-keyword "END ")
+      (unless (vhdl-standard-p '87)
+       (vhdl-insert-keyword "CONTEXT "))
+      (insert name ";")
+      (goto-char position))))
+
 (defun vhdl-template-default ()
   "Insert nothing."
   (interactive)
   (insert " ")
   (unexpand-abbrev)
-  (backward-word 1)
+  (backward-word-strictly 1)
   (vhdl-case-word 1)
   (forward-char 1))
 
@@ -9151,7 +9289,7 @@ a configuration declaration if not within a design unit."
   (interactive)
   (insert " ")
   (unexpand-abbrev)
-  (backward-word 1)
+  (backward-word-strictly 1)
   (vhdl-case-word 1)
   (forward-char 1)
   (indent-according-to-mode))
@@ -9173,9 +9311,11 @@ a configuration declaration if not within a design unit."
   (let (margin)
     (vhdl-prepare-search-1
      (vhdl-insert-keyword "ELSE")
-     (if (and (save-excursion (vhdl-re-search-backward "\\(\\<when\\>\\|;\\)" nil t))
-             (equal "WHEN" (upcase (match-string 1))))
+     (if (and (save-excursion (vhdl-re-search-backward "\\(\\(\\<when\\>\\)\\|;\\)" nil t))
+             (match-string 2))
         (insert " ")
+       (unless (vhdl-sequential-statement-p)
+        (vhdl-insert-keyword " GENERATE"))
        (indent-according-to-mode)
        (setq margin (current-indentation))
        (insert "\n")
@@ -9187,15 +9327,16 @@ a configuration declaration if not within a design unit."
   (let ((start (point))
        margin)
     (vhdl-insert-keyword "ELSIF ")
-    (when (or (vhdl-sequential-statement-p) (vhdl-standard-p 'ams))
       (when vhdl-conditions-in-parenthesis (insert "("))
       (when (vhdl-template-field "condition" nil t start (point))
        (when vhdl-conditions-in-parenthesis (insert ")"))
        (indent-according-to-mode)
        (setq margin (current-indentation))
        (vhdl-insert-keyword
-        (concat " " (if (vhdl-sequential-statement-p) "THEN" "USE") "\n"))
-       (indent-to (+ margin vhdl-basic-offset))))))
+       (concat " " (cond ((vhdl-sequential-statement-p) "THEN")
+                        ((vhdl-standard-p 'ams) "USE")
+                        (t "GENERATE")) "\n"))
+      (indent-to (+ margin vhdl-basic-offset)))))
 
 (defun vhdl-template-entity ()
   "Insert an entity."
@@ -9312,7 +9453,7 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (when (setq index (vhdl-template-field "loop variable"
                                           nil t start (point)))
@@ -9453,7 +9594,7 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (when vhdl-conditions-in-parenthesis (insert "("))
     (when (vhdl-template-field "condition" nil t start (point))
@@ -9536,7 +9677,7 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (delete-char 1))
     (insert "\n\n")
     (indent-to margin)
@@ -9620,11 +9761,13 @@ otherwise."
        (cond ((equal definition "")
               (insert ";"))
              ((equal definition "ARRAY")
-              (delete-region (point) (progn (forward-word -1) (point)))
+              (delete-region (point) (progn (forward-word-strictly -1)
+                                             (point)))
               (vhdl-template-array 'nature t))
              ((equal definition "RECORD")
               (setq mid-pos (point-marker))
-              (delete-region (point) (progn (forward-word -1) (point)))
+              (delete-region (point) (progn (forward-word-strictly -1)
+                                             (point)))
               (vhdl-template-record 'nature name t))
              (t
               (vhdl-insert-keyword " ACROSS ")
@@ -9737,7 +9880,7 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (unless (vhdl-standard-p '87) (vhdl-insert-keyword "IS"))
     (insert "\n")
@@ -9794,12 +9937,14 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (insert "(")
     (if (not seq)
-       (unless (setq input-signals
-                     (vhdl-template-field "[sensitivity list]" ")" t))
+       (unless (or (and (vhdl-standard-p '08) vhdl-sensitivity-list-all
+                        (progn (insert "all)") (setq input-signals "all")))
+                   (setq input-signals
+                         (vhdl-template-field "[sensitivity list]" ")" t)))
          (setq input-signals "")
          (delete-char -2))
       (setq clock (or (and (not (equal "" vhdl-clock-name))
@@ -9988,7 +10133,7 @@ otherwise."
     (vhdl-insert-keyword "WITH ")
     (when (vhdl-template-field "selector expression"
                               nil t start (+ (point) 7))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (delete-char 1)
       (insert "\n")
       (indent-to (+ margin vhdl-basic-offset))
@@ -10110,11 +10255,13 @@ otherwise."
               (delete-char -4)
               (insert ";"))
              ((equal definition "ARRAY")
-              (delete-region (point) (progn (forward-word -1) (point)))
+              (delete-region (point) (progn (forward-word-strictly -1)
+                                             (point)))
               (vhdl-template-array 'type t))
              ((equal definition "RECORD")
               (setq mid-pos (point-marker))
-              (delete-region (point) (progn (forward-word -1) (point)))
+              (delete-region (point) (progn (forward-word-strictly -1)
+                                             (point)))
               (vhdl-template-record 'type name t))
              ((equal definition "ACCESS")
               (insert " ")
@@ -10158,7 +10305,8 @@ otherwise."
      (if (or (save-excursion
               (progn (vhdl-beginning-of-block)
                      (looking-at "\\s-*\\(\\w+\\s-*:\\s-*\\)?\\<\\(\\<function\\|procedure\\|process\\|procedural\\)\\>")))
-            (save-excursion (backward-word 1) (looking-at "\\<shared\\>")))
+            (save-excursion (backward-word-strictly 1)
+                             (looking-at "\\<shared\\>")))
         (vhdl-insert-keyword "VARIABLE ")
        (if (vhdl-standard-p '87)
           (error "ERROR:  Not within sequential block")
@@ -10216,7 +10364,7 @@ otherwise."
       (goto-char start)
       (setq label (vhdl-template-field "[label]" nil t))
       (unless label (delete-char 2))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (forward-char 1))
     (when vhdl-conditions-in-parenthesis (insert "("))
     (when (vhdl-template-field "condition" nil t start (point))
@@ -10443,22 +10591,22 @@ specification, if not already there."
   (insert "-- pragma " directive))
 
 (defun vhdl-template-directive-translate-on ()
-  "Insert directive 'translate_on'."
+  "Insert directive `translate_on'."
   (interactive)
   (vhdl-template-directive "translate_on"))
 
 (defun vhdl-template-directive-translate-off ()
-  "Insert directive 'translate_off'."
+  "Insert directive `translate_off'."
   (interactive)
   (vhdl-template-directive "translate_off"))
 
 (defun vhdl-template-directive-synthesis-on ()
-  "Insert directive 'synthesis_on'."
+  "Insert directive `synthesis_on'."
   (interactive)
   (vhdl-template-directive "synthesis_on"))
 
 (defun vhdl-template-directive-synthesis-off ()
-  "Insert directive 'synthesis_off'."
+  "Insert directive `synthesis_off'."
   (interactive)
   (vhdl-template-directive "synthesis_off"))
 
@@ -10533,7 +10681,8 @@ specification, if not already there."
        (while (search-forward "<standard>" end t)
         (replace-match
          (concat "VHDL" (cond ((vhdl-standard-p '87) "'87")
-                              ((vhdl-standard-p '93) "'93/02"))
+                              ((vhdl-standard-p '93) "'93/02")
+                              ((vhdl-standard-p '08) "'08"))
                  (when (vhdl-standard-p 'ams) ", VHDL-AMS")
                  (when (vhdl-standard-p 'math) ", Math Packages")) t t))
        (goto-char beg)
@@ -10621,8 +10770,8 @@ If starting after end-comment-column, start a new line."
        (setq code t))
       (unless code
        (insert "--")) ; hardwire to 1 space or use vhdl-basic-offset?
-      (setq unread-command-events
-           (list (vhdl-character-to-event next-input)))))) ; pushback the char
+      (push (vhdl-character-to-event next-input) ; pushback the char
+            unread-command-events))))
 
 (defun vhdl-comment-display (&optional line-exists)
   "Add 2 comment lines at the current indent, making a display comment."
@@ -11071,13 +11220,13 @@ else insert tab (used for word completion in VHDL minibuffer)."
      (save-excursion
        (beginning-of-line)
        ;; search backward for block beginning or end
-       (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
+       (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|context\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
                              ;; not consider subprogram declarations
                              (or (and (match-string 5)
                                       (save-match-data
                                         (save-excursion
                                           (goto-char (match-end 5))
-                                          (forward-word 1)
+                                          (forward-word-strictly 1)
                                           (vhdl-forward-syntactic-ws)
                                           (when (looking-at "(")
                                             (forward-sexp))
@@ -11102,7 +11251,7 @@ else insert tab (used for word completion in VHDL minibuffer)."
      (save-excursion
        (end-of-line)
        ;; search forward for block beginning or end
-       (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
+       (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|context\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
                              ;; not consider subprogram declarations
                              (or (and (match-string 5)
                                       (save-match-data
@@ -11151,19 +11300,19 @@ else insert tab (used for word completion in VHDL minibuffer)."
 but not if inside a comment or quote."
   (if (or (vhdl-in-literal)
          (save-excursion
-           (forward-word -1)
+           (forward-word-strictly -1)
            (and (looking-at "\\<end\\>") (not (looking-at "\\<end;")))))
       (progn
        (insert " ")
        (unexpand-abbrev)
-       (backward-word 1)
+       (backward-word-strictly 1)
        (vhdl-case-word 1)
        (delete-char 1))
     (if (not vhdl-electric-mode)
        (progn
          (insert " ")
          (unexpand-abbrev)
-         (backward-word 1)
+         (backward-word-strictly 1)
          (vhdl-case-word 1)
          (delete-char 1))
       (let ((invoke-char vhdl-last-input-event)
@@ -11176,8 +11325,8 @@ but not if inside a comment or quote."
        ;; delete CR which is still in event queue
        (if (fboundp 'enqueue-eval-event)
            (enqueue-eval-event 'delete-char -1)
-         (setq unread-command-events   ; push back a delete char
-               (list (vhdl-character-to-event ?\177))))))))
+         (push (vhdl-character-to-event ?\177) ; push back a delete char
+                unread-command-events))))))
 
 (defun vhdl-template-alias-hook ()
   (vhdl-hooked-abbrev 'vhdl-template-alias))
@@ -11203,6 +11352,8 @@ but not if inside a comment or quote."
   (vhdl-hooked-abbrev 'vhdl-template-configuration))
 (defun vhdl-template-constant-hook ()
   (vhdl-hooked-abbrev 'vhdl-template-constant))
+(defun vhdl-template-context-hook ()
+  (vhdl-hooked-abbrev 'vhdl-template-context))
 (defun vhdl-template-disconnect-hook ()
   (vhdl-hooked-abbrev 'vhdl-template-disconnect))
 (defun vhdl-template-display-comment-hook ()
@@ -11564,7 +11715,7 @@ reflected in a subsequent paste operation."
                    (equal "END" (upcase (match-string 1))))
            (throw 'parse "ERROR:  Not within an entity or component declaration"))
          (setq decl-type (downcase (match-string-no-properties 1)))
-         (forward-word 1)
+         (forward-word-strictly 1)
          (vhdl-parse-string "\\s-+\\(\\w+\\)\\(\\s-+is\\>\\)?")
          (setq name (match-string-no-properties 1))
          (message "Reading port of %s \"%s\"..." decl-type name)
@@ -11720,7 +11871,7 @@ reflected in a subsequent paste operation."
                  (save-excursion
                    (re-search-backward
                     (concat "^\\s-*use\\s-+" (car clause)
-                            "\." (cdr clause) "\\>") nil t)))
+                            "." (cdr clause) "\\>") nil t)))
        (vhdl-template-standard-package (car clause) (cdr clause))
        (insert "\n"))
       (setq clause-list (cdr clause-list)))))
@@ -11975,7 +12126,7 @@ reflected in a subsequent paste operation."
               (insert name))
              ((equal (cdr vhdl-instance-name) "")
               (setq name (vhdl-template-field "instance name")))
-             ((string-match "\%d" (cdr vhdl-instance-name))
+             ((string-match "%d" (cdr vhdl-instance-name))
               (let ((n 1))
                 (while (save-excursion
                          (setq name (format (vhdl-replace-string
@@ -12840,7 +12991,7 @@ File statistics: \"%s\"\n\
 # empty lines   : %5d\n\
 # comment lines : %5d\n\
 # comments      : %5d\n\
-# total lines   : %5d\n"
+# total lines   : %5d\n"
             (buffer-file-name) no-stats no-code-lines no-empty-lines
             no-comm-lines no-comments no-lines)
     (unless vhdl-emacs-21 (vhdl-show-messages))))
@@ -12853,7 +13004,7 @@ File statistics: \"%s\"\n\
   (let (pos)
     (save-excursion
       (while (and (setq pos (re-search-forward regexp bound noerror count))
-                 (vhdl-in-literal))))
+                 (save-match-data (vhdl-in-literal)))))
     (when pos (goto-char pos))
     pos))
 
@@ -12862,7 +13013,7 @@ File statistics: \"%s\"\n\
   (let (pos)
     (save-excursion
       (while (and (setq pos (re-search-backward regexp bound noerror count))
-                 (vhdl-in-literal))))
+                 (save-match-data (vhdl-in-literal)))))
     (when pos (goto-char pos))
     pos))
 
@@ -12983,7 +13134,7 @@ File statistics: \"%s\"\n\
                     (vhdl-resolve-env-variable
                      (vhdl-replace-string
                       (cons "\\(.*\\) \\(.*\\)" (car file-name-list))
-                      (concat "\*" " " (user-login-name)))))))
+                      (concat "* " (user-login-name)))))))
       (setq list-length (or list-length (length file-list)))
       (setq file-name-list (cdr file-name-list)))
     (while file-list
@@ -13068,7 +13219,7 @@ File statistics: \"%s\"\n\
        ;; subprogram body
        (when (match-string 2)
         (re-search-forward "^\\s-*\\<begin\\>" nil t)
-        (backward-word 1)
+        (backward-word-strictly 1)
         (vhdl-forward-sexp)))
       ;; block (recursive)
       ((looking-at "^\\s-*\\w+\\s-*:\\s-*block\\>")
@@ -13081,7 +13232,7 @@ File statistics: \"%s\"\n\
        (re-search-forward "^\\s-*end\\s-+process\\>" nil t))
       ;; configuration declaration
       ((looking-at "^\\s-*configuration\\>")
-       (forward-word 4)
+       (forward-word-strictly 4)
        (vhdl-forward-sexp))
       (t (goto-char pos))))))
 
@@ -13168,8 +13319,8 @@ File statistics: \"%s\"\n\
 ;; Syntax definitions
 
 (defconst vhdl-font-lock-syntactic-keywords
-  '(("\\(\'\\).\\(\'\\)" (1 (7 . ?\')) (2 (7 . ?\'))))
-  "Mark single quotes as having string quote syntax in 'c' instances.")
+  '(("\\('\\).\\('\\)" (1 (7 . ?\')) (2 (7 . ?\'))))
+  "Mark single quotes as having string quote syntax in `c' instances.")
 
 (defvar vhdl-font-lock-keywords nil
   "Regular expressions to highlight in VHDL Mode.")
@@ -13190,7 +13341,8 @@ This does highlighting of keywords and standard identifiers.")
    (list
     (concat
      "^\\s-*\\("
-     "architecture\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|"
+     "architecture\\|configuration\\|context\\|entity\\|package"
+     "\\(\\s-+body\\)?\\|"
      "\\(\\(impure\\|pure\\)\\s-+\\)?function\\|procedure\\|component"
      "\\)\\s-+\\(\\w+\\)")
     5 'font-lock-function-name-face)
@@ -13232,9 +13384,9 @@ This does highlighting of keywords and standard identifiers.")
    (list
     (concat
      "^\\s-*end\\s-+\\(\\("
-     "architecture\\|block\\|case\\|component\\|configuration\\|entity\\|"
-     "for\\|function\\|generate\\|if\\|loop\\|package\\(\\s-+body\\)?\\|"
-     "procedure\\|\\(postponed\\s-+\\)?process\\|"
+     "architecture\\|block\\|case\\|component\\|configuration\\|context\\|"
+     "entity\\|for\\|function\\|generate\\|if\\|loop\\|package"
+     "\\(\\s-+body\\)?\\|procedure\\|\\(postponed\\s-+\\)?process\\|"
      (when (vhdl-standard-p 'ams) "procedural\\|")
      "units"
      "\\)\\s-+\\)?\\(\\w*\\)")
@@ -13266,10 +13418,10 @@ This does highlighting of keywords and standard identifiers.")
    ;; highlight names in use clauses
    (list
     (concat
-     "\\<use\\s-+\\(\\(entity\\|configuration\\)\\s-+\\)?"
+     "\\<\\(context\\|use\\)\\s-+\\(\\(entity\\|configuration\\)\\s-+\\)?"
      "\\(\\w+\\)\\(\\.\\(\\w+\\)\\)?\\((\\(\\w+\\))\\)?")
-    '(3 font-lock-function-name-face) '(5 font-lock-function-name-face nil t)
-    '(7 font-lock-function-name-face nil t))
+    '(4 font-lock-function-name-face) '(6 font-lock-function-name-face nil t)
+    '(8 font-lock-function-name-face nil t))
 
    ;; highlight attribute name in attribute declarations/specifications
    (list
@@ -13316,6 +13468,12 @@ This does highlighting of keywords and standard identifiers.")
         '(vhdl-font-lock-match-item
           (progn (goto-char (match-end 1)) (match-beginning 2))
           nil (1 font-lock-variable-name-face)))
+
+   ;; highlight tool directives
+   (list
+    (concat
+     "^\\s-*\\(`\\w+\\)")
+    1 'font-lock-preprocessor-face)
    )
   "For consideration as a value of `vhdl-font-lock-keywords'.
 This does context sensitive highlighting of names and labels.")
@@ -13661,7 +13819,7 @@ hierarchy otherwise.")
   "Return position of end of current unit."
   (let ((pos (point)))
     (save-excursion
-      (while (and (re-search-forward "^[ \t]*\\(architecture\\|configuration\\|entity\\|package\\)\\>" nil 1)
+      (while (and (re-search-forward "^[ \t]*\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\>" nil 1)
                  (save-excursion
                    (goto-char (match-beginning 0))
                    (vhdl-backward-syntactic-ws)
@@ -13682,7 +13840,7 @@ hierarchy otherwise.")
   "Scan the context clause that precedes a design unit."
   (let (lib-alist)
     (save-excursion
-      (when (re-search-backward "^[ \t]*\\(architecture\\|configuration\\|entity\\|package\\)\\>" nil t)
+      (when (re-search-backward "^[ \t]*\\(architecture\\|configuration\\|context\\|entity\\|package\\)\\>" nil t)
        (while (and (re-search-backward "^[ \t]*\\(end\\|use\\)\\>" nil t)
                    (equal "USE" (upcase (match-string 1))))
          (when (looking-at "^[ \t]*use[ \t\n\r\f]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+")
@@ -13738,10 +13896,10 @@ hierarchy otherwise.")
       ;; do for all files
       (while file-list
        (unless noninteractive
-         (message "Scanning %s %s\"%s\"... (%2d%s)"
+         (message "Scanning %s %s\"%s\"... (%2d%%)"
                   (if is-directory "directory" "files")
                   (or num-string "") name
-                  (/ (* 100 (- no-files (length file-list))) no-files) "%"))
+                  (floor (* 100.0 (- no-files (length file-list))) no-files)))
        (let ((file-name (abbreviate-file-name (car file-list)))
              ent-list arch-list arch-ent-list conf-list
              pack-list pack-body-list inst-list inst-ent-list)
@@ -15316,19 +15474,19 @@ NO-POSITION non-nil means do not re-position cursor."
          (let* ((file-entry (vhdl-aget file-alist
                                        speedbar-last-selected-file)))
            (vhdl-speedbar-update-units
-            "\\[.\\] " (nth 0 file-entry)
+            "\\[.] " (nth 0 file-entry)
             speedbar-last-selected-file 'vhdl-speedbar-entity-face)
            (vhdl-speedbar-update-units
             "{.} " (nth 1 file-entry)
             speedbar-last-selected-file 'vhdl-speedbar-architecture-face)
            (vhdl-speedbar-update-units
-            "\\[.\\] " (nth 3 file-entry)
+            "\\[.] " (nth 3 file-entry)
             speedbar-last-selected-file 'vhdl-speedbar-configuration-face)
            (vhdl-speedbar-update-units
             "[]>] " (nth 4 file-entry)
             speedbar-last-selected-file 'vhdl-speedbar-package-face)
            (vhdl-speedbar-update-units
-            "\\[.\\].+(" '("body")
+            "\\[.].+(" '("body")
             speedbar-last-selected-file 'vhdl-speedbar-package-face)
            (vhdl-speedbar-update-units
             "> " (nth 6 file-entry)
@@ -15337,19 +15495,19 @@ NO-POSITION non-nil means do not re-position cursor."
          (let* ((file-entry (vhdl-aget file-alist file-name)))
            (setq
             pos (vhdl-speedbar-update-units
-                 "\\[.\\] " (nth 0 file-entry)
+                 "\\[.] " (nth 0 file-entry)
                  file-name 'vhdl-speedbar-entity-selected-face pos)
             pos (vhdl-speedbar-update-units
                  "{.} " (nth 1 file-entry)
                  file-name 'vhdl-speedbar-architecture-selected-face pos)
             pos (vhdl-speedbar-update-units
-                 "\\[.\\] " (nth 3 file-entry)
+                 "\\[.] " (nth 3 file-entry)
                  file-name 'vhdl-speedbar-configuration-selected-face pos)
             pos (vhdl-speedbar-update-units
                  "[]>] " (nth 4 file-entry)
                  file-name 'vhdl-speedbar-package-selected-face pos)
             pos (vhdl-speedbar-update-units
-                 "\\[.\\].+(" '("body")
+                 "\\[.].+(" '("body")
                  file-name 'vhdl-speedbar-package-selected-face pos)
             pos (vhdl-speedbar-update-units
                  "> " (nth 6 file-entry)
@@ -15781,7 +15939,7 @@ is already shown in a buffer."
     (if (not (or is-entity (vhdl-speedbar-check-unit 'subprogram)))
        (error "ERROR:  No entity/component or subprogram under cursor")
       (beginning-of-line)
-      (if (looking-at "\\([0-9]\\)+:\\s-*\\(\\[[-+?]\\]\\|>\\) \\(\\(\\w\\|\\s_\\)+\\)")
+      (if (looking-at "\\([0-9]\\)+:\\s-*\\(\\[[-+?]]\\|>\\) \\(\\(\\w\\|\\s_\\)+\\)")
          (condition-case info
              (let ((token (get-text-property
                            (match-beginning 3) 'speedbar-token)))
@@ -17502,6 +17660,7 @@ specified by a target."
        'vhdl-argument-list-indent
        'vhdl-association-list-with-formals
        'vhdl-conditions-in-parenthesis
+       'vhdl-sensitivity-list-all
        'vhdl-zero-string
        'vhdl-one-string
        'vhdl-file-header
@@ -17606,6 +17765,17 @@ specified by a target."
 
 (defconst vhdl-doc-release-notes nil
   "\
+Release Notes for VHDL Mode 3.37
+================================
+
+- Added support for VHDL'08:
+  - New keywords, types, functions, attributes, operators, packages
+  - Context declaration
+  - Block comments
+  - Directives
+  - `all' keyword in sensitivity list
+
+
 Release Notes for VHDL Mode 3.34
 ================================
 
@@ -17667,6 +17837,13 @@ User Options
 Reserved words in VHDL
 ----------------------
 
+VHDL'08 (IEEE Std 1076-2008):
+  `vhdl-08-keywords'      : keywords
+  `vhdl-08-types'         : standardized types
+  `vhdl-08-attributes'    : standardized attributes
+  `vhdl-08-functions'     : standardized functions
+  `vhdl-08-packages'      : standardized packages and libraries
+
 VHDL'93/02 (IEEE Std 1076-1993/2002):
   `vhdl-02-keywords'      : keywords
   `vhdl-02-types'         : standardized types
@@ -17700,17 +17877,17 @@ NOTE: click `mouse-2' on variable names above (not in XEmacs).")
 For VHDL coding style and naming convention guidelines, see the following
 references:
 
-\[1] Ben Cohen.
+[1] Ben Cohen.
     \"VHDL Coding Styles and Methodologies\".
     Kluwer Academic Publishers, 1999.
     http://members.aol.com/vhdlcohen/vhdl/
 
-\[2] Michael Keating and Pierre Bricaud.
+[2] Michael Keating and Pierre Bricaud.
     \"Reuse Methodology Manual, Second Edition\".
     Kluwer Academic Publishers, 1999.
     http://www.openmore.com/openmore/rmm2.html
 
-\[3] European Space Agency.
+[3] European Space Agency.
     \"VHDL Modelling Guidelines\".
     ftp://ftp.estec.esa.nl/pub/vhdl/doc/ModelGuide.{pdf,ps}