summaryrefslogtreecommitdiff
path: root/lisp/progmodes/vhdl-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-04-10 18:15:43 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-04-10 18:15:43 +0000
commit4bcb9c95c11c7fd05710d2f2bf78015d3de8176a (patch)
tree66ff37aa61d9af19e0c003ddf68b233520e2a4e8 /lisp/progmodes/vhdl-mode.el
parentd7db37ef5810eed27d99001a0db90692155e87a2 (diff)
downloademacs-4bcb9c95c11c7fd05710d2f2bf78015d3de8176a.tar.gz
(vhdl-mode-map-init): Don't override default
TAB binding so tab-always-indent is obeyed. (vhdl-minibuffer-local-map): Move initialization into declaration. (vhdl-mode-abbrev-table-init): Mark the abbrevs as `system'. (vhdl-run-when-idle, vhdl-create-mode-menu, vhdl-character-to-event) (vhdl-hooked-abbrev): Avoid test for XEmacs. (vhdl-current-line): Use line-beginning-position. (vhdl-doc-variable, vhdl-doc-mode): Call help-setup-xref before with-output-to-temp-buffer, so the current position can be recorded.
Diffstat (limited to 'lisp/progmodes/vhdl-mode.el')
-rw-r--r--lisp/progmodes/vhdl-mode.el297
1 files changed, 149 insertions, 148 deletions
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 914c6725cc7..9f0e63e80a6 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -2039,7 +2039,7 @@ Ignore byte-compiler warnings you might see."
(defun vhdl-run-when-idle (secs repeat function)
"Wait until idle, then run FUNCTION."
- (if vhdl-xemacs
+ (if (fboundp 'start-itimer)
(start-itimer "vhdl-mode" function secs repeat t)
; (run-with-idle-timer secs repeat function)))
;; explicitely activate timer (necessary when Emacs is already idle)
@@ -2679,7 +2679,9 @@ STRING are replaced by `-' and substrings are converted to lower case."
(define-key vhdl-mode-map " " 'vhdl-electric-space)
(if vhdl-intelligent-tab
(define-key vhdl-mode-map "\t" 'vhdl-electric-tab)
- (define-key vhdl-mode-map "\t" 'indent-according-to-mode))
+ ;; The default binding of TAB already calls `indent-according-to-mode'.
+ ;; (define-key vhdl-mode-map "\t" 'indent-according-to-mode)
+ )
(define-key vhdl-mode-map "\r" 'vhdl-electric-return)
(define-key vhdl-mode-map "-" 'vhdl-electric-dash)
(define-key vhdl-mode-map "[" 'vhdl-electric-open-bracket)
@@ -2696,12 +2698,14 @@ STRING are replaced by `-' and substrings are converted to lower case."
;; define special minibuffer keymap for enabling word completion in minibuffer
;; (useful in template generator prompts)
-(defvar vhdl-minibuffer-local-map (copy-keymap minibuffer-local-map)
+(defvar vhdl-minibuffer-local-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map minibuffer-local-map)
+ (when vhdl-word-completion-in-minibuffer
+ (define-key map "\t" 'vhdl-minibuffer-tab))
+ map)
"Keymap for minibuffer used in VHDL Mode.")
-(when vhdl-word-completion-in-minibuffer
- (define-key vhdl-minibuffer-local-map "\t" 'vhdl-minibuffer-tab))
-
;; set up electric character functions to work with
;; `delete-selection-mode' (Emacs) and `pending-delete-mode' (XEmacs)
(mapcar
@@ -2792,134 +2796,134 @@ STRING are replaced by `-' and substrings are converted to lower case."
(when (memq 'vhdl vhdl-electric-keywords)
;; VHDL'93 keywords
'(
- ("--" "" vhdl-template-display-comment-hook 0)
- ("abs" "" vhdl-template-default-hook 0)
- ("access" "" vhdl-template-default-hook 0)
- ("after" "" vhdl-template-default-hook 0)
- ("alias" "" vhdl-template-alias-hook 0)
- ("all" "" vhdl-template-default-hook 0)
- ("and" "" vhdl-template-default-hook 0)
- ("arch" "" vhdl-template-architecture-hook 0)
- ("architecture" "" vhdl-template-architecture-hook 0)
- ("array" "" vhdl-template-default-hook 0)
- ("assert" "" vhdl-template-assert-hook 0)
- ("attr" "" vhdl-template-attribute-hook 0)
- ("attribute" "" vhdl-template-attribute-hook 0)
- ("begin" "" vhdl-template-default-indent-hook 0)
- ("block" "" vhdl-template-block-hook 0)
- ("body" "" vhdl-template-default-hook 0)
- ("buffer" "" vhdl-template-default-hook 0)
- ("bus" "" vhdl-template-default-hook 0)
- ("case" "" vhdl-template-case-hook 0)
- ("comp" "" vhdl-template-component-hook 0)
- ("component" "" vhdl-template-component-hook 0)
- ("cond" "" vhdl-template-conditional-signal-asst-hook 0)
- ("conditional" "" vhdl-template-conditional-signal-asst-hook 0)
- ("conf" "" vhdl-template-configuration-hook 0)
- ("configuration" "" vhdl-template-configuration-hook 0)
- ("cons" "" vhdl-template-constant-hook 0)
- ("constant" "" vhdl-template-constant-hook 0)
- ("disconnect" "" vhdl-template-disconnect-hook 0)
- ("downto" "" vhdl-template-default-hook 0)
- ("else" "" vhdl-template-else-hook 0)
- ("elseif" "" vhdl-template-elsif-hook 0)
- ("elsif" "" vhdl-template-elsif-hook 0)
- ("end" "" vhdl-template-default-indent-hook 0)
- ("entity" "" vhdl-template-entity-hook 0)
- ("exit" "" vhdl-template-exit-hook 0)
- ("file" "" vhdl-template-file-hook 0)
- ("for" "" vhdl-template-for-hook 0)
- ("func" "" vhdl-template-function-hook 0)
- ("function" "" vhdl-template-function-hook 0)
- ("generic" "" vhdl-template-generic-hook 0)
- ("group" "" vhdl-template-group-hook 0)
- ("guarded" "" vhdl-template-default-hook 0)
- ("if" "" vhdl-template-if-hook 0)
- ("impure" "" vhdl-template-default-hook 0)
- ("in" "" vhdl-template-default-hook 0)
- ("inertial" "" vhdl-template-default-hook 0)
- ("inout" "" vhdl-template-default-hook 0)
- ("inst" "" vhdl-template-instance-hook 0)
- ("instance" "" vhdl-template-instance-hook 0)
- ("is" "" vhdl-template-default-hook 0)
- ("label" "" vhdl-template-default-hook 0)
- ("library" "" vhdl-template-library-hook 0)
- ("linkage" "" vhdl-template-default-hook 0)
- ("literal" "" vhdl-template-default-hook 0)
- ("loop" "" vhdl-template-bare-loop-hook 0)
- ("map" "" vhdl-template-map-hook 0)
- ("mod" "" vhdl-template-default-hook 0)
- ("nand" "" vhdl-template-default-hook 0)
- ("new" "" vhdl-template-default-hook 0)
- ("next" "" vhdl-template-next-hook 0)
- ("nor" "" vhdl-template-default-hook 0)
- ("not" "" vhdl-template-default-hook 0)
- ("null" "" vhdl-template-default-hook 0)
- ("of" "" vhdl-template-default-hook 0)
- ("on" "" vhdl-template-default-hook 0)
- ("open" "" vhdl-template-default-hook 0)
- ("or" "" vhdl-template-default-hook 0)
- ("others" "" vhdl-template-others-hook 0)
- ("out" "" vhdl-template-default-hook 0)
- ("pack" "" vhdl-template-package-hook 0)
- ("package" "" vhdl-template-package-hook 0)
- ("port" "" vhdl-template-port-hook 0)
- ("postponed" "" vhdl-template-default-hook 0)
- ("procedure" "" vhdl-template-procedure-hook 0)
- ("process" "" vhdl-template-process-hook 0)
- ("pure" "" vhdl-template-default-hook 0)
- ("range" "" vhdl-template-default-hook 0)
- ("record" "" vhdl-template-default-hook 0)
- ("register" "" vhdl-template-default-hook 0)
- ("reject" "" vhdl-template-default-hook 0)
- ("rem" "" vhdl-template-default-hook 0)
- ("report" "" vhdl-template-report-hook 0)
- ("return" "" vhdl-template-return-hook 0)
- ("rol" "" vhdl-template-default-hook 0)
- ("ror" "" vhdl-template-default-hook 0)
- ("select" "" vhdl-template-selected-signal-asst-hook 0)
- ("severity" "" vhdl-template-default-hook 0)
- ("shared" "" vhdl-template-default-hook 0)
- ("sig" "" vhdl-template-signal-hook 0)
- ("signal" "" vhdl-template-signal-hook 0)
- ("sla" "" vhdl-template-default-hook 0)
- ("sll" "" vhdl-template-default-hook 0)
- ("sra" "" vhdl-template-default-hook 0)
- ("srl" "" vhdl-template-default-hook 0)
- ("subtype" "" vhdl-template-subtype-hook 0)
- ("then" "" vhdl-template-default-hook 0)
- ("to" "" vhdl-template-default-hook 0)
- ("transport" "" vhdl-template-default-hook 0)
- ("type" "" vhdl-template-type-hook 0)
- ("unaffected" "" vhdl-template-default-hook 0)
- ("units" "" vhdl-template-default-hook 0)
- ("until" "" vhdl-template-default-hook 0)
- ("use" "" vhdl-template-use-hook 0)
- ("var" "" vhdl-template-variable-hook 0)
- ("variable" "" vhdl-template-variable-hook 0)
- ("wait" "" vhdl-template-wait-hook 0)
- ("when" "" vhdl-template-when-hook 0)
- ("while" "" vhdl-template-while-loop-hook 0)
- ("with" "" vhdl-template-with-hook 0)
- ("xnor" "" vhdl-template-default-hook 0)
- ("xor" "" vhdl-template-default-hook 0)
+ ("--" "" vhdl-template-display-comment-hook 0 t)
+ ("abs" "" vhdl-template-default-hook 0 t)
+ ("access" "" vhdl-template-default-hook 0 t)
+ ("after" "" vhdl-template-default-hook 0 t)
+ ("alias" "" vhdl-template-alias-hook 0 t)
+ ("all" "" vhdl-template-default-hook 0 t)
+ ("and" "" vhdl-template-default-hook 0 t)
+ ("arch" "" vhdl-template-architecture-hook 0 t)
+ ("architecture" "" vhdl-template-architecture-hook 0 t)
+ ("array" "" vhdl-template-default-hook 0 t)
+ ("assert" "" vhdl-template-assert-hook 0 t)
+ ("attr" "" vhdl-template-attribute-hook 0 t)
+ ("attribute" "" vhdl-template-attribute-hook 0 t)
+ ("begin" "" vhdl-template-default-indent-hook 0 t)
+ ("block" "" vhdl-template-block-hook 0 t)
+ ("body" "" vhdl-template-default-hook 0 t)
+ ("buffer" "" vhdl-template-default-hook 0 t)
+ ("bus" "" vhdl-template-default-hook 0 t)
+ ("case" "" vhdl-template-case-hook 0 t)
+ ("comp" "" vhdl-template-component-hook 0 t)
+ ("component" "" vhdl-template-component-hook 0 t)
+ ("cond" "" vhdl-template-conditional-signal-asst-hook 0 t)
+ ("conditional" "" vhdl-template-conditional-signal-asst-hook 0 t)
+ ("conf" "" vhdl-template-configuration-hook 0 t)
+ ("configuration" "" vhdl-template-configuration-hook 0 t)
+ ("cons" "" vhdl-template-constant-hook 0 t)
+ ("constant" "" vhdl-template-constant-hook 0 t)
+ ("disconnect" "" vhdl-template-disconnect-hook 0 t)
+ ("downto" "" vhdl-template-default-hook 0 t)
+ ("else" "" vhdl-template-else-hook 0 t)
+ ("elseif" "" vhdl-template-elsif-hook 0 t)
+ ("elsif" "" vhdl-template-elsif-hook 0 t)
+ ("end" "" vhdl-template-default-indent-hook 0 t)
+ ("entity" "" vhdl-template-entity-hook 0 t)
+ ("exit" "" vhdl-template-exit-hook 0 t)
+ ("file" "" vhdl-template-file-hook 0 t)
+ ("for" "" vhdl-template-for-hook 0 t)
+ ("func" "" vhdl-template-function-hook 0 t)
+ ("function" "" vhdl-template-function-hook 0 t)
+ ("generic" "" vhdl-template-generic-hook 0 t)
+ ("group" "" vhdl-template-group-hook 0 t)
+ ("guarded" "" vhdl-template-default-hook 0 t)
+ ("if" "" vhdl-template-if-hook 0 t)
+ ("impure" "" vhdl-template-default-hook 0 t)
+ ("in" "" vhdl-template-default-hook 0 t)
+ ("inertial" "" vhdl-template-default-hook 0 t)
+ ("inout" "" vhdl-template-default-hook 0 t)
+ ("inst" "" vhdl-template-instance-hook 0 t)
+ ("instance" "" vhdl-template-instance-hook 0 t)
+ ("is" "" vhdl-template-default-hook 0 t)
+ ("label" "" vhdl-template-default-hook 0 t)
+ ("library" "" vhdl-template-library-hook 0 t)
+ ("linkage" "" vhdl-template-default-hook 0 t)
+ ("literal" "" vhdl-template-default-hook 0 t)
+ ("loop" "" vhdl-template-bare-loop-hook 0 t)
+ ("map" "" vhdl-template-map-hook 0 t)
+ ("mod" "" vhdl-template-default-hook 0 t)
+ ("nand" "" vhdl-template-default-hook 0 t)
+ ("new" "" vhdl-template-default-hook 0 t)
+ ("next" "" vhdl-template-next-hook 0 t)
+ ("nor" "" vhdl-template-default-hook 0 t)
+ ("not" "" vhdl-template-default-hook 0 t)
+ ("null" "" vhdl-template-default-hook 0 t)
+ ("of" "" vhdl-template-default-hook 0 t)
+ ("on" "" vhdl-template-default-hook 0 t)
+ ("open" "" vhdl-template-default-hook 0 t)
+ ("or" "" vhdl-template-default-hook 0 t)
+ ("others" "" vhdl-template-others-hook 0 t)
+ ("out" "" vhdl-template-default-hook 0 t)
+ ("pack" "" vhdl-template-package-hook 0 t)
+ ("package" "" vhdl-template-package-hook 0 t)
+ ("port" "" vhdl-template-port-hook 0 t)
+ ("postponed" "" vhdl-template-default-hook 0 t)
+ ("procedure" "" vhdl-template-procedure-hook 0 t)
+ ("process" "" vhdl-template-process-hook 0 t)
+ ("pure" "" vhdl-template-default-hook 0 t)
+ ("range" "" vhdl-template-default-hook 0 t)
+ ("record" "" vhdl-template-default-hook 0 t)
+ ("register" "" vhdl-template-default-hook 0 t)
+ ("reject" "" vhdl-template-default-hook 0 t)
+ ("rem" "" vhdl-template-default-hook 0 t)
+ ("report" "" vhdl-template-report-hook 0 t)
+ ("return" "" vhdl-template-return-hook 0 t)
+ ("rol" "" vhdl-template-default-hook 0 t)
+ ("ror" "" vhdl-template-default-hook 0 t)
+ ("select" "" vhdl-template-selected-signal-asst-hook 0 t)
+ ("severity" "" vhdl-template-default-hook 0 t)
+ ("shared" "" vhdl-template-default-hook 0 t)
+ ("sig" "" vhdl-template-signal-hook 0 t)
+ ("signal" "" vhdl-template-signal-hook 0 t)
+ ("sla" "" vhdl-template-default-hook 0 t)
+ ("sll" "" vhdl-template-default-hook 0 t)
+ ("sra" "" vhdl-template-default-hook 0 t)
+ ("srl" "" vhdl-template-default-hook 0 t)
+ ("subtype" "" vhdl-template-subtype-hook 0 t)
+ ("then" "" vhdl-template-default-hook 0 t)
+ ("to" "" vhdl-template-default-hook 0 t)
+ ("transport" "" vhdl-template-default-hook 0 t)
+ ("type" "" vhdl-template-type-hook 0 t)
+ ("unaffected" "" vhdl-template-default-hook 0 t)
+ ("units" "" vhdl-template-default-hook 0 t)
+ ("until" "" vhdl-template-default-hook 0 t)
+ ("use" "" vhdl-template-use-hook 0 t)
+ ("var" "" vhdl-template-variable-hook 0 t)
+ ("variable" "" vhdl-template-variable-hook 0 t)
+ ("wait" "" vhdl-template-wait-hook 0 t)
+ ("when" "" vhdl-template-when-hook 0 t)
+ ("while" "" vhdl-template-while-loop-hook 0 t)
+ ("with" "" vhdl-template-with-hook 0 t)
+ ("xnor" "" vhdl-template-default-hook 0 t)
+ ("xor" "" vhdl-template-default-hook 0 t)
))
;; VHDL-AMS keywords
(when (and (memq 'vhdl vhdl-electric-keywords) (vhdl-standard-p 'ams))
'(
- ("across" "" vhdl-template-default-hook 0)
- ("break" "" vhdl-template-break-hook 0)
- ("limit" "" vhdl-template-limit-hook 0)
- ("nature" "" vhdl-template-nature-hook 0)
- ("noise" "" vhdl-template-default-hook 0)
- ("procedural" "" vhdl-template-procedural-hook 0)
- ("quantity" "" vhdl-template-quantity-hook 0)
- ("reference" "" vhdl-template-default-hook 0)
- ("spectrum" "" vhdl-template-default-hook 0)
- ("subnature" "" vhdl-template-subnature-hook 0)
- ("terminal" "" vhdl-template-terminal-hook 0)
- ("through" "" vhdl-template-default-hook 0)
- ("tolerance" "" vhdl-template-default-hook 0)
+ ("across" "" vhdl-template-default-hook 0 t)
+ ("break" "" vhdl-template-break-hook 0 t)
+ ("limit" "" vhdl-template-limit-hook 0 t)
+ ("nature" "" vhdl-template-nature-hook 0 t)
+ ("noise" "" vhdl-template-default-hook 0 t)
+ ("procedural" "" vhdl-template-procedural-hook 0 t)
+ ("quantity" "" vhdl-template-quantity-hook 0 t)
+ ("reference" "" vhdl-template-default-hook 0 t)
+ ("spectrum" "" vhdl-template-default-hook 0 t)
+ ("subnature" "" vhdl-template-subnature-hook 0 t)
+ ("terminal" "" vhdl-template-terminal-hook 0 t)
+ ("through" "" vhdl-template-default-hook 0 t)
+ ("tolerance" "" vhdl-template-default-hook 0 t)
))
;; user model keywords
(when (memq 'user vhdl-electric-keywords)
@@ -2931,7 +2935,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
(setq abbrev-list
(cons (list keyword ""
(vhdl-function-name
- "vhdl-model" (nth 0 (car alist)) "hook") 0)
+ "vhdl-model" (nth 0 (car alist)) "hook") 0 t)
abbrev-list)))
(setq alist (cdr alist)))
abbrev-list)))))
@@ -3746,7 +3750,8 @@ STRING are replaced by `-' and substrings are converted to lower case."
("Highlight"
["Highlighting On/Off..."
(customize-option
- (if vhdl-xemacs 'font-lock-auto-fontify 'global-font-lock-mode)) t]
+ (if (fboundp 'global-font-lock-mode)
+ 'global-font-lock-mode 'font-lock-auto-fontify)) t]
["Highlight Keywords"
(progn (customize-set-variable 'vhdl-highlight-keywords
(not vhdl-highlight-keywords))
@@ -7854,7 +7859,7 @@ Used for undoing after template abortion.")
;; correct different behavior of function `unread-command-events' in XEmacs
(defun vhdl-character-to-event (arg))
(defalias 'vhdl-character-to-event
- (if vhdl-xemacs 'character-to-event 'identity))
+ (if (fboundp 'character-to-event) 'character-to-event 'identity))
(defun vhdl-work-library ()
"Return the working library name of the current project or \"work\" if no
@@ -10399,7 +10404,7 @@ but not if inside a comment or quote)."
(when (stringp caught) (message caught)))
(when (= invoke-char ?-) (setq abbrev-start-location (point)))
;; delete CR which is still in event queue
- (if vhdl-xemacs
+ (if (fboundp 'enqueue-eval-event)
(enqueue-eval-event 'delete-char -1)
(setq unread-command-events ; push back a delete char
(list (vhdl-character-to-event ?\177))))))))
@@ -11923,9 +11928,7 @@ options vhdl-upper-case-{keywords,types,attributes,enum-values}."
"Return the line number of the line containing point."
(save-restriction
(widen)
- (save-excursion
- (beginning-of-line)
- (1+ (count-lines 1 (point))))))
+ (1+ (count-lines (point-min) (line-beginning-position)))))
(defun vhdl-line-kill-entire (&optional arg)
"Delete entire line."
@@ -16559,26 +16562,24 @@ to visually support naming conventions.")
(defun vhdl-doc-variable (variable)
"Display VARIABLE's documentation in *Help* buffer."
(interactive)
- (with-output-to-temp-buffer "*Help*"
+ (unless vhdl-xemacs
+ (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p)))
+ (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*")
(princ (documentation-property variable 'variable-documentation))
- (unless vhdl-xemacs
- (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p)))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))
(print-help-return-message)))
(defun vhdl-doc-mode ()
"Display VHDL Mode documentation in *Help* buffer."
(interactive)
- (with-output-to-temp-buffer "*Help*"
+ (unless vhdl-xemacs
+ (help-setup-xref (list #'vhdl-doc-mode) (interactive-p)))
+ (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*")
(princ mode-name)
(princ " mode:\n")
(princ (documentation 'vhdl-mode))
- (unless vhdl-xemacs
- (help-setup-xref (list #'vhdl-doc-mode) (interactive-p)))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))
(print-help-return-message)))
@@ -16587,5 +16588,5 @@ to visually support naming conventions.")
(provide 'vhdl-mode)
-;;; arch-tag: 780d7073-9b5d-4c6c-b0d8-26b28783aba3
+;; arch-tag: 780d7073-9b5d-4c6c-b0d8-26b28783aba3
;;; vhdl-mode.el ends here