comparison lisp/progmodes/vhdl-mode.el @ 91073:4bc33ffdda1a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 902-908) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 131-137) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 261-262) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-278
author Miles Bader <miles@gnu.org>
date Sat, 27 Oct 2007 09:12:07 +0000
parents bdb3fe0ba9fa f873840f9fea
children 2fcaae6177a5
comparison
equal deleted inserted replaced
91072:74ab3ea909f9 91073:4bc33ffdda1a
123 123
124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
125 125
126 ;;; Code: 126 ;;; Code:
127 127
128 ;; XEmacs handling
129 (defconst vhdl-xemacs (string-match "XEmacs" emacs-version)
130 "Non-nil if XEmacs is used.")
131 ;; Emacs 21+ handling 128 ;; Emacs 21+ handling
132 (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not vhdl-xemacs)) 129 (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs)))
133 "Non-nil if GNU Emacs 21, 22, ... is used.") 130 "Non-nil if GNU Emacs 21, 22, ... is used.")
134 (defconst vhdl-emacs-22 (and (<= 22 emacs-major-version) (not vhdl-xemacs)) 131 (defconst vhdl-emacs-22 (and (<= 22 emacs-major-version) (not (featurep 'xemacs)))
135 "Non-nil if GNU Emacs 22, ... is used.") 132 "Non-nil if GNU Emacs 22, ... is used.")
136 133
137 (defvar compilation-file-regexp-alist) 134 (defvar compilation-file-regexp-alist)
138 (defvar conf-alist) 135 (defvar conf-alist)
139 (defvar conf-entry) 136 (defvar conf-entry)
1842 "Related general customizations." 1839 "Related general customizations."
1843 :group 'vhdl) 1840 :group 'vhdl)
1844 1841
1845 ;; add related general customizations 1842 ;; add related general customizations
1846 (custom-add-to-group 'vhdl-related 'hideshow 'custom-group) 1843 (custom-add-to-group 'vhdl-related 'hideshow 'custom-group)
1847 (if vhdl-xemacs 1844 (if (featurep 'xemacs)
1848 (custom-add-to-group 'vhdl-related 'paren-mode 'custom-variable) 1845 (custom-add-to-group 'vhdl-related 'paren-mode 'custom-variable)
1849 (custom-add-to-group 'vhdl-related 'paren-showing 'custom-group)) 1846 (custom-add-to-group 'vhdl-related 'paren-showing 'custom-group))
1850 (custom-add-to-group 'vhdl-related 'ps-print 'custom-group) 1847 (custom-add-to-group 'vhdl-related 'ps-print 'custom-group)
1851 (custom-add-to-group 'vhdl-related 'speedbar 'custom-group) 1848 (custom-add-to-group 'vhdl-related 'speedbar 'custom-group)
1852 (custom-add-to-group 'vhdl-related 'line-number-mode 'custom-variable) 1849 (custom-add-to-group 'vhdl-related 'line-number-mode 'custom-variable)
1853 (unless vhdl-xemacs 1850 (unless (featurep 'xemacs)
1854 (custom-add-to-group 'vhdl-related 'transient-mark-mode 'custom-variable)) 1851 (custom-add-to-group 'vhdl-related 'transient-mark-mode 'custom-variable))
1855 (custom-add-to-group 'vhdl-related 'user-full-name 'custom-variable) 1852 (custom-add-to-group 'vhdl-related 'user-full-name 'custom-variable)
1856 (custom-add-to-group 'vhdl-related 'mail-host-address 'custom-variable) 1853 (custom-add-to-group 'vhdl-related 'mail-host-address 'custom-variable)
1857 (custom-add-to-group 'vhdl-related 'user-mail-address 'custom-variable) 1854 (custom-add-to-group 'vhdl-related 'user-mail-address 'custom-variable)
1858 1855
2091 (setq i (1- i)) 2088 (setq i (1- i))
2092 (if (eq (aref newstr i) fromchar) (aset newstr i tochar))) 2089 (if (eq (aref newstr i) fromchar) (aset newstr i tochar)))
2093 newstr))) 2090 newstr)))
2094 2091
2095 ;; `itimer.el': idle timer bug fix in version 1.09 (XEmacs 21.1.9) 2092 ;; `itimer.el': idle timer bug fix in version 1.09 (XEmacs 21.1.9)
2096 (when (and vhdl-xemacs (string< itimer-version "1.09") 2093 (when (and (featurep 'xemacs) (string< itimer-version "1.09")
2097 (not noninteractive)) 2094 (not noninteractive))
2098 (load "itimer") 2095 (load "itimer")
2099 (when (string< itimer-version "1.09") 2096 (when (string< itimer-version "1.09")
2100 (message "WARNING: Install included `itimer.el' patch first (see INSTALL file)") 2097 (message "WARNING: Install included `itimer.el' patch first (see INSTALL file)")
2101 (beep) (sit-for 5))) 2098 (beep) (sit-for 5)))
2484 (select-frame last-frame))))) 2481 (select-frame last-frame)))))
2485 2482
2486 (defun vhdl-show-messages () 2483 (defun vhdl-show-messages ()
2487 "Get *Messages* buffer to show recent messages." 2484 "Get *Messages* buffer to show recent messages."
2488 (interactive) 2485 (interactive)
2489 (display-buffer (if vhdl-xemacs " *Message-Log*" "*Messages*"))) 2486 (display-buffer (if (featurep 'xemacs) " *Message-Log*" "*Messages*")))
2490 2487
2491 (defun vhdl-use-direct-instantiation () 2488 (defun vhdl-use-direct-instantiation ()
2492 "Return whether direct instantiation is used." 2489 "Return whether direct instantiation is used."
2493 (or (eq vhdl-use-direct-instantiation 'always) 2490 (or (eq vhdl-use-direct-instantiation 'always)
2494 (and (eq vhdl-use-direct-instantiation 'standard) 2491 (and (eq vhdl-use-direct-instantiation 'standard)
2684 (define-key vhdl-mode-map "\M-\C-f" 'vhdl-forward-sexp) 2681 (define-key vhdl-mode-map "\M-\C-f" 'vhdl-forward-sexp)
2685 (define-key vhdl-mode-map "\M-\C-b" 'vhdl-backward-sexp) 2682 (define-key vhdl-mode-map "\M-\C-b" 'vhdl-backward-sexp)
2686 (define-key vhdl-mode-map "\M-\C-u" 'vhdl-backward-up-list) 2683 (define-key vhdl-mode-map "\M-\C-u" 'vhdl-backward-up-list)
2687 (define-key vhdl-mode-map "\M-\C-a" 'vhdl-backward-same-indent) 2684 (define-key vhdl-mode-map "\M-\C-a" 'vhdl-backward-same-indent)
2688 (define-key vhdl-mode-map "\M-\C-e" 'vhdl-forward-same-indent) 2685 (define-key vhdl-mode-map "\M-\C-e" 'vhdl-forward-same-indent)
2689 (unless vhdl-xemacs ; would override `M-backspace' in XEmacs 2686 (unless (featurep 'xemacs) ; would override `M-backspace' in XEmacs
2690 (define-key vhdl-mode-map "\M-\C-h" 'vhdl-mark-defun)) 2687 (define-key vhdl-mode-map "\M-\C-h" 'vhdl-mark-defun))
2691 (define-key vhdl-mode-map "\M-\C-q" 'vhdl-indent-sexp) 2688 (define-key vhdl-mode-map "\M-\C-q" 'vhdl-indent-sexp)
2692 (define-key vhdl-mode-map "\M-^" 'vhdl-delete-indentation) 2689 (define-key vhdl-mode-map "\M-^" 'vhdl-delete-indentation)
2693 ;; backspace/delete key bindings 2690 ;; backspace/delete key bindings
2694 (define-key vhdl-mode-map [backspace] 'backward-delete-char-untabify) 2691 (define-key vhdl-mode-map [backspace] 'backward-delete-char-untabify)
2711 (define-key vhdl-mode-map "\C-c\C-p\C-e" 'vhdl-port-paste-entity) 2708 (define-key vhdl-mode-map "\C-c\C-p\C-e" 'vhdl-port-paste-entity)
2712 (define-key vhdl-mode-map "\C-c\C-p\C-c" 'vhdl-port-paste-component) 2709 (define-key vhdl-mode-map "\C-c\C-p\C-c" 'vhdl-port-paste-component)
2713 (define-key vhdl-mode-map "\C-c\C-p\C-i" 'vhdl-port-paste-instance) 2710 (define-key vhdl-mode-map "\C-c\C-p\C-i" 'vhdl-port-paste-instance)
2714 (define-key vhdl-mode-map "\C-c\C-p\C-s" 'vhdl-port-paste-signals) 2711 (define-key vhdl-mode-map "\C-c\C-p\C-s" 'vhdl-port-paste-signals)
2715 (define-key vhdl-mode-map "\C-c\C-p\M-c" 'vhdl-port-paste-constants) 2712 (define-key vhdl-mode-map "\C-c\C-p\M-c" 'vhdl-port-paste-constants)
2716 (if vhdl-xemacs ; `... C-g' not allowed in XEmacs 2713 (if (featurep 'xemacs) ; `... C-g' not allowed in XEmacs
2717 (define-key vhdl-mode-map "\C-c\C-p\M-g" 'vhdl-port-paste-generic-map) 2714 (define-key vhdl-mode-map "\C-c\C-p\M-g" 'vhdl-port-paste-generic-map)
2718 (define-key vhdl-mode-map "\C-c\C-p\C-g" 'vhdl-port-paste-generic-map)) 2715 (define-key vhdl-mode-map "\C-c\C-p\C-g" 'vhdl-port-paste-generic-map))
2719 (define-key vhdl-mode-map "\C-c\C-p\C-z" 'vhdl-port-paste-initializations) 2716 (define-key vhdl-mode-map "\C-c\C-p\C-z" 'vhdl-port-paste-initializations)
2720 (define-key vhdl-mode-map "\C-c\C-p\C-t" 'vhdl-port-paste-testbench) 2717 (define-key vhdl-mode-map "\C-c\C-p\C-t" 'vhdl-port-paste-testbench)
2721 (define-key vhdl-mode-map "\C-c\C-p\C-f" 'vhdl-port-flatten) 2718 (define-key vhdl-mode-map "\C-c\C-p\C-f" 'vhdl-port-flatten)
5393 (while (looking-at "--.*") 5390 (while (looking-at "--.*")
5394 (goto-char (match-end 0)) 5391 (goto-char (match-end 0))
5395 (skip-chars-forward " \t\n")))) 5392 (skip-chars-forward " \t\n"))))
5396 5393
5397 ;; XEmacs hack: work around buggy `forward-comment' in XEmacs 21.4+ 5394 ;; XEmacs hack: work around buggy `forward-comment' in XEmacs 21.4+
5398 (unless (and vhdl-xemacs (string< "21.2" emacs-version)) 5395 (unless (and (featurep 'xemacs) (string< "21.2" emacs-version))
5399 (defalias 'vhdl-forward-comment 'forward-comment)) 5396 (defalias 'vhdl-forward-comment 'forward-comment))
5400 5397
5401 ;; This is the best we can do in Win-Emacs. 5398 ;; This is the best we can do in Win-Emacs.
5402 (defun vhdl-win-il (&optional lim) 5399 (defun vhdl-win-il (&optional lim)
5403 "Determine if point is in a VHDL literal." 5400 "Determine if point is in a VHDL literal."
13011 (set (make-local-variable 'ps-left-margin) 40.0) 13008 (set (make-local-variable 'ps-left-margin) 40.0)
13012 (set (make-local-variable 'ps-right-margin) 40.0)))) 13009 (set (make-local-variable 'ps-right-margin) 40.0))))
13013 13010
13014 (defun vhdl-ps-print-init () 13011 (defun vhdl-ps-print-init ()
13015 "Initialize postscript printing." 13012 "Initialize postscript printing."
13016 (if vhdl-xemacs 13013 (if (featurep 'xemacs)
13017 (when (boundp 'ps-print-color-p) 13014 (when (boundp 'ps-print-color-p)
13018 (vhdl-ps-print-settings)) 13015 (vhdl-ps-print-settings))
13019 (make-local-variable 'ps-print-hook) 13016 (make-local-variable 'ps-print-hook)
13020 (add-hook 'ps-print-hook 'vhdl-ps-print-settings))) 13017 (add-hook 'ps-print-hook 'vhdl-ps-print-settings)))
13021 13018
14062 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] 14059 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))]
14063 ["Generate Makefile" vhdl-speedbar-generate-makefile 14060 ["Generate Makefile" vhdl-speedbar-generate-makefile
14064 (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))] 14061 (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))]
14065 ["Rescan Directory" vhdl-speedbar-rescan-hierarchy 14062 ["Rescan Directory" vhdl-speedbar-rescan-hierarchy
14066 :active (save-excursion (beginning-of-line) (looking-at "[0-9]+:")) 14063 :active (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))
14067 ,(if vhdl-xemacs :active :visible) (not vhdl-speedbar-show-projects)] 14064 ,(if (featurep 'xemacs) :active :visible) (not vhdl-speedbar-show-projects)]
14068 ["Rescan Project" vhdl-speedbar-rescan-hierarchy 14065 ["Rescan Project" vhdl-speedbar-rescan-hierarchy
14069 :active (save-excursion (beginning-of-line) (looking-at "[0-9]+:")) 14066 :active (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))
14070 ,(if vhdl-xemacs :active :visible) vhdl-speedbar-show-projects] 14067 ,(if (featurep 'xemacs) :active :visible) vhdl-speedbar-show-projects]
14071 ["Save Caches" vhdl-save-caches vhdl-updated-project-list]))) 14068 ["Save Caches" vhdl-save-caches vhdl-updated-project-list])))
14072 ;; hook-ups 14069 ;; hook-ups
14073 (speedbar-add-expansion-list 14070 (speedbar-add-expansion-list
14074 '("vhdl directory" vhdl-speedbar-menu-items vhdl-speedbar-key-map 14071 '("vhdl directory" vhdl-speedbar-menu-items vhdl-speedbar-key-map
14075 vhdl-speedbar-display-directory)) 14072 vhdl-speedbar-display-directory))
16187 (setq sublist (nth 11 (car commands-alist))) 16184 (setq sublist (nth 11 (car commands-alist)))
16188 (unless (or (equal "" (car sublist)) 16185 (unless (or (equal "" (car sublist))
16189 (assoc (car sublist) regexp-alist)) 16186 (assoc (car sublist) regexp-alist))
16190 (setq regexp-alist (cons (list (nth 0 sublist) 16187 (setq regexp-alist (cons (list (nth 0 sublist)
16191 (if (= 0 (nth 1 sublist)) 16188 (if (= 0 (nth 1 sublist))
16192 (if vhdl-xemacs 9 nil) 16189 (if (featurep 'xemacs) 9 nil)
16193 (nth 1 sublist)) 16190 (nth 1 sublist))
16194 (nth 2 sublist) (nth 3 sublist)) 16191 (nth 2 sublist) (nth 3 sublist))
16195 regexp-alist))) 16192 regexp-alist)))
16196 (setq commands-alist (cdr commands-alist))) 16193 (setq commands-alist (cdr commands-alist)))
16197 (setq compilation-error-regexp-alist 16194 (setq compilation-error-regexp-alist
16987 (vhdl-keep-region-active)) 16984 (vhdl-keep-region-active))
16988 16985
16989 (defun vhdl-doc-variable (variable) 16986 (defun vhdl-doc-variable (variable)
16990 "Display VARIABLE's documentation in *Help* buffer." 16987 "Display VARIABLE's documentation in *Help* buffer."
16991 (interactive) 16988 (interactive)
16992 (unless vhdl-xemacs 16989 (unless (featurep 'xemacs)
16993 (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) 16990 (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p)))
16994 (with-output-to-temp-buffer 16991 (with-output-to-temp-buffer
16995 (if (fboundp 'help-buffer) (help-buffer) "*Help*") 16992 (if (fboundp 'help-buffer) (help-buffer) "*Help*")
16996 (princ (documentation-property variable 'variable-documentation)) 16993 (princ (documentation-property variable 'variable-documentation))
16997 (with-current-buffer standard-output 16994 (with-current-buffer standard-output
16999 (print-help-return-message))) 16996 (print-help-return-message)))
17000 16997
17001 (defun vhdl-doc-mode () 16998 (defun vhdl-doc-mode ()
17002 "Display VHDL Mode documentation in *Help* buffer." 16999 "Display VHDL Mode documentation in *Help* buffer."
17003 (interactive) 17000 (interactive)
17004 (unless vhdl-xemacs 17001 (unless (featurep 'xemacs)
17005 (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) 17002 (help-setup-xref (list #'vhdl-doc-mode) (interactive-p)))
17006 (with-output-to-temp-buffer 17003 (with-output-to-temp-buffer
17007 (if (fboundp 'help-buffer) (help-buffer) "*Help*") 17004 (if (fboundp 'help-buffer) (help-buffer) "*Help*")
17008 (princ mode-name) 17005 (princ mode-name)
17009 (princ " mode:\n") 17006 (princ " mode:\n")