]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/vhdl-mode.el
Fix keywords.
[gnu-emacs] / lisp / progmodes / vhdl-mode.el
index 55735763b6735ef76024c13277a7bc651fa11782..1210592af1852f37d622c37c27b1f76ae3df35a8 100644 (file)
@@ -1,7 +1,7 @@
 ;;; vhdl-mode.el --- major mode for editing VHDL code
 
 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Authors:     Reto Zimmermann <reto@gnu.org>
@@ -2328,42 +2328,19 @@ current buffer if no project is defined."
   "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
-        (current-syntax-table (syntax-table))
-        result
-        (restore-prog                  ; program to restore enviroment
-         '(progn
-            ;; restore syntax table
-            (set-syntax-table current-syntax-table))))
+  `(let ((case-fold-search t))         ; case insensitive search
      ;; use extended syntax table
-     (set-syntax-table vhdl-mode-ext-syntax-table)
-     ;; execute BODY safely
-     (setq result
-          (condition-case info
-              (progn ,@body)
-            (error (eval restore-prog) ; restore environment on error
-                   (error (cadr info))))) ; pass error up
-     ;; restore environment
-     (eval restore-prog)
-     result))
+     (with-syntax-table vhdl-mode-ext-syntax-table
+       ,@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
   `(let ((case-fold-search t)          ; case insensitive search
         (current-syntax-table (syntax-table))
-        result overlay-all-list overlay-intangible-list overlay
-        (restore-prog                  ; program to restore enviroment
-         '(progn
-            ;; 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)))))))
+        overlay-all-list overlay-intangible-list overlay)
      ;; use extended syntax table
      (set-syntax-table vhdl-mode-ext-syntax-table)
      ;; remove `intangible' overlays
@@ -2379,14 +2356,16 @@ old environment.  Used for consistent searching."
           (overlay-put overlay 'intangible nil))
         (setq overlay-all-list (cdr overlay-all-list))))
      ;; execute BODY safely
-     (setq result
-          (condition-case info
-              (progn ,@body)
-            (error (eval restore-prog) ; restore environment on error
-                   (error (cadr info))))) ; pass error up
-     ;; restore environment
-     (eval restore-prog)
-     result))
+     (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)))))))
 
 (defmacro vhdl-visit-file (file-name issue-error &rest body)
   "Visit file FILE-NAME and execute BODY."
@@ -4669,7 +4648,7 @@ releases.  You are kindly invited to participate in beta testing.  Subscribe
 to above mailing lists by sending an email to <reto@gnu.org>.
 
 VHDL Mode is officially distributed at
-http://opensource.ethz.ch/emacs/vhdl-mode.html
+URL `http://opensource.ethz.ch/emacs/vhdl-mode.html'
 where the latest version can be found.
 
 
@@ -15173,7 +15152,8 @@ is already shown in a buffer."
     (let ((buffer (get-file-buffer (car token))))
       (speedbar-find-file-in-frame (car token))
       (when (or vhdl-speedbar-jump-to-unit buffer)
-       (goto-line (cdr token))
+       (goto-char (point-min))
+       (forward-line (1- (cdr token)))
        (recenter))
       (vhdl-speedbar-update-current-unit t t)
       (speedbar-set-timer dframe-update-speed)
@@ -15191,7 +15171,8 @@ is already shown in a buffer."
              (let ((token (get-text-property
                            (match-beginning 3) 'speedbar-token)))
                (vhdl-visit-file (car token) t
-                                (progn (goto-line (cdr token))
+                                (progn (goto-char (point-min))
+                                       (forward-line (1- (cdr token)))
                                        (end-of-line)
                                        (if is-entity
                                            (vhdl-port-copy)
@@ -15940,7 +15921,8 @@ current project/directory."
     ;; insert component declarations
     (while ent-alist
       (vhdl-visit-file (nth 2 (car ent-alist)) nil
-                      (progn (goto-line (nth 3 (car ent-alist)))
+                      (progn (goto-char (point-min))
+                             (forward-line (1- (nth 3 (car ent-alist))))
                              (end-of-line)
                              (vhdl-port-copy)))
       (goto-char component-pos)
@@ -17000,7 +16982,7 @@ to visually support naming conventions.")
     (princ (documentation-property variable 'variable-documentation))
     (with-current-buffer standard-output
       (help-mode))
-    (print-help-return-message)))
+    (help-print-return-message)))
 
 (defun vhdl-doc-mode ()
   "Display VHDL Mode documentation in *Help* buffer."
@@ -17014,7 +16996,7 @@ to visually support naming conventions.")
     (princ (documentation 'vhdl-mode))
     (with-current-buffer standard-output
       (help-mode))
-    (print-help-return-message)))
+    (help-print-return-message)))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;