X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/7cd80673b1ae580cb71e19e3b7dadc7e69066806..bdaf8a62d53cf8d5a0dc4f0dc530ecd6fc1f44fe:/lisp/progmodes/vhdl-mode.el diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 987b37cf2c..0d909a4a3f 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -1,12 +1,13 @@ ;;; vhdl-mode.el --- major mode for editing VHDL code -;; Copyright (C) 1992-2003, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +;; 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Authors: Reto Zimmermann ;; Rodney J. Whitby ;; Maintainer: Reto Zimmermann ;; Keywords: languages vhdl -;; WWW: http://opensource.ethz.ch/emacs/vhdl-mode.html +;; WWW: http://www.iis.ee.ethz.ch/~zimmi/emacs/vhdl-mode.html (defconst vhdl-version "3.33.6" "VHDL Mode version number.") @@ -18,7 +19,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) +;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -1023,13 +1024,13 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry (defcustom vhdl-reset-active-high nil "*Non-nil means reset in sequential processes is active high. -Nil means active low." +Otherwise, reset is active low." :type 'boolean :group 'vhdl-sequential-process) (defcustom vhdl-clock-rising-edge t "*Non-nil means rising edge of clock triggers sequential processes. -Nil means falling edge." +Otherwise, falling edge triggers." :type 'boolean :group 'vhdl-sequential-process) @@ -1146,7 +1147,7 @@ default setting as example)." (concat "*Specifies how the name for the components package is obtained. The components package is a package containing all component declarations for -the current design. It's name can be obtained by modifying the project name +the current design. Its name can be obtained by modifying the project name \(e.g. attaching or stripping off a substring). If no project is defined, the DIRECTORY entry is chosen." vhdl-name-doc-string) @@ -2433,7 +2434,7 @@ conversion." (insert-file-contents filename t))) (defun vhdl-sort-alist (alist) - "Sort alist." + "Sort ALIST." (sort alist (function (lambda (a b) (string< (car a) (car b)))))) (defun vhdl-get-subdirs (directory) @@ -2892,7 +2893,6 @@ STRING are replaced by `-' and substrings are converted to lower case." (defun vhdl-mode-abbrev-table-init () "Initialize `vhdl-mode-abbrev-table'." - (when vhdl-mode-abbrev-table (clear-abbrev-table vhdl-mode-abbrev-table)) (define-abbrev-table 'vhdl-mode-abbrev-table (append (when (memq 'vhdl vhdl-electric-keywords) @@ -5239,7 +5239,7 @@ Return a valid value only." (defun vhdl-set-offset (symbol offset &optional add-p) "Change the value of a syntactic element symbol in `vhdl-offsets-alist'. SYMBOL is the syntactic element symbol to change and OFFSET is the new -offset for that syntactic element. Optional ADD says to add SYMBOL to +offset for that syntactic element. Optional ADD-P says to add SYMBOL to `vhdl-offsets-alist' if it doesn't already appear there." (interactive (let* ((langelem @@ -5765,7 +5765,7 @@ keyword." "If the word at the current position corresponds to an \"end\" keyword, then return a vector containing enough information to find the corresponding \"begin\" keyword, else return nil. The keyword to -search backward for is aref 0. The column in which the keyword must +search backward for is aref 0. The column in which the keyword must appear is aref 1 or nil if any column is suitable. The supplementary keyword to search forward for is aref 2 or nil if this is not required. If aref 3 is t, then the \"begin\" keyword may be found in @@ -6424,8 +6424,8 @@ statement if already at the beginning of one." ;; Defuns for calculating the current syntactic state: (defun vhdl-get-library-unit (bod placeholder) - "If there is an enclosing library unit at bod, with it's \"begin\" -keyword at placeholder, then return the library unit type." + "If there is an enclosing library unit at BOD, with its \"begin\" +keyword at PLACEHOLDER, then return the library unit type." (let ((here (vhdl-point 'bol))) (if (save-excursion (goto-char placeholder) @@ -6448,7 +6448,7 @@ keyword at placeholder, then return the library unit type." (defun vhdl-get-block-state (&optional lim) "Finds and records all the closest opens. -lim is the furthest back we need to search (it should be the +LIM is the furthest back we need to search (it should be the previous libunit keyword)." (let ((here (point)) (lim (or lim (point-min))) @@ -6514,8 +6514,8 @@ previous libunit keyword)." (defun vhdl-skip-case-alternative (&optional lim) "Skip forward over case/when bodies, with optional maximal -limit. If no next case alternative is found, nil is returned and point -is not moved." +limit. If no next case alternative is found, nil is returned and +point is not moved." (let ((lim (or lim (point-max))) (here (point)) donep foundp) @@ -6541,7 +6541,7 @@ is not moved." (defun vhdl-backward-skip-label (&optional lim) "Skip backward over a label, with optional maximal -limit. If label is not found, nil is returned and point +limit. If label is not found, nil is returned and point is not moved." (let ((lim (or lim (point-min))) placeholder) @@ -6982,10 +6982,13 @@ only-lines." (when (and vhdl-progress-info (not noninteractive) (< vhdl-progress-interval (- (nth 1 (current-time)) (aref vhdl-progress-info 2)))) - (message (concat string "... (%2d%s)") - (/ (* 100 (- pos (aref vhdl-progress-info 0))) - (- (aref vhdl-progress-info 1) - (aref vhdl-progress-info 0))) "%") + (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) "%"))) (aset vhdl-progress-info 2 (nth 1 (current-time))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -7028,7 +7031,7 @@ else indent `correctly'." (indent-to comment-column) (indent-according-to-mode)) (t ; inline comment indent - (kill-line -0)))) + (delete-region (line-beginning-position) (point))))) ;; dedent ((and (>= (current-indentation) vhdl-basic-offset) (or (eq last-command 'vhdl-electric-tab) @@ -7161,7 +7164,7 @@ ENDPOS is encountered." (when (not (looking-at "^\\s-*\\(--.*\\)?$")) (end-of-line) (if (search-backward " -- ((" (vhdl-point 'bol) t) - (kill-line)) + (delete-region (point) (line-end-position))) (insert " -- ") (insert (format "%s" expurgated)))))) (vhdl-keep-region-active)) @@ -7306,9 +7309,9 @@ indentation is done before aligning." (defun vhdl-align-region-2 (begin end match &optional substr spacing) "Align a range of lines from BEGIN to END. The regular expression -MATCH must match exactly one fields: the whitespace to be +MATCH must match exactly one field: the whitespace to be contracted/expanded. The alignment column will equal the -rightmost column of the widest whitespace block. SPACING is +rightmost column of the widest whitespace block. SPACING is the amount of extra spaces to add to the calculated maximum required. SPACING defaults to 1 so that at least one space is inserted after the token in MATCH." @@ -8101,7 +8104,7 @@ Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." (defun vhdl-electric-dash (count) "-- starts a comment, --- draws a horizontal line, ----- starts a display comment" +---- starts a display comment." (interactive "p") (if (and vhdl-stutter-mode (not (vhdl-in-literal))) (cond @@ -8346,7 +8349,9 @@ Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." (progn (vhdl-insert-keyword "FOR ") (if (vhdl-template-field "[quantity name]" " USE " t) (progn (vhdl-template-field "quantity name" " => ") t) - (kill-word -1) nil)) + (delete-region (point) + (progn (forward-word -1) (point))) + nil)) (vhdl-template-field "[quantity name]" " => " t)) (vhdl-template-field "expression") (setq position (point)) @@ -8482,7 +8487,7 @@ since these are almost equivalent)." (setq position (point)) (vhdl-insert-keyword "PORT ") (unless (vhdl-template-map position t t) - (kill-line -0) + (delete-region (line-beginning-position) (point)) (delete-char -1)) (insert ";")))) @@ -8573,7 +8578,7 @@ a configuration declaration if not within a design unit." (setq position (point)) (vhdl-insert-keyword "PORT ") (unless (vhdl-template-map position t t) - (kill-line -0) + (delete-region (line-beginning-position) (point)) (delete-char -1)) (insert ";") t) @@ -9116,11 +9121,11 @@ otherwise." (cond ((equal definition "") (insert ";")) ((equal definition "ARRAY") - (kill-word -1) + (delete-region (point) (progn (forward-word -1) (point))) (vhdl-template-array 'nature t)) ((equal definition "RECORD") (setq mid-pos (point-marker)) - (kill-word -1) + (delete-region (point) (progn (forward-word -1) (point))) (vhdl-template-record 'nature name t)) (t (vhdl-insert-keyword " ACROSS ") @@ -9435,7 +9440,7 @@ otherwise." (insert "\n") (indent-to (+ margin vhdl-basic-offset)) (setq first nil)) - (kill-line -0) + (delete-region (line-beginning-position) (point)) (indent-to margin) (vhdl-insert-keyword "END RECORD") (unless (vhdl-standard-p '87) (and name (insert " " name))) @@ -9600,11 +9605,11 @@ otherwise." (delete-backward-char 4) (insert ";")) ((equal definition "ARRAY") - (kill-word -1) + (delete-region (point) (progn (forward-word -1) (point))) (vhdl-template-array 'type t)) ((equal definition "RECORD") (setq mid-pos (point-marker)) - (kill-word -1) + (delete-region (point) (progn (forward-word -1) (point))) (vhdl-template-record 'type name t)) ((equal definition "ACCESS") (insert " ") @@ -10448,7 +10453,7 @@ with double-quotes is to be inserted. DEFAULT specifies a default string." (if vhdl-upper-case-keywords (upcase keyword) (downcase keyword))) (defun vhdl-case-word (num) - "Adjust case or following NUM words." + "Adjust case of following NUM words." (if vhdl-upper-case-keywords (upcase-word num) (downcase-word num))) (defun vhdl-minibuffer-tab (&optional prefix-arg) @@ -10586,7 +10591,7 @@ else insert tab (used for word completion in VHDL minibuffer)." (defun vhdl-hooked-abbrev (func) "Do function, if syntax says abbrev is a keyword, invoked by hooked abbrev, -but not if inside a comment or quote)." +but not if inside a comment or quote." (if (or (vhdl-in-literal) (save-excursion (forward-word -1) @@ -12083,8 +12088,8 @@ expressions (e.g. for index ranges of types and signals)." ;; Case fixing (defun vhdl-fix-case-region-1 (beg end upper-case word-regexp &optional count) - "Convert all words matching word-regexp in region to lower or upper case, -depending on parameter upper-case." + "Convert all words matching WORD-REGEXP in region to lower or upper case, +depending on parameter UPPER-CASE." (let ((case-replace nil) (last-update 0)) (vhdl-prepare-search-2 @@ -12463,7 +12468,7 @@ File statistics: \"%s\"\n\ "Regexp to match start of construct to hide.") (defun vhdl-hs-forward-sexp-func (count) - "Find end of construct to hide (for hideshow). Only searches forward." + "Find end of construct to hide (for hideshow). Only searches forward." (let ((pos (point))) (vhdl-prepare-search-2 (beginning-of-line) @@ -12586,7 +12591,7 @@ File statistics: \"%s\"\n\ (goto-char end)))))) (defun vhdl-font-lock-match-item (limit) - "Match, and move over, any declaration item after point. Adapted from + "Match, and move over, any declaration item after point. Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'." (condition-case nil (save-restriction @@ -13130,7 +13135,7 @@ hierarchy otherwise.") (defun vhdl-scan-directory-contents (name &optional project update num-string non-final) - "Scan contents of VHDL files in directory or file pattern DIR-NAME." + "Scan contents of VHDL files in directory or file pattern NAME." (string-match "\\(.*[/\\]\\)\\(.*\\)" name) ; (unless (file-directory-p (match-string 1 name)) ; (message "No such directory: \"%s\"" (match-string 1 name))) @@ -13851,7 +13856,7 @@ entity ENT-KEY." (vhdl-save-cache (car project-list)) (setq project-list (cdr project-list))) (message "Saving hierarchy caches...done"))) - (error (progn (vhdl-warning "ERROR: An error occured while saving the hierarchy caches") + (error (progn (vhdl-warning "ERROR: An error occurred while saving the hierarchy caches") (sit-for 2))))) (defun vhdl-save-cache (key) @@ -14112,8 +14117,8 @@ if required." (defun vhdl-speedbar-display-directory (directory depth &optional rescan) "Display directory and hierarchy information in speedbar." (setq vhdl-speedbar-show-projects nil) - (setq speedbar-ignored-path-regexp - (speedbar-extension-list-to-regex speedbar-ignored-path-expressions)) + (setq speedbar-ignored-directory-regexp + (speedbar-extension-list-to-regex speedbar-ignored-directory-expressions)) (setq directory (abbreviate-file-name (file-name-as-directory directory))) (setq speedbar-last-selected-file nil) (speedbar-with-writable @@ -14133,7 +14138,7 @@ if required." (defun vhdl-speedbar-display-projects (project depth &optional rescan) "Display projects and hierarchy information in speedbar." (setq vhdl-speedbar-show-projects t) - (setq speedbar-ignored-path-regexp ".") + (setq speedbar-ignored-directory-regexp ".") (setq speedbar-last-selected-file nil) (setq vhdl-speedbar-last-selected-project nil) (speedbar-with-writable @@ -14172,7 +14177,7 @@ if required." ) (defun vhdl-speedbar-insert-project-hierarchy (project indent &optional rescan) - "Insert hierarchy of project. Rescan directories if RESCAN is non-nil, + "Insert hierarchy of PROJECT. Rescan directories if RESCAN is non-nil, otherwise use cached data." (when (or rescan (and (not (assoc project vhdl-file-alist)) (not (vhdl-load-cache project))))