(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"))
;; ############################################################################
(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" "\" ")
(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]") "")
(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 ")
(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))
(label (vhdl-field "label"))
(string))
(if (equal label "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(insert " : ")
(setq string (vhdl-field "(FOR | IF)"))
(insert " ")
(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)
(interactive)
(vhdl-insert-keyword "MAP (")
(if (equal (vhdl-field "[association list]") "")
- (progn (undo 0) (insert " "))
+ (progn (undo) (insert " "))
(insert ")")
))
(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))
(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)
(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))
(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)
(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)
(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
(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) ? )
(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
(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) ? )
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)