summaryrefslogtreecommitdiff
path: root/lisp/progmodes/vhdl-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/vhdl-mode.el')
-rw-r--r--lisp/progmodes/vhdl-mode.el46
1 files changed, 28 insertions, 18 deletions
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 337694e52b2..274c5e70df0 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -1219,7 +1219,7 @@ The format is suitable for use with `easy-menu-define'."
(defun vhdl-add-index-menu ()
(make-local-variable 'imenu-generic-expression)
- (setq imenu-generic-expression vhdl-imenu-generic-expression)
+ (setq imenu-generic-expression (nreverse vhdl-imenu-generic-expression))
(imenu-add-to-menubar "Index"))
;; ############################################################################
@@ -3955,7 +3955,7 @@ the token in MATCH."
(vhdl-insert-keyword "ASSERT ")
(if vhdl-conditions-in-parenthesis (insert "("))
(if (equal (vhdl-field "condition (negated)") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(if vhdl-conditions-in-parenthesis (insert ")"))
(vhdl-insert-keyword " REPORT \"")
(vhdl-field "string-expression" "\" ")
@@ -3991,7 +3991,7 @@ the token in MATCH."
(let* ((margin (current-column))
(name (vhdl-field "label")))
(if (equal name "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(end-of-line)
(insert "(")
(if (equal (vhdl-field "[guard expression]") "")
@@ -4132,7 +4132,7 @@ a configuration declaration if not within a design unit."
(let ((margin (current-column)))
(vhdl-insert-keyword "FOR ")
(if (equal (vhdl-field "(component names | ALL)" " : ") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(vhdl-field "component type" "\n")
(indent-to (+ margin vhdl-basic-offset))
(vhdl-insert-keyword "USE ENTITY ")
@@ -4261,7 +4261,7 @@ a configuration declaration if not within a design unit."
(vhdl-insert-keyword "ELSIF ")
(if vhdl-conditions-in-parenthesis (insert "("))
(if (equal (vhdl-field "condition") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(if vhdl-conditions-in-parenthesis (insert ")"))
(vhdl-indent-line)
(setq margin (current-indentation))
@@ -4385,7 +4385,7 @@ declaration, a for loop otherwise."
(label (vhdl-field "label"))
(string))
(if (equal label "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(insert " : ")
(setq string (vhdl-field "(FOR | IF)"))
(insert " ")
@@ -4482,7 +4482,7 @@ declaration, a for loop otherwise."
(vhdl-insert-keyword "IF ")
(if vhdl-conditions-in-parenthesis (insert "("))
(if (equal (vhdl-field "condition") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(if vhdl-conditions-in-parenthesis (insert ")"))
(vhdl-insert-keyword " THEN\n\n")
(indent-to margin)
@@ -4535,7 +4535,7 @@ declaration, a for loop otherwise."
(interactive)
(vhdl-insert-keyword "MAP (")
(if (equal (vhdl-field "[association list]") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(insert ")")
))
@@ -4718,7 +4718,7 @@ declaration, a for loop otherwise."
(goto-char position))
(vhdl-insert-keyword "WITH ")
(if (equal (vhdl-field "selector expression") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(end-of-line)
(insert "\n")
(indent-to (+ margin vhdl-basic-offset))
@@ -4806,7 +4806,7 @@ declaration, a for loop otherwise."
(vhdl-insert-keyword "USE ..ALL;")
(backward-char 6)
(if (equal (vhdl-field "library name") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(forward-char 1)
(vhdl-field "package name")
(end-of-line)
@@ -4855,7 +4855,8 @@ declaration, a for loop otherwise."
(interactive)
(let ((position (point))
(margin))
- (if (and (re-search-forward "\\<end\\>" nil t)
+ (if (and (= (current-column) (current-indentation))
+ (re-search-forward "\\<end\\>" nil t)
(looking-at "\\s-*\\<case\\>"))
(progn
(setq margin (current-indentation))
@@ -4880,7 +4881,7 @@ declaration, a for loop otherwise."
(end-of-line)
(if vhdl-conditions-in-parenthesis (insert "("))
(if (equal (vhdl-field "condition") "")
- (progn (undo 0) (insert " "))
+ (progn (undo 2))
(if vhdl-conditions-in-parenthesis (insert ")"))
(vhdl-insert-keyword " LOOP\n\n")
(indent-to margin)
@@ -5106,7 +5107,12 @@ if in comment and past end-comment-column."
(interactive "p")
(if (or (and (>= (preceding-char) ?a) (<= (preceding-char) ?z))
(and (>= (preceding-char) ?A) (<= (preceding-char) ?Z)))
- (expand-abbrev))
+ (progn
+ (modify-syntax-entry ?_ "w" vhdl-mode-syntax-table)
+ (expand-abbrev)
+ (if (not vhdl-underscore-is-part-of-word)
+ (modify-syntax-entry ?_ "_" vhdl-mode-syntax-table))
+ ))
(if (not (vhdl-in-comment-p))
(self-insert-command count)
(if (< (current-column) end-comment-column)
@@ -5236,7 +5242,7 @@ Point is left between them."
(progn (vhdl-kill-entire-line) (forward-line -1)
(if (not vhdl-argument-list-indent)
(progn (vhdl-kill-entire-line) (forward-line -1))))
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
nil )
(insert " : ")
(progn
@@ -5254,7 +5260,8 @@ Point is left between them."
(setq vhdl-ports (vhdl-field "[names]" " : ")))
(goto-char semicolon-pos)
(if (not vhdl-argument-list-indent)
- (progn (insert "\n") (indent-to margin)))
+ (progn (delete-char 1) (end-of-line) (insert "\n")
+ (indent-to margin) (insert ";") (backward-char 1)))
(insert ")")
(forward-char 1)
(if (= (following-char) ? )
@@ -5285,7 +5292,7 @@ Point is left between them."
(progn (vhdl-kill-entire-line) (end-of-line -0)
(if (not vhdl-argument-list-indent)
(progn (vhdl-kill-entire-line) (end-of-line -0))))
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
nil )
(insert " : ")
(progn
@@ -5308,7 +5315,8 @@ Point is left between them."
(setq vhdl-generic (vhdl-field "[name]" " : "))))
(goto-char semicolon-pos)
(if (not vhdl-argument-list-indent)
- (progn (insert "\n") (indent-to margin)))
+ (progn (delete-char 1) (end-of-line) (insert "\n")
+ (indent-to margin) (insert ";") (backward-char 1)))
(insert ")")
(forward-char 1)
(if (= (following-char) ? )
@@ -5473,7 +5481,9 @@ else indent line in proper way for current major mode
but not if inside a comment or quote)"
(if (or (vhdl-in-comment-p)
(vhdl-in-string-p)
- (save-excursion (forward-word -1) (looking-at "end")))
+ (save-excursion (forward-word -1)
+ (and (looking-at "\\<end\\>")
+ (not (looking-at "\\<end;")))))
(progn
(insert " ")
(unexpand-abbrev)