;;; 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>
"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
(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."
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.
(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)
(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)
;; 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)
(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."
(princ (documentation 'vhdl-mode))
(with-current-buffer standard-output
(help-mode))
- (print-help-return-message)))
+ (help-print-return-message)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;